How to Configure Nginx to Handle 100,000 Requests per Minute

This article provides a step‑by‑step guide to configuring Nginx for high‑traffic scenarios, covering increasing worker processes, adjusting worker connections, enabling keep‑alive, optimizing caching, and setting up load balancing, along with discussion of common performance bottlenecks and tuning recommendations to achieve up to 100,000 requests per minute.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
How to Configure Nginx to Handle 100,000 Requests per Minute

Step 1: Increase Worker Processes

Worker processes handle incoming requests; adding more increases the server's capacity. Add the following line to nginx.conf : worker_processes 8; This creates eight worker processes.

Step 2: Adjust Worker Connections

The worker_connections directive sets the maximum number of simultaneous connections each worker can handle. Add the following line to nginx.conf : worker_connections 1024; This sets the limit to 1,024 connections per worker.

Step 3: Configure Keep‑Alive Connections

Keep‑alive allows multiple requests over a single TCP connection, reducing connection overhead. Add these lines to nginx.conf :

keepalive_timeout 65;
keepalive_requests 100000;

The timeout is set to 65 seconds and up to 100,000 requests can be sent over the same connection.

Step 4: Optimize Caching

Caching serves frequently requested content from disk instead of generating it each time, lowering server load. Add the following directives to nginx.conf :

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m inactive=60m;
proxy_cache_key "$scheme$request_method$host$request_uri";
proxy_cache_valid 200 60m;

This creates a cache directory, defines the cache key, and caches successful (200) responses for 60 minutes.

Step 5: Configure Load Balancing

Load balancing distributes incoming traffic across multiple backend servers. Add the following to nginx.conf :

upstream backend {
server backend1.xxx.com;
server backend2.xxx.com;
}
server {
listen 80;
location / {
proxy_pass http://backend;
}
}

This defines an upstream group and proxies requests to it.

Common Performance Bottlenecks

CPU : Nginx is CPU‑bound; insufficient CPU limits throughput.

Memory : Each connection consumes memory; high connection counts can exhaust RAM.

Disk I/O : Slow disk subsystems affect static file serving and logging.

Network I/O : Bandwidth or interface limits can throttle traffic.

Upstream Servers : Backend application or database servers that cannot keep up become bottlenecks.

Application Code : Inefficient code (e.g., slow DB queries) reduces overall performance.

Identifying and addressing these bottlenecks—through hardware upgrades, configuration tuning, OS adjustments, application optimization, or horizontal scaling—is essential to reach the target of 100,000 requests per minute.

Conclusion

Nginx is a powerful web server capable of handling massive traffic when properly tuned. By increasing worker processes, adjusting connections, enabling keep‑alive, optimizing cache, and configuring load balancing, you can configure Nginx to process up to 100,000 requests per minute, though continual monitoring and adjustment are required to maintain optimal performance.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

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.