superfly / corrosion

Gossip-based service discovery (and more) for large distributed systems.
https://superfly.github.io/corrosion/
Apache License 2.0
624 stars 19 forks source link

Apply backpressure once changes queue reaches a set length #198

Open jeromegn opened 2 months ago

jeromegn commented 2 months ago

The number of queued changes can really get large if a node has been off for a while and then starts syncing millions of changes. One problem is that ever since we switched to in-SQLite bookkeeping almost exclusively, the logic is forgetful about which versions it has already seen to avoid storing too much metadata in memory.

Corrosion should propagate backpressure from the handle_changes loop so that synchronization stops if the queue reaches a certain length.