RabbitMQ and Redis Cluster with a KEEP network.
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.
- Create and start the blockchain application.
- Perform transactions on the blockchain network.
- View results and transaction blocks created in the blockchain network.
Issue a git clone https://github.com/IBM/Leveraging-cache-and-MessagingQueue-to-scale-BlockchainNetwork.
Issue the command build.sh to setup the network.
Three main steps:
- Run Build.sh Script to build and start the network
This accomplishes the following:
a) Clean up system by removing any existing blockchain docker images
b) Generate certificates
· The crypto-config.yaml (Crypto configuration file) defines the identity of “who is who”. It tells peers and orderers what organization they belown to and what domain they belong to.
c) Create Peers, Orderers and Channel
· The configtx.yaml file initializes a blockchain network or channel and services with an Orderer Genesis Block which serves as the first block on a chain. Additionally, membership services are installed on each channel peer (in this case, the Shop and Fitcoin Peers).
d) Build docker images of the orderer, peers, channel, network
Open a new terminal and run the following command
export FABRIC_CFG_PATH=$(pwd)chmod +x cryptogenchmod +x configtxgenchmod +x generate-certs.shchmod +x generate-cfgtx.shchmod +x docker-images.shchmod +x build.shchmod +x clean.sh./build.sh
Check the logs to see the results — run following commands
docker logs blockchain-setup
docker psdocker logs fitcoin_fitcoin-backend_1
docker logs fitcoin_shop-backend_1
Test the Blockchain Network
In a separate terminal navigate to testApplication folder and run the following command:
npm installnode index.js
Here you can see some screenshots of the system: