NOTE

Service Scaling

A historical note on estimating CPU cores for capacity expansion from PCU and QPS.

System DesignCreated Updated 1 min readhistorical

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

  1. Create and execute a test plan.
  2. Use the top command to check whether load is stable at 60%.
  3. Calculate TPS per core.
    • Suppose TPS is 600 and the machine has 2 cores; then TPS per core = 600 / 2 = 300.

2.2. Calculate the Number of Cores Needed per 10,000 PCU

  1. 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.
  2. Calculate the cores required for that QPS.
    1. If every 10,000 PCU produces 100 QPS and each core can handle 300 QPS, then every 10,000 PCU needs 100 / 300 = 0.34 cores.

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