NOTE
Service Scaling
A historical note on estimating CPU cores for capacity expansion from PCU and QPS.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is It?
- PCU means the number of concurrent online users and is different from QPS.
- For example, 10,000 concurrent online users enter gradually, so QPS cannot be 10,000.
- QPS: concurrency per second.
2. Steps
2.1. Calculate QPS per Core
- Create and execute a test plan.
- Use the
topcommand to check whether load is stable at 60%. - Calculate TPS per core.
- Suppose TPS is 600 and the machine has 2 cores; then TPS per core =
600 / 2 = 300.
- Suppose TPS is 600 and the machine has 2 cores; then TPS per core =
2.2. Calculate the Number of Cores Needed per 10,000 PCU
- Derive from experience how much QPS every 10,000 PCU produces.
- For example, in a content-browsing service, users refresh the content list intermittently while online. Based on historical monitoring, assume every 10,000 PCU produces about 100 QPS.
- Calculate the cores required for that QPS.
- If every 10,000 PCU produces 100 QPS and each core can handle 300 QPS, then every 10,000 PCU needs
100 / 300 = 0.34cores.
- If every 10,000 PCU produces 100 QPS and each core can handle 300 QPS, then every 10,000 PCU needs
2.3. Calculate the Additional Cores for Expansion
- For an additional 900,000 PCU:
0.34 * 90 = 31.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub