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

@systemdesignone
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:
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.
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.
4
👋 PS - I wrote an article with visuals of this case study in my newsletter:

→ 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
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement