Re: Lag between initialization of call in Gateway and ContractRouter #fabric-chaincode #fabric-sdk-java #hyperledger-fabric

Marek Malik <info@...>

Hello Matthew,


This is exactly the behavior, there is a single request with payload that has for example 146 records. In my service I’m doing 146 'putState' calls to store data to CouchDb.
The 100Kb is the approximate size of the payload in the request when sending 146 records, so it should not be too much for the network.

The time increases with each payload being bigger.



Marek Malik



Od: Matthew White <WHITEMAT@...>
Data: piątek, 10 lipca 2020 17:30
Do: Marek Malik <info@...>
DW: "fabric@..." <fabric@...>
Temat: Re: [Hyperledger Fabric] Lag between initialization of call in Gateway and ContractRouter #fabric-chaincode #fabric-sdk-java #hyperledger-fabric


Hello Marek;


Just to check I understand your situation.


You're submitting a single transaction, that in effect, does a number of 'putState' calls. When that number gets to the ~140 the end-end time has increased.

When you say the payload is 100k, is that of the original transaction, or the data being stored in the states. 


How many orgs? 

What's the endorsement policy? 



Regards, Matthew.

Matthew B White  IBM Blockchain Solutions Architect


Email me at WHITEMAT@...

Find me on StackOverflow, and generally at


Note: restricted availability for meetings 14:30 to 17:00 UK Tuesday 

IBM United Kingdom Limited, Hursley Park, Winchester, Hampshire, SO21 2JN

"The wrong answers are the ones you go looking for when the right answers stare you in the face"



----- Original message -----
From: "Marek Malik" <info@...>
Sent by: fabric@...
To: fabric@...
Subject: [EXTERNAL] [Hyperledger Fabric] Lag between initialization of call in Gateway and ContractRouter #fabric-chaincode #fabric-sdk-java #hyperledger-fabric
Date: Fri, Jul 10, 2020 11:11 AM
Hello Guys, 
I have a problem with executing my chaincode when sending not that big payload (around 100Kb). 
There is a big, incremental time lag when waiting for the proposal response back to the gateway. 
The chaincode is very simple, I'm uploading records that are transformed on the chaincode and then stored in CouchDB.

I have played with the number of records that would be stored per request: 


  • 1 record took 2-3 sec.
  • 24 records took 9sec,
  • 88 records took 60 sec,
  • 146 records took 2.40-3 minutes.

I have set the BatchTimeout and MaxMessageCount to (10s and 500 records) but the times are not getting any better.
One thing that I noticed is when processing around 146 records the entire process in my chain code is finished in around 1.5 seconds (I’m logging the duration of the process on the finish). Also, when investigating log times I noticed that the process on the blockchain actually starts very late (logs from ContractRouter), more than 2 minutes after a proposal has been sent from the gateway. 

I'm checking the logs if there are any records that would point that the ordered or peer received the request but I don't see anything before the ContractRouter, but I'm still not that experienced in all the core libs, maybe one would be able to help here?

Does anyone have any ideas why the request would be taking that long?

I'm using java for both the gateway (2.1.4 version) and in the chaincode (2.2.0). I'm running it in a docker-compose network. 




Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Join to automatically receive all group messages.