For every 10K requests per second, how many CPUs, RAM, and EC2 instances are used?
2 min readJan 11, 2024
Assuming we build a website with a system load capacity of up to 10,000 RPS, the system is deployed on AWS. Calculate the CPU and Memory required for a virtual machine (EC2), and the relative number of EC2.
Note: the article is for reference.
CPU Calculation
We have a relative formula for the CPU:
RPS = Number of CPU * (1 / 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 8ms to process:
Number of CPU = 10000 * 0.008 = 80
Memory Calculation
We have a relative formula for Memory:
RPS = (Total RAM / Task memory usage) * (1 / Task duration)
=> Total RAM = RPS * Task duration * Task memory usage
Assume a request takes 8ms to process and use 4GB:
Total RAM = 10000 * 0.008 * 4 = 320GB