Read/write batching
Fabric v3.1.0 introduced a new performance optimization that allows ledger reads and writes to be performed in batches. This feature is described in the Peer to Chaincode Communication Optimization RFC.
fabric-chaincode-go provides a reference implementation of this functionality, which should be replicated by the Java chaincode libraries.
Implementation is composed of these component parts:
- Configuration of batching based on peer capabilities when a connection is established
- Modifications to PutState (and PutPrivateData) API functions
- An accompanying WriteBatch implementation to collect batched writes.
- Modification of handleInit and handleTransaction to ensure that batched writes are sent at the end of a client invocation
- New Stub API functions:
I would like to give this a try.
@saedmanaf You are very welcome to tackle some or all of it. I would recommend aiming to deliver just a subset of the functionality as a first step pull request. It could be as simple as implementing the fallback behaviour of GetMultipleStates that just calls GetState internally. Then build on this in small steps with subsequent pull requests. If it makes it easier to track and mark off progress, we could break out these steps into sub-issues.
It will be really important to include accompanying unit tests with each piece of functionality to ensure the correct behaviour.