hyperboria / bugs

Peer-to-peer IPv6 networking, secure and near-zero-conf.
154 stars 17 forks source link

Too much DHT questions / hanshakes per second? #42

Open viric opened 9 years ago

viric commented 9 years ago

A session handshake is very heavy for architectures without curve25519 optimized code (like ARM without neon or mips). Moreover, it requires some bandwidth.

On an x86_64 node, I doing "cjdcmd-ng log | grep hello" reports at least 3 or 4 messages per second. I think that this is close to 3 or 4 handshakes per second. Doing "sessionStats | wc -l" reports ~160 sessions, 30% of them with "grep HANDSHAKE".

On a sheevaplug (armv5tel 1.2GHz) this means ~30% of CPU while idle, and similar on a 320MHz mips32 router.

I feel like these numbers are too high, given the current number of cjdns nodes. These sessions should be related to DHT questions, but I don't understand how the current hyperboria can cause 3/4 DHT operations per second in a single idle node.

viric commented 9 years ago

Sometimes the cpu usage on idle armv5tel or mips rise to 60 or 80%, and that may be related to peaks in DHT queries.

viric commented 9 years ago

Slow handshakes have also a bigb impact in the bandwidth of transfers within sessions, because cjdns runs single-thread and handshakes (if I guess right) do not have less priority in processing.

mildred commented 9 years ago

I was thinking that on leaf nodes, perhaps it could be possible to disable de DHT. It would make sense for mobile or low-power devices. The moment you want to have more than 1 peer though, you'll need to include the DHT again.