hyperledger/caliper-benchmarks

Go fixed asset implementation doesn't work with the rich query or range query workloads

davidkel opened this issue · 8 comments

Similar to Java for the contract api implementation you get the error

 Failed to perform query transaction [paginatedRichQuery] using arguments [{"selector":{"docType":"fixed-asset","creator":"client_nomatch","byteSize":1000}},2],  with error: Error: Incorrect number of params. Expected 3, received 2

Need to see what happens with fixed-asset-base where the contract-api doesn't check the parameters.

with fixed asset base I also run into problems.
I am able to submit trasaction but they are then all flagged as unfinished. finally, I then get

Failed to perform query transaction [paginatedRichQuery] using arguments [{"selector":{"docType":"fixed-asset","creator":"client3"}},10,],  with error: GatewayError: 4 DEADLINE_EXCEEDED: evaluate timeout expired

with fixed asset 2/3 of the transaction are actually successfull but one third failed with the same error afrer being labeled ass unfinished :
GatewayError: 4 DEADLINE_EXCEEDED: evaluate timeout expired with the fabric-gateway sdk and
Error performing GetQueryResultWithPagination: GET_QUERY_RESULT failed with the legacy node sdk
Screenshot 2022-07-06 at 12 03 34

Chaincode logs:

Error performing GetQueryResultWithPagination: GET_QUERY_RESULT failed: transaction ID: 787fd0119dd093643f805cdfe68c8d8e4bff3e244a33a9824984651aa92dd83c: http error calling couchdb: Post "http://couchdb0:5984/mychannel_fixed-asset/_find": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

More espicative error messages using the legacy node sdk:

2022.07.06-10:36:35.792 error [caliper] [connectors/v2/FabricGateway]   Failed to perform query transaction [paginatedRichQuery] using arguments [{"selector":{"docType":"fixed-asset","creator":"client3"}},200,],  with error: FabricError: Query failed. Errors: ["Error: REQUEST TIMEOUT"]
2022-07-06T09:36:36.596Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 60000
2022-07-06T09:36:36.596Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 60000
2022-07-06T09:36:36.596Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
2022-07-06T09:36:36.596Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
2022-07-06T09:36:36.596Z - error: [RoundRobinQueryHandler]: evaluate: message=Query failed. Errors: ["Error: REQUEST TIMEOUT"], stack=FabricError: Query failed. Errors: ["Error: REQUEST TIMEOUT"]

sometimes even the creation of the assets fails:

with error: TimeoutError: Event strategy not satisfied within the timeout period. No response received from peers: peer0.org1.example.com:7051` 
or even before when setting up the enviroment 
error: [Discoverer]: sendDiscovery[peer0.org1.example.com] - timed out after:3000
2022.07.06-11:40:25.575 warn  [caliper] [connectors/v2/FabricGateway]   Couldn't initialize mychannel for User1. User1 not available for use on this channel. Error: REQUEST TIMEOUT
 error [caliper] [worker-message-handler]        Error while handling "prepare" message for Worker#1 (47840): Error: REQUEST TIMEOUT
2022.07.06-11:44:41.693 info  [caliper] [connectors/v2/FabricGateway]   Connecting user with identity User1 to a Network Gateway
/Users/vlaca/Documents/work/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/orchestrators/worker-orchestrator.js:308
                this.workers[workerId].phases[phase].resolve();
                                                     ^

TypeError: this.workers[workerId].phases[phase].resolve is not a function

just run the node fixed asset chaincode as well and it actually give same error that you reported by dkelsey for the java one:

Failed to perform query transaction [paginatedRichQuery] using arguments [{"selector":{"docType":"fixed-asset","creator":"client1"}},10,],  with error: Error: error in simulation: transaction returned with failure: Error: Expected 2 parameters, but 3 have been supplied

The node chaincode uses default parameters while the go one doesn't

In the benchmark we do provide only the required parameters(2 out of 3 for rich query and 3 out of 4 for range query), which works for the node chaincode that has the last parameter as an optional default one while it does not work for the go one.

However, if you try to actually set the third parameter (forth for range query) the go one works fine but the node one doesn't
as far as I understood chaincode functions have a fixed signature with no optional parameters. This is an arbitrary choice since GRPC supports optional parameters by setting them to a default value if missing. I don't really see it documented anywhere but by browsing different issues I could find the answer...

I'll go ahead removing the optional parameter from the node chaincode and provide all of the arguments in the benchmark call.

I'll go ahead removing the optional parameter from the node chaincode and provide all of the arguments in the benchmark call

By reducing the number of assets created everything works fine. however, if we keep the current setting, creating 8000 assets for each worker and size, then around a third of query timeout.
By looking at the couch db logs we see that they eventually finish but after more than 20 seconds
Screenshot 2022-07-07 at 10 52 57
The question then becomes, is the problem around the couch db query? Increasing the number of assets it takes exponentially longer for more and more queries to complete.
The queries do eventually complete ok. After debugging the chaincode we do not see any problem during the creation of the asset, then the problems seams related to couchdb. We are not increasing the tps at all but just the number of the asset stored in the db, might that be the problem?