Backend Development 7 min read

Comprehensive Strategies for Designing High‑Concurrency Systems

The article outlines five key layers—front‑end optimization, middle‑layer load distribution, gateway control, service‑layer improvements, and database tuning—detailing practical techniques such as static resource caching, Nginx load‑balancing methods, request rate limiting, message‑queue buffering, and extensive MySQL best‑practice guidelines to build robust high‑concurrency architectures.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Comprehensive Strategies for Designing High‑Concurrency Systems

This interview question covers many knowledge points, mainly testing the candidate's comprehensive technical ability. High‑concurrency system design methods are numerous and are mainly reflected in five aspects.

1. Front‑end Layer Optimization

① Static Resource Caching: Staticize all elements that can be static on the activity page, minimize dynamic elements, and use CDN and browser cache to reduce client‑to‑server data requests.

② Prohibit Duplicate Submissions: After the user submits, disable the button to prevent repeated submissions.

③ User Rate Limiting: Allow each user to submit only once within a certain time window, e.g., IP‑based limiting.

2. Middle‑Layer Load Distribution

Use a load balancer such as Nginx to distribute concurrent requests across multiple servers, enhancing the system's ability to handle concurrency.

Nginx load‑distribution offers five methods:

① Round‑Robin (default): Requests are assigned to backend servers sequentially; faulty servers are automatically removed.

② Weight: Use the weight parameter to set the probability of selection proportionally to server capacity.

upstream backend {
    server 192.168.0.14 weight=10;
    server 192.168.0.15 weight=10;
}

③ IP Hash (ip_hash): Assign requests based on the hash of the client IP, ensuring a visitor consistently reaches the same backend server, which helps with session sharing.

upstream backend {
    ip_hash;
    server 192.168.0.14:88;
    server 192.168.0.15:80;
}

④ Fair (response time): Distribute requests according to backend response time, preferring faster servers.

upstream backend {
    fair;
    server server1.com;
    server server2.com;
}

⑤ URL Hash (url_hash): Distribute requests based on the hash of the request URI, similar to IP hash.

upstream backend {
    hash $request_uri;
    server server1.com;
    server server2.com;
}

3. Control Layer (Gateway) Optimization

Limit the access frequency and request count of the same user to prevent malicious repeated requests.

4. Service Layer Optimization

① Business Server Separation: Separate flash‑sale services from other business logic and run them on high‑spec servers to concentrate resources for high‑pressure traffic.

② Use Message Queues (MQ): Buffer requests with a queue; consumers process them later, smoothing traffic spikes.

③ Cache Read Requests: Employ caches such as Redis to offload a large portion of read pressure from the database.

5. Database Layer Optimization

Key practices include proper engine selection, appropriate transaction isolation levels, and correct index usage.

Prefer primary‑key queries over other indexes to avoid back‑table lookups.

Avoid column calculations; perform them in business services.

Keep SQL statements simple; split large statements, reduce lock time.

Never use SELECT * ; select only needed columns.

Rewrite OR conditions as IN where possible.

Avoid functions and triggers in critical paths.

Do not use LIKE '%xx' patterns.

Minimize join operations.

Compare values of the same type (e.g., string with string).

Avoid != or <> in WHERE clauses as they bypass indexes.

Implement pagination with reasonable page sizes.

Use EXISTS instead of IN for sub‑queries.

Do not apply IS NULL or IS NOT NULL on indexed columns.

Prefer numeric fields over character fields for numeric data.

Avoid expressions on indexed columns in WHERE clauses.

Additional recommendations: reasonable sharding, use database middleware for read/write splitting, and configure master‑slave read/write separation.

load balancingsystem designHigh Concurrencybackend optimizationDatabase Tuning
Full-Stack Internet Architecture
Written by

Full-Stack Internet Architecture

Introducing full-stack Internet architecture technologies centered on Java

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.