ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

Should debounce add be a throttle instead? #379

Closed arj03 closed 2 years ago

arj03 commented 2 years ago

While testing the performance of classic vs buttwoo I had to disable the debouncer in db2 because if you do a full sync with the current implementation, then you won't start doing anything with the messages until you get all messages from that feed. If we instead used a throttle, then we would sync every 250ms always. Here is a log from that benchmark if we do a throttle instead:

adding 15k msgs: 3.807s
batching 814
batching 1489
batching 1217
batching 1796
batching 1526
ok 1 wait for replication to complete
after 3000 ms bob has 6842

That 6842 number was around 6200 with addImmediately instead.

The diff to do throttle instead of debounce is 2 lines :-)

staltz commented 2 years ago

Oh, yes, I support this idea!

staltz commented 2 years ago

Seems done, right?

arj03 commented 2 years ago

Right, thanks