mit-pdos / noria

Fast web applications through dynamic, partially-stateful dataflow
Apache License 2.0
4.99k stars 244 forks source link

Avoiding having both size and time limits for base batching #101

Closed jonhoo closed 6 years ago

jonhoo commented 6 years ago

Base tables (well, GroupCommitQueue really) currently use two values for batching: flush_timeout and queue_capacity. The former dictates that a batch may not stay in the buffer longer than the given time, and the latter dictates that we always flush once we have accumulated so and so many packets (note that it's not rows but packets!). To further complicate this story, the timer is only checked when the input stream lets up for a short while, or once every 64 packets.

This approach leads to a lot of parameter fiddling to get the results you want. Since we're primarily focused on high throughput with reasonable latency, we should really just have a single parameter that enforces a core property: "a write is never buffered for longer than X". This mirrors what we do in the various benchmarkers too. Basically, when the first row of a write is inserted into the buffer (which will become a batch), we note the time. If at any point (when adding another record or when a timeout occurs), we notice that that more than batching_interval time has passed since that time, we flush the batch.