How Nginx was able to support 1 million concurrent connections on a...

Neo Kim@systemdesignone
22 views
Dec 05, 2024
~1 min read
Advertisement
1
How Nginx was able to support 1 million concurrent connections on a single server:
I spent hours studying about it, so you don't have to.
Here's what I learned:
I spent hours studying about it, so you don't have to.
Here's what I learned:
2
• They built Nginx with master-worker model.
• The master reads the configuration file & creates new workers.
• While worker handles client connections directly.
• They run the worker as a single-threaded process.
• The master reads the configuration file & creates new workers.
• While worker handles client connections directly.
• They run the worker as a single-threaded process.
3
• And assign a separate CPU to each worker.
• They handle requests using the event loop in the worker.
• They delegate blocking tasks from the worker to the thread pool.
• They set up shared memory for sharing cache data among workers and rate limit requests.
• They handle requests using the event loop in the worker.
• They delegate blocking tasks from the worker to the thread pool.
• They set up shared memory for sharing cache data among workers and rate limit requests.
4
👋 PS - I wrote an article with visuals of this case study in my newsletter:
→ newsletter.systemdesign.one/p/how-does-ngi…
→ newsletter.systemdesign.one/p/how-does-ngi…
5
If you liked this thread:
🔔 Follow @systemdesign42
♻ Repost the tweet below to help others find it
💾 Bookmark it for future reference
🔔 Follow @systemdesign42
♻ Repost the tweet below to help others find it
💾 Bookmark it for future reference