Collect items into batches for optimal write operations to leveldb