TokTok / c-toxcore

The future of online communications.
https://tox.chat
GNU General Public License v3.0
2.25k stars 284 forks source link

Network Throttle #644

Open ghost opened 6 years ago

ghost commented 6 years ago

I am recreating some issue from original @irungentoo repository. It was recommend to post it here because it is most actual repository for toxcore.

So issue https://github.com/irungentoo/toxcore/issues/1581

There should be a variable that clients can set that affects the amount of network traffic. All packets that are sent every x seconds should depend on this variable in some way (not necessarily in the same way). This should help (mobile) clients restrict/allow the network usage depending on availability of data usage.

And copy of my own comments:

Is it possible to limit such traffic? Specify some rate or similar things. I think it is too much packets per second for chat.

Approximately it sends/receives 600 packets per minute per one instance. Maybe it is possible to install own server and communicate with the world through that server and each node will have the same DHT traffic obtained from such server?

I think for now my meta traffic is much greater than my payload. And such big traffic will be a problem for mobile devices.

tox-user commented 6 years ago

My knowledge of how toxcore works is very limited, but I think this behaviour is required to receive status updates from your friends. To be able to see who is online, see their current name and status. And to receive friend requests.

ghost commented 6 years ago

Are status updates not P2P traffic? All mentioned packets are from/to random IPs (not related to my contacts).

tox-user commented 6 years ago

Connections to your friends are made directly to them (https://tox.chat/faq.html#tox-leak-ip), so status updates should be peer-to-peer. In that case I don't know what's causing that traffic.

tox-user commented 6 years ago

What version of toxcore are you using?

ghost commented 6 years ago

The traffic is then likely to be dht lookups ... searching for clients... like hey do you know where "xyz" is...nope but try "abc". This the penalty for not having a central server to look up who is where (on the internet that is). A good intro to DHT might help http://engineering.bittorrent.com/2013/01/22/bittorrent-tech-talks-dht/

ghost commented 6 years ago

The check neighbour status is just a simple packet to that neighbour so I think it is lookups taking place. Perhapps the way forward is for mobile clients to only respond to lookups matching them selves ie a lookup for "xyz"...yeah thats me and ofcourse announcements for actual contacts we have a full address for and not no but try here. Leave all that for full clients. That should minimise traffic at mobile end points. Any thoughts on this?

ghost commented 6 years ago

@dingosan

I also think it is DHT (check my original post). But as you can see throttling of DHT (if it is doable) is requested by some users and it is very appreciated by me. It can be some sort of ratio/factor/weight of node... Also I suggested another option for networks - dedicated server for DHT. Let's say you have 100 desktops inside local network... it is much better to have some external node which will handle DHT for whole this group. I prefer to setup VPS and connect tox clients to it. I know it is maybe too much work.. but just as idea for the future. So such DHT node will have loading factor 100 of 100 and nodes connected to that node will have 0 of 100 (working as mobile client reporting only about itself). If it is standalone node (for example notebook) this can be set to 10 of 100 (some value calculated experimentally). Otherwise you will have to turn off Wi-Fi or Tox if you are on battery.

My knowledge in DHT is not big. But common idea: there is a lot of cases when it can be important to limit participation in DHT.

ghost commented 6 years ago

You already have something similar. It is used in mobile clients. Disable udp mode which is used for dht traffic (and possibly other things?) on all lan clients bar one....it will be the proxy for them.

tox-user commented 6 years ago

This issue is a duplicate of https://github.com/TokTok/c-toxcore/issues/441.