Load testing the Blockchain Network
This pattern is continuation of the Leveraging cache and MessagingQueue to scale Blockchain Network . In this pattern, we are going run java programs to load test our blockchain network i.e. to send request to blockchain network and to check for results of request execution. MongoDb is used to keep track of statistics for the load testing.
- Hyperledger Fabric
- Hyperledger Fabric SDK for node.js
Application Workflow Diagram
- Run the ExecutionApp and ResultGenerator java program in separate terminals
- View the execution results in mongodb
- Set-up the blockchain network.
- You can either install mongodb on your system or run the container for mongodb using the following command.
docker run -p 27017:27017 -d mongo
- Issue a
git clone https://github.com/IBM/loadtesting-the-Blockchain-Network.git
- Verify the executionURL, resultURL urls from ExecutionApp.java and ResultGenerator.java.
- Make sure your are connecting to correct mongodb instance and dbName are same in ExecutionApp.java and ResultGenerator.java.
- Open terminal and run the following commands to setup the project
- Now run the test result loader Application
mvn exec:java -Dexec.mainClass="secretApp.testApp.ResultGenerator"
- In a new terminal,run the execution cli app
mvn exec:java -Dexec.mainClass="secretApp.testApp.ExecutionApp"
- If required, you can scale the number of task execution containers by navigating back to the network directory and running the following command:
docker-compose -p "fitcoin" up -d --scale fitcoin-backend=<No of containers>
docker-compose -p "fitcoin" up -d --scale fitcoin-backend=3
Note: To view the results you can download robomongo/ Robo 3T. Currently, ExecutionApp is configured to send enroll request for user types, query request for user state and invoke request for generating fitcoins which can be modified according to the requirements.