Transform database bottleneck in software into the CPU problem

We have an application with Microservice architecture. In normal situations the application transfers 10k requests per second. We have a problem with contract tables. We cache all contracts in the Redis but had an IO bottleneck. In this article, I want to discuss different methods for changing the IO bottleneck into the CPU problem. It means using the decrypt and encrypt method to solve this problem.

In this project, we have important contracts for each business. every user based on the client business, enrolls in our system and fills the base on the contract.

Our backend part, we have six different microservices. that has its own database. and we pass contract uuid to all of these microservice and get value of contract from one microservice.

In our back-end part, we have six different microservices. That has its own database. And we pass the contract uuid to all of these microservices and get the value of the contract from one contract microservice.

Transform database bottleneck in software into the CPU problem

Suppose that we have 10k requests per second and all six microservices get data from the contract table. Now we have 60K requests per second on the contract table.

text
10K * 6 = 60K (TPS)

In normal situations, Redis can handle 10K TPS easily. DevOps can increase this value to 60K with an increased number of Redis instances.

Get once and send data into other Microservices

In the first Method, I can get data from the service one and send contract data with GRPC to other microservices. Now the contract table is not a bottleneck at all. But If the contract table changes, I have to change data in many GRPC flows. And if the employer needs to change the contract several times, it will be thoughtful.

Transform database bottleneck in software into the CPU problem

Encrypted contract information

In this method, I encrypt the data of the business contract and give it to the user. A user sent us encrypted data of business. All six microservices decrypted the data and used them. So we don’t have any pressure on the contract table. Decrypted data needs CPU usage. It means that we transform the IO bottleneck into a CPU problem.

Transform database bottleneck in software into the CPU problem

Add hash key for contract data in front end and use decode and encode contract

In this method, first, make a hash code for hashcode information and then just encode and decode the contract information in our system.

Contract Information encodes data into one single field.

Special thanks to Majid.Mohsenifa and Mohsen Mottaghi

Subscribe to DDIntel Here.

DDIntel captures the more notable pieces from our main site and our popular DDI Medium publication. Check us out for more insightful work from our community.

Register on AItoolverse (alpha) to get 50 DDINs

Support DDI AI Art Series: https://heartq.net/collections/ddi-ai-art-series

Join our network here: https://datadriveninvestor.com/collaborate

Follow us on LinkedIn, Twitter, YouTube, and Facebook.