Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
LastSeen
as libp2p seen messages cache strategy
By default, the libp2p seen messages cache uses the `FirstSeen` strategy which expires an entry once TTL elapses from the time it was added. This means that if a single message is being received frequently and consistently, pubsub will re-broadcast it every TTL, rather than never re-broadcasting it. In the context of the Keep client which additionally uses app-level retransmissions, that often leads to a strong message amplification in the broadcast channel which cause a significant increase in the network load. As the problem is quite common (see libp2p/go-libp2p-pubsub#502), the libp2p team added a new `LastSeen` strategy which behaves differently. This strategy expires an entry once TTL elapses from the last time the message was touched by a cache write (`Add`) or read (`Has`) operation. That gives the desired behavior of never re-broadcasting a message that was already seen within the last TTL period. This reduces the risk of unintended over-amplification.
- Loading branch information