Comments (6)
You might already know this, but I was browsing StackOverflow on the topic of TCP hole punching and found this paper by Prof. Bryan Ford: https://bford.info/pub/net/p2pnat/index.html.
from disco.
I found another method that could be useful and doesn't require an intermediate server: https://github.com/samyk/pwnat.
It only requires that one peer knows the address of the other.
From what I understand it works like this:
- The "server" peer sends ICMP echo request packets to a fixed address (3.3.3.3) which won't be returned.
- The "client" peer sends and ICMP Time Exceeded packet to the "server" peer, containing the original packet sent by the "server" peer. The NAT lets this pass because it sees the original packet infomation inside the Time Exceeded Packet.
- The "server" peer at this point knows the "client" peer's IP address from the Time Exceeded packet and they can connect using hole punching, without the need for an intermediary (they have already "discovered" each other).
from disco.
is this still an issue now with peerjs #16 #17 ? (or libp2p.js?)
from disco.
Yes, this is still an issue with peerjs. However, it can be resolved using STUN/TURN servers. Me and Blagoj are working on solving this. So far, we have tested the functionality with our own peerJS server on AWS and public STUN/TURN server, but the public server is not very reliable, so many messages get dropped. Next, we will try to host our own STUN/TURN server also on AWS.
from disco.
adding the following info collected by @tvogels
I spent some time today exploring the space of code available related to messaging and distributed/decentralized systems. I thought I should share my notes here.
ZeroMQ is a very universal low-level messaging library. It has bindings for Python & Javascript. Good for low-latency small messages. You can get very creative with protocols. Sending large messages is not easy. You need to chunk the messages and provide flow-control (if a sender is faster than a receiver, it should stop sending until the receiver is free again)
UDP beacons allow peers to find each other on a network without a coordinator. Does not work across routers or firewalls.
PyTorch RPC allows quite flexible communication patterns between nodes, and seems like a nice abstraction, but assumes a constant world size and reliable peers. Non-fixed ‘worlds’ are on the roadmap.
PyTorch/TensorPipe is the communication backend used by PyTorch RPC. It sends TCP messages between workers for coordination, and then finds the best protocol between them to stream large tensors (including NVLink, GPUDirect, shared memory, …). There are no good python bindings yet, so it would require some C++ coding to get a nice ‘send tensor primitive’ available in Python. If anyone wants to help with this, that would be awesome!
Hivemind is a decentralized learning framework in Python. It uses a DHT for coordination between workers. It includes all-reduce and group all-reduce, which seems a bit of an anti-pattern to me (?). It’s used in Moshpit SGD. No solution for NAT traversal.
gRPC: is a remote procedure call library from Google, and could be an alternative to ZeroMQ (both Python and JavaScript). It’s used by Hivemind.
Chunking
To send large data such files over TCP, you need to manually chunk them, and send them at a good speed. This probably applies to PeerJS, ZeroMQ, gRPC, and libp2p. I found this article informative: https://zguide.zeromq.org/docs/chapter7/
NAT Traversal
I haven’t found any good-looking solutions to NAT traversal in Python. Has anyone found any? I wonder if this can be done separately by a different library than the rest of the communication?
Asynchronous Python code
To me, asynchronous JS code looks much cleaner than asynchronous Python code. For my personal project, I’m not targeting mobile devices. Still, I consider using JS instead of Python. Tensorflow JS on nodejs seems to be as fast as Tensorflow in Python (it’s just bindings for C++ code)
from disco.
closing as currently handled relatively ok with websockets and simplepeer for p2p #255
from disco.
Related Issues (20)
- Change all instances of collab* to colab* HOT 2
- Stuck in 404 Not Found page HOT 2
- WebGL prevents training wikitext on Firefox HOT 1
- Saving and loading GPT-tfjs models with IndexedDB fails with error
- Implement an actual error handling mechanism HOT 3
- Discrepancy between training logs and manually evaluating metrics
- Connecting folder displays alarming "Upload" warning message
- Garbage Collecting past node contributions
- Add an LLM generation UI HOT 3
- remove epochs and only use batches HOT 8
- fix task creation form
- Minor UI changes for the release HOT 2
- Decentralized training on MNIST fails with error
- Training chart animations are jumpy
- The number of participants is wrong for both federated and decentralized learning
- New users are not able to join once training started
- Peer to peer connection fails between Firefox and other browsers (Chrome & Safari)
- aggregators status
- aggregator rework HOT 4
- split/rework clients HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disco.