vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
240 stars 52 forks source link

Staggered message sending with elimination of peers during transmission based on idontwants #1100

Open ufarooqstatus opened 1 month ago

ufarooqstatus commented 1 month ago

1) We use semaphores to limit simultaneous transmissions to two 2) During message transmission, we check received idontwants to cancel unnecessary transmissions 3) we relay to outbound peers first to minimize chances of two peers sending to each other

closes PR1093

arnetheduck commented 1 month ago

broadly, limiting concurrent sends this way means two peers can hold up the queue for everyone else, including the fast peers - this is a key reason we haven't gone down this route.

the limit would have to be a lot higher - ie somewhere on the order of dmax probably - we would also need to consider a timeout policy of individual sends stronger than what we have today.

ufarooqstatus commented 1 month ago

broadly, limiting concurrent sends this way means two peers can hold up the queue for everyone else, including the fast peers - this is a key reason we haven't gone down this route.

This is configurable, but i could find very similar results for 2-5 simultaneous sends

the limit would have to be a lot higher - ie somewhere on the order of dmax probably - we would also need to consider a timeout policy of individual sends stronger than what we have today.

I have tried this way to time-limit

ufarooqstatus commented 1 month ago

I have tried this way to time-limit

In fact (at-least) a slow peer can identify itself as a slow peer if it can not finish all sends within a strict time-limit. Also the peers for which we always miss the timebound. Thinking to try different locks for fast/slow peers