Operations 7 min read

Understanding QPS, TPS, RT, Concurrency, Throughput and Optimal Thread Count

The article explains the core performance metrics QPS, TPS, response time (RT), concurrency, and throughput, provides formulas to relate them, demonstrates practical calculations for capacity planning, and discusses how to determine the optimal number of threads for a backend system.

Top Architect
Top Architect
Top Architect
Understanding QPS, TPS, RT, Concurrency, Throughput and Optimal Thread Count

Hello, I am a senior architect.

1. QPS (Queries Per Second)

QPS measures how many queries a server can handle per second and is commonly used to evaluate the performance of DNS servers and other query‑driven services.

2. TPS (Transactions Per Second)

TPS stands for TransactionsPerSecond , representing the number of completed transactions per second; a transaction is a request from a client to a server and the corresponding response.

QPS vs TPS: a page visit generates one TPS, but may involve multiple server queries, each counted toward QPS.

3. RT (Response Time)

RT is the total time from when a client sends a request until it receives the response; it is a key indicator of system speed.

4. Concurrency

Concurrency indicates how many requests the system can handle simultaneously, reflecting its load capacity.

5. Throughput

Throughput (system capacity) is tightly linked to CPU consumption per request, external interfaces, I/O, etc. Important parameters include QPS/TPS, concurrency, and response time.

QPS (TPS) : number of requests/transactions per second.

Concurrency : number of simultaneous requests/transactions.

Response Time : usually the average response time.

Understanding these three elements allows you to derive their relationships:

QPS (TPS) = Concurrency / AverageResponseTime

Concurrency = QPS * AverageResponseTime

6. Practical Example

Assuming 80% of daily traffic occurs in 20% of the time (peak period), the peak QPS can be calculated as:

(TotalPV * 0.8) / (SecondsPerDay * 0.2) = PeakQPS

To determine the number of machines needed:

PeakQPS / QPS_per_machine = RequiredMachines

Example: 3,000,000 PV per day → Peak QPS ≈ 139. If a single machine supports 58 QPS, you need 3 machines.

7. Optimal Thread Count, QPS and RT

1. Single‑thread QPS formula

QPS = 1000ms / RT

For RT = 80 ms, QPS ≈ 12.5. With two threads, QPS doubles to 25, showing linear growth in ideal conditions.

2. Real relationship between QPS and RT

Illustrations (images) show the theoretical and actual QPS‑RT curves.

3. Optimal thread number

The optimal thread count fully utilizes the bottleneck resource:

OptimalThreads = ((ThreadWaitTime + ThreadCPUTime) / ThreadCPUTime) * CPUCount

Characteristics:

If threads exceed the optimal number, QPS stays constant while response time increases; further increase eventually reduces QPS.

Each system has its own optimal thread count, which may vary under different conditions.

Bottleneck resources can be CPU, memory, locks, or I/O; exceeding the optimal thread count leads to resource contention and longer response times.

Images and promotional links are omitted for brevity.

backendperformanceconcurrencythroughputthreadingQPSTPS
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.