-
Notifications
You must be signed in to change notification settings - Fork 37
feat: cache interface addresses for 1 minute #129
Conversation
This can be quite an overhead in cases of high connection rates. The main overhead is thread blocking syscall causing a lot of context switching. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so what is the expensive component here?
Syscall to fetch all physical interface address called on every request for a swarm address list. |
why not cache the addresses completely? |
We can, the question is if we want to do it. |
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Updated it to cache whole (RWlocks have a nasty property of contending on one cache line, in cpp they sometimes use distributed RWLocks where reader counts are distributed across many cache lines). |
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
bf73c80
to
1b20b7b
Compare
Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
This reduced time for the bootstrap of a dht test network (using https://github.com/Kubuxu/go-libp2p-faketransport) by half. |
This can be quite an overhead in cases of high connection rates.
The main overhead is thread blocking syscall causing a lot of context
switching.