Member-only story
Maximum RPS: Ideal CPU, RAM, and EC2 Setup ?
Let’s determine the necessary CPU and Memory specifications for an EC2 instance on AWS to handle a system load of up to 10,000 requests per second (RPS), as well as the number of EC2 instances required.
CPU Calculation
- To estimate CPU requirements.
Requests per second (RPS) can be calculated as the product of the number of CPUs and the reciprocal of the task duration.
Number of CPU = RPS / (1 / Task duration) = RPS * Task duration
- RPS: Requests per second
- Number of cores
- Task duration
From the formula above we get:
Number of CPU = RPS / (1 / Task duration) = RPS * Task duration
Assume a request takes 5ms to process:
Number of CPU = 10000 * 0.005 = 50
Memory Calculation
- Relative formula for Memory.
RPS = (Total RAM / Task memory usage) * (1 / Task duration)
=> Total RAM = RPS * Task duration * Task memory usage
Lets assume a request takes 8ms to process and use 4GB
Total RAM = 10000 * 0.005 * 4 = 200GB
Conclusion
The article is for reference purposes only to provide the order of the articles and the calculation of the assumptions