Skip to main content

P2P

Communication

EzSpark makes use of a P2P communication system to connect the different hosts with the users that join the specific host training

For the P2P connection we considered the application of both UpNp protocol and the Hole punching technique. However both these 2 applications can cause different issues to take into account. Hackers could exploit some vulnerabilities of the host server as well as try to make ddos attacks to affect the training themselves and saturate the communication. Also, in same cases hosts should have turned the firewall off to use this direct communication. Moreover only about 64% of NAT supports TCP Hole punching and the majority of NAT must set the UpNp protocol manually.

For this reason EzSpark adopted a tunneling solution between hosts and the trainers. between them there is a server that connects the users without let the hosts expose their ip or port to others. The hosts connect as clients to our server which tunnels all the requests of the trainers to the hosts who answer back to us which in turn report everything to the trainers again

manzete

The communication is enterily handled by sockets and in case people are using the browser by websockets. Server side each host can be seen as such through a private key. Users that connect by socket with only public key will be seen as trainers. For this reason is important for the hosts to do not share their own private keys, otherwise people can act as hosts of a particular training even though they currently are not the creator of that training

Interaction

Hosts initialize a number of environments as the number of genomes and number of trainers connected. Then they expose the step(self,action) and reset(self) functions which will be called by trainers. The trainers will take an action from each model assigned to them and will ask for the next step(self,action) or reset(self) call. the hosts return the output from these functions.

The distribution is done evaluating the actions of each model in parallel by the trainers

We do not let trainers run hosts environment locally for safeness reasons

Technology

  • EzSpark developed a tunneling software completely in C.

  • The C code has been wrapped in Cython to be used server and client side in python.

  • Also, has be wrapped in webassembly so that the same code can be used in javascript