-
Notifications
You must be signed in to change notification settings - Fork 10
Add Coalescer manager to batch writes #2
Comments
the idea being that you'd feed data into a channel instead of calling bolt directly and something else would wake up every N milliseconds and write batches out to bolt? |
Yes exactly. It would be similar to what other databases do when they store := chainstore.New(
memstore.New(100*1024*1024),
coalescer.New(30 * time.Second,
boltstore.New("/tmp/store.db", "myBucket"),
)
) or.. store := chainstore.New(
memstore.New(100*1024*1024),
coalescer.New().Fsync(30 * time.Second).MaxObjects(100).WriteLog("/tmp/bolt.log").For(
boltstore.New("/tmp/store.db", "myBucket"),
)
) in fact, the coalescer should use the memstore internally if one hasn't been defined on the chain, since the idea is once the data is in the chain, it can be requested from the store, it just wouldn't have been "commited" to bolt until the fsync time / num of objects batched. .. I have more experience with Go since I originally wrote this project, so I think I can do even better on defining the chain to be more flexible and cleaner. Also, the coalescer would have to be able to work with any kind of store, ie. even batching s3 writes, which makes it a bit more difficult to define a general manager. |
might need a |
batched writes are way faster for some data stores, ie. for boltdb: https://gist.github.com/benbjohnson/59b57e3772bfb7a65fbf
The text was updated successfully, but these errors were encountered: