You’ve made it to the fourth in a series of IBM Code patterns that teach you how to get started creating a blockchain application with Hyperledger Fabric Node SDK. Now that you know how to create the network and define network operations, you’re ready to learn how to integrate RabbitMQ and Redis Cluster to scale your blockchain application. Let’s get started with optimizing our blockchain application to handle a large number of requests.
All good developers know scaling is critical to the application development process. Scalability is a measure of efficiency as a given load increases in size. It is something that should be considered from the start of the design and development process and not an afterthought. You don’t want to set limitations on your applications. Additionally, you need to consider that data may be processed in parallel and federated across multiple sources. In this developer pattern, we will configure Redis and Rabbit to scale and regulate the data processing that occurs between the IoS application front-end application and the blockchain back end. With the direct use of REST API calls, it is not possible to control the number of requests sent to a blockchain network because it might cause read/write conflicts, etc. To control the flow of requests sent to the blockchain network and scale our application, we will do two things:
- Use RabbitMQ cluster with the nodes consisting of mirrored queues to order the user requests.
- Use Redis Cluster with six nodes (three primary and three secondary), where the results are temporarily stored.
In the architecture diagram, we have the RabbitMQ producer present in API containers that queue the requests to the RabbitMQ cluster. The RabbitMQ consumer is configured with an instance of Hyperledger Fabric Node SDK in task execution containers to consume the requests from users and send to the blockchain network for execution.
- Create and start the blockchain application.
- Perform transactions on the blockchain network.
- View results and transaction blocks created in the blockchain network.
Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.