New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRDT-Batching support #1008
Comments
Sounds nice, should reduce the amount of height I collect per day significantly ;) How about the ability to open a batch and either commit it or discard it? This way we can commit all changes to an open batch, and when everything is done can commit it as an atomic operation to the cluster. If it fails to get the cluster head, the commit operation should fail and the whole batch gets discarded by the cluster. This helps if multiple servers should write to the same cluster since you can add a retry on the application level, just running the same operation again on the new head/height. So we're basically talking about 3 different modes:
Edit: Rewrote the comment |
Sorry, but this issue is very well scoped already. Batches are local. There is no synchronization between batches started in different peers. Concurrent write operations in a cluster don't fail by design.
You underestimate the pitfalls and effort needed to set up coordination like this on a distributed system. It is way more complicated that it seems. The ability of manually committing an open local batch, while useful, would need to be extended to Raft too which has no batching support at all. Therefore out of scope for the moment. |
I think you misunderstood what I meant. Your approach sounds like To cut my idea down, can we get non-automatic batching?
The close/flush command could get a similar The idea with a reduced 'wait quorum' would need to get the current number of peers, like If that's too much for one change I fully understand! :) |
I'd say yes, after automatic batching support as scoped here exists (this is smaller in scope and does not require API changes). I see it would be super useful to you, just trying to define well scoped work units. I will give some thought and open a follow up issue on non-automatic batching. |
Sounds great! |
This adds batching support to CRDT consensus. The crdt component can now take advantage of the BatchingState, which uses the batching-crdt datastore. In batching mode, the crdt datastore groups any Add and Delete operations in a single delta (instead of just 1, as it does by default). Batching is enabled in the crdt configuration section by setting MaxBatchSize **and** MaxBatchAge. These two settings control when a batch is committed, either by reaching a maximum number of pin/unpin operations, or by reaching a maximum age. Batching unlocks large pin-ingestion escalability for clusters, but should be set according to expected work loads. An additional, hidden MaxQueueSize parameter provides the ability to perform backpressure on Pin/Unpin requests. When more than MaxQueueSize pin/unpins are waiting to be included in a batch, the LogPin/LogUnpin operations will fail. If this happens, it is means cluster cannot commit batches as fast as pins are arriving. Thus, MaxQueueSize should be increase (to accomodate bursts), or the batch size increased (to perform less commits and hopefully handle the requests faster). Note that the underlying CRDT library will auto-commit when batch deltas reach 1MB of size.
This adds batching support to crdt-consensus per #1008 . The crdt component can now take advantage of the BatchingState, which uses the batching-crdt datastore. In batching mode, the crdt datastore groups any Add and Delete operations in a single delta (instead of just 1, as it does by default). Batching is enabled in the crdt configuration section by setting MaxBatchSize **and** MaxBatchAge. These two settings control when a batch is committed, either by reaching a maximum number of pin/unpin operations, or by reaching a maximum age. Batching unlocks large pin-ingestion scalability for clusters, but should be set according to expected work loads. An additional, hidden MaxQueueSize parameter provides the ability to perform backpressure on Pin/Unpin requests. When more than MaxQueueSize pin/unpins are waiting to be included in a batch, the LogPin/LogUnpin operations will fail. If this happens, it is means cluster cannot commit batches as fast as pins are arriving. Thus, MaxQueueSize should be increase (to accommodate bursts), or the batch size increased (to perform less commits and hopefully handle the requests faster). Note that the underlying CRDT library will auto-commit when batch deltas reach 1MB of size.
Describe the feature you are proposing
go-ds-crdt supports batching. Multiple updates can be included in the same DAG node. With batching, we do not need to issue one block per update.
Cluster with heavy pinning/unpinning intake can take advantage of batching to greatly reduce (I think around ~20000 pins can go in a batch) the DAG size.
Batching can be two ways:
Both approaches can be combined (whatever condition is hit first issues the batch). i.e. A batch should be issued every 100 updates, but in should be sent in any case if 10 minutes have passed from the previous batch.
Note that in-principle batch support is in-memory. Uncommitted batches will be lost.
Batching should be configurable in the
crdt
config section:0 values disable batching.
The text was updated successfully, but these errors were encountered: