go-libp2p-pubsub
go-libp2p-pubsub copied to clipboard
Question: evaluating message metadata for routing decisions
We don't propagate IHAVE metadata immediately. We stash it for piggybacking, or until the next heartbeat arrives (1s). However, we are planning to use this metadata to evaluate routing decisions (some of which will be based on latency observations).
How can such a model be effective, given that the arrival of gossip is non-deterministic, and it doesn't carry any provable timestamps?
Basically, if I receive a message X from peer A (with with I'm reciprocally meshed), and I also receive an IHAVE from peer B (with with I'm gossiping only), how can I determine if B received message X before A was able to deliver it to me?
Sure, it's true that we won't be able to do much in comparing latencies based on IHAVE messages. However, we can calculate the latency of a peer based on how quickly they respond to IWANT messages with the message itself.
Also the questions about the reliability/performance of a peer (latency, throughput, etc.) seem to mirror the discussions going on for improving bitswap sessions in ipfs/go-bitswap#186 and https://github.com/ipfs/go-bitswap/pull/189#issuecomment-537250418. There might be some ideas or code we could share with them.
This is pertinent to episub and it is a very good question; the decision will have to be more nuanced and perhaps include timestamps.
It might also be not such a big deal in that the latency will be tree-optimized based on mesh transmission of messages. The IHAVEs will help correct overlay deficiencies and it might not be as important to select the fastest peer, any peer might do.