caliper icon indicating copy to clipboard operation
caliper copied to clipboard

Running hyperledger caliper to test my local hyperledger fabric network

Open Mohammed-alzuharey opened this issue 3 years ago • 2 comments

Which Caliper version are you using?

v0.4.2

Which Node.JS version are you using?

v12

Which operating system are you using?

Ubuntu 18.04

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

Im using hyperledger caliper to benchmark my local fabric network but i have some errors which lead to missing some values from report such as successful transactions and latency

What was the observed incorrect behavior?

2022-04-20T07:42:51.316Z - error: [RoundRobinQueryHandler]: evaluate: message=Query failed. Errors: [], stack=FabricError: Query failed. Errors: [] at RoundRobinQueryHandler.evaluate (/home/toor/caliper-workspace/node_modules/fabric-network/lib/impl/query/roundrobinqueryhandler.js:66:23) at Transaction.evaluate (/home/toor/caliper-workspace/node_modules/fabric-network/lib/transaction.js:319:49)

2022.04.20-10:42:51.318 error [caliper] [connectors/v2/FabricGateway] Failed to perform query transaction [ReadAsset] using arguments [0_8], with error: FabricError: Query failed. Errors: [] at RoundRobinQueryHandler.evaluate (/home/toor/caliper-workspace/node_modules/fabric-network/lib/impl/query/roundrobinqueryhandler.js:66:23)

2022-04-20T07:42:57.401Z - error: [Transaction]: Error: No valid responses from any peers. Errors: at newEndorsementError (/home/toor/caliper-workspace/node_modules/fabric-network/lib/transaction.js:74:12) at getResponsePayload (/home/toor/caliper-workspace/node_modules/fabric-network/lib/transaction.js:41:23) at Transaction.submit (/home/toor/caliper-workspace/node_modules/fabric-network/lib/transaction.js:255:28) at async V2FabricGateway._submitOrEvaluateTransaction (/home/toor/caliper-workspace/node_modules/@hyperledger/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:376:26)

2022.04.20-10:42:57.509 error [caliper] [connectors/v2/FabricGateway] Failed to perform submit transaction [DeleteAsset] using arguments [1_2], with error: Error: No valid responses from any peers.

Please provide the error logs and their surroundings.

2022.04.20-10:43:02.994[90m debug[39m [caliper] [worker-message-handler] 	Handled "exit" message for Worker#1 (7833)

Please provide your benchmark configuration file content, if possible.

test:
    name: basic-contract-benchmark
    description: test benchmark
    workers:
      type: local
      number: 2
    rounds:
      - label: readAsset
        description: Read asset benchmark
        txDuration: 30
        rateControl:
          type: fixed-load
          opts:
            transactionLoad: 2
        workload:
          module: workload/readAsset.js
          arguments:
            assets: 10
            contractId: basic

Please provide your network configuration file content, if possible.

name: Calier test
version: "2.0.0"

caliper:
  blockchain: fabric
  sutOptions:
    mutualTls: false

channels:
  - channelName: mychannel
    contracts:
    - id: basic

organizations:
  - mspid: Org1MSP
    identities:
      certificates:
      - name: 'User1'
        clientPrivateKey:
          path: '/home/toor/EHRUsingBlockchain-master/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457_sk'
        clientSignedCert:
          path: '/home/toor/EHRUsingBlockchain-master/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem'

    connectionProfile:
      path: '/home/toor/EHRUsingBlockchain-master/DevServer_connection.json'
      discover: false

Please provide your workload module content, if possible.

'use strict';

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

class MyWorkload extends WorkloadModuleBase {
    constructor() {
        super();
    }

    async initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext) {
        await super.initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext);

        for (let i=0; i<this.roundArguments.assets; i++) {
            const assetID = `${this.workerIndex}_${i}`;
            console.log(`Worker ${this.workerIndex}: Creating asset ${assetID}`);
            const request = {
                contractId: this.roundArguments.contractId,
                contractFunction: 'CreateAsset',
                invokerIdentity: 'User1',
                contractArguments: [assetID,'blue','20','penguin','500'],
                readOnly: false
            };

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

    async submitTransaction() {
        const randomId = Math.floor(Math.random()*this.roundArguments.assets);
        const myArgs = {
            contractId: this.roundArguments.contractId,
            contractFunction: 'ReadAsset',
            invokerIdentity: 'User1',
            contractArguments: [`${this.workerIndex}_${randomId}`],
            readOnly: true
        };

        await this.sutAdapter.sendRequests(myArgs);
    }

    async cleanupWorkloadModule() {
        for (let i=0; i<this.roundArguments.assets; i++) {
            const assetID = `${this.workerIndex}_${i}`;
            console.log(`Worker ${this.workerIndex}: Deleting asset ${assetID}`);
            const request = {
                contractId: this.roundArguments.contractId,
                contractFunction: 'DeleteAsset',
                invokerIdentity: 'User1',
                contractArguments: [assetID],
                readOnly: false
            };

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

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

module.exports.createWorkloadModule = createWorkloadModule;

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

missing some values from report such as successful transaction and latency such as next table

+-----------+------+------+-----------------+-----------------+------------------+-----------------+------------------+
| Name | Succ | Fail | Send Rate (TPS) | Max Latency (s) | Min Latency (s) | Avg Latency (s) | Throughput (TPS) |
|-----------|------|------|-----------------|-----------------|------------------|-----------------|------------------|
| readAsset | 0 | 1693 | 57.2 | 0.00 | 9007199254740.99 | - | 57.2 |
+-----------+------+------+-----------------+-----------------+------------------+-----------------+------------------+

Mohammed-alzuharey avatar Apr 20 '22 08:04 Mohammed-alzuharey

This is duplicated here https://stackoverflow.com/questions/71936538/running-hyperledger-caliper-to-test-my-local-hyperledger-fabric-network/71937097#71937097 @Mohammed-alzuharey I've answered this in stackoverflow

davidkel avatar Apr 20 '22 09:04 davidkel