Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm trying to test the performance of my own fabric network build with caliper, but I'm running into some trouble. #1492

Closed
michaeljimson opened this issue Mar 13, 2023 · 3 comments

Comments

@michaeljimson
Copy link

Which Caliper version are you using?

V0.4.2

Which Node.JS version are you using?

v16.15.0

Which operating system are you using?

Ubuntu 20.04 LTS

Please provide some context for your error. For example, when did the error occur? What were you trying to achieve, and how?

I want to use caliper to test the performance of the fabric network I built, but I'm having some trouble. When testing the creation of transactions with caliper, some errors are often reported randomly.

What was the observed incorrect behavior?

SET function always has unsuccess
caliper.log

Please provide the error logs and their surroundings.

2023.03.13-23:01:09.037�[31m error�[39m [caliper] [connectors/v2/fabric-gateway] 	Failed to perform submit transaction [CreateRequest] using arguments [The 2 Message_13,444444444444,152601199604262615,123123123126,123123123135,152602200211117775],  with error: Error: No valid responses from any peers. Errors:
    peer=undefined, status=grpc, message=Peer endorsements do not match
    at newEndorsementError (/home/jimson/go/hyperledger/eightNode/caliper-workspace/node_modules/fabric-network/lib/transaction.js:49:12)
    at getResponsePayload (/home/jimson/go/hyperledger/eightNode/caliper-workspace/node_modules/fabric-network/lib/transaction.js:17:23)
    at Transaction.submit (/home/jimson/go/hyperledger/eightNode/caliper-workspace/node_modules/fabric-network/lib/transaction.js:212:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async LegacyV2FabricGateway._performGatewayTransaction (/home/jimson/go/hyperledger/eightNode/caliper-workspace/node_modules/@hyperledger/caliper-fabric/lib/connector-versions/v2/fabric-gateway.js:489:26)
    at async LegacyV2FabricGateway.sendRequests (/home/jimson/go/hyperledger/eightNode/caliper-workspace/node_modules/@hyperledger/caliper-core/lib/common/core/connector-base.js:78:28)
    at async CreateMessageWorkload.submitTransaction (/home/jimson/go/hyperledger/eightNode/caliper-workspace/workload/create.js:36:9)

Please provide your benchmark configuration file content, if possible.

test:
  name: emr-contract-benchmark
  description: A test benchmark
  workers:
    type: local
    number: 5
  rounds:
    - label: createMessage
      description: Create Benchmark
      txNumber: 500
      rateControl: 
        type: fixed-load
        opts:
          transactionLoad: 5
      workload:
        module: workload/create.js
    - label: Query a message
      descroption: Query Benchmark
      txDuration: 30
      rateControl:
        type: fixed-load
        opts:
          transactionLoad: 5
      workload:
        module: workload/query.js
        arguments: 
          assets: 500
    - label: Update a message
      description: Update Benchmark
      txDuration: 30
      rateControl:
        type: fixed-load
        opts:
          transactionLoad: 5
      workload: 
        module: workload/update.js
        arguments:
          assets: 500
    - label: Delete all message
      descroption: Delete Benchmark
      txNumber: 500
      rateControl:
        type: fixed-load
        opts:
          transactionLoad: 5
      workload:
        module: workload/delete.js

monitors: 
  resource:
  - module: docker
    options:
      interval: 0.1
      containers:
      - all

Please provide your network configuration file content, if possible.

{
    "version" : "1.0",
    "name": "Caliper test",
    "caliper" : {
        "blockchain": "fabric"
    },
    "clients": {
        "Admin@his1.jimson.com": {
            "client": {
                "credentialStore": {
                    "path": "/tmp/his1",
                    "cryptoStore": {
                        "path": "/tmp/his1"
                    }
                },
                "organization": "His1",
                "clientPrivateKey": {
                    "path": "../crypto-config/peerOrganizations/his1.jimson.com/users/Admin@his1.jimson.com/msp/keystore/priv_sk"
                },
                "clientSignedCert": {
                    "path": "../crypto-config/peerOrganizations/his1.jimson.com/users/Admin@his1.jimson.com/msp/signcerts/Admin@his1.jimson.com-cert.pem"
                },
                "connection": {
                    "timeout": {
                        "peer": {
                            "endorser": "300"
                        }
                    }
                }

            }
        }
    },
    "channels" : {
        "channel2": {
            "created": true,
            "contracts": [
                {
                    "id":"emr2subchain",
                    "version":"1.0"
                }
            ]
        }
    },
    "organizations" : {
        "His1": {
            "mspid": "His1MSP",
            "peers": [
                "peer0.his1.jimson.com"
            ]
        }
    },
    "peers" : {
        "peer0.his1.jimson.com": {
            "url": "grpcs://peer0.his1.jimson.com:7051",
            "tlsCACerts": {
                "path": "../crypto-config/peerOrganizations/his1.jimson.com/users/Admin@his1.jimson.com/msp/tlscacerts/tlsca.his1.jimson.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer0.his1.jimson.com",
                "hostnameOverride": "peer0.his1.jimson.com"
            }
        }
    }
}

Please provide your workload module content, if possible.

'use strict';

const { WorkloadModuleBase } = require('@hyperledger/caliper-core');

const emrID = ['000000000000', '111111111111', '222222222222', '333333333333', '444444444444', '555555555555', '666666666666', '777777777777', '888888888888', '999999999999']
const patientID = ['152601199604262610','152601199604262611','152601199604262612','152601199604262613','152601199604262614','152601199604262615','152601199604262616','152601199604262617','152601199604262618', '152601199604262619'] 
const hospitalAID = ['123123123120', '123123123121', '123123123122', '123123123123', '123123123124', '123123123125', '123123123126', '123123123127', '123123123128', '123123123129']
const hospitalBID = ['123123123130', '123123123131', '123123123132', '123123123133', '123123123134', '123123123135', '123123123136', '123123123137', '123123123138', '123123123139']
const doctorID= ['152602200211117770','152602200211117771','152602200211117772','152602200211117773','152602200211117774','152602200211117775','152602200211117776','152602200211117777', '152602200211117778', '152602200211117779']


class CreateMessageWorkload extends WorkloadModuleBase {

    constructor() {
        super();
        this.txIndex = 0;
    }

    async submitTransaction() {
        this.txIndex++;
        let ID = 'The '+ this.workerIndex + ' Message_' + this.txIndex.toString();
        let EmrID = emrID[Math.floor(Math.random() * emrID.length)];
        let PatientID = patientID[Math.floor(Math.random() * patientID.length)];
        let HospitalAID = hospitalAID[Math.floor(Math.random() * hospitalAID.length)];
        let HospitalBID = hospitalBID[Math.floor(Math.random() * hospitalBID.length)];
        let DoctorID = doctorID[Math.floor(Math.random() * doctorID.length)];

        let args = {
            contractId: 'emr2subchain',
            contractVersion: 'v1',
            contractFunction: 'CreateRequest',
            contractArguments: [ID, EmrID, PatientID, HospitalAID ,HospitalBID, DoctorID],
            timeout: 30
        };

        await this.sutAdapter.sendRequests(args);
    }
}

function createWorkloadModule() {
    return new CreateMessageWorkload();
}

module.exports.createWorkloadModule = createWorkloadModule;

Please provide any additional information you deem relevant to the error.

thanks a lot

@michaeljimson
Copy link
Author

I found problem. My chaincode using golang. I used a function to quire time like time.Now().Unix(),So the time-out make the Peer endorsements do not match. I use outside timestamp function in javascript to take place chaincode. It works.

@davidkel
Copy link
Contributor

Firstly, I would recommend not using caliper 0.4.2 and use caliper 0.5.0 instead.
Secondly, caliper is outputting the reason for the failures

Failed to perform submit transaction [CreateRequest] using arguments [The 2 Message_13,444444444444,152601199604262615,123123123126,123123123135,152602200211117775],  with error: Error: No valid responses from any peers. Errors:
    peer=undefined, status=grpc, message=Peer endorsements do not match

Your endorsements received from 2 or more peers don't match. That means your chaincode is non-deterministic and so you have a problem with your chaincode implementation. Please search google and refer to the hyperledger fabric documentation about chaincode and the fact it must be deterministic. Examples of a chaincode that isn't deterministic would be

  1. The chaincode generates a date object
  2. The chaincode generates a random number

So this isn't an issue with caliper or fabric but how your chaincode is implemented

@michaeljimson
Copy link
Author

Firstly, I would recommend not using caliper 0.4.2 and use caliper 0.5.0 instead. Secondly, caliper is outputting the reason for the failures

Failed to perform submit transaction [CreateRequest] using arguments [The 2 Message_13,444444444444,152601199604262615,123123123126,123123123135,152602200211117775],  with error: Error: No valid responses from any peers. Errors:
    peer=undefined, status=grpc, message=Peer endorsements do not match

Your endorsements received from 2 or more peers don't match. That means your chaincode is non-deterministic and so you have a problem with your chaincode implementation. Please search google and refer to the hyperledger fabric documentation about chaincode and the fact it must be deterministic. Examples of a chaincode that isn't deterministic would be

  1. The chaincode generates a date object
  2. The chaincode generates a random number

So this isn't an issue with caliper or fabric but how your chaincode is implemented

Thank you, Its my chaincode problem.not caliper. And again, thank you for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants