Nginx – Another HTTP Server

                         nginx

                              In this article let us discuss the Nginx(pronounced as engine-x) web server. From late 95’s Apache is the prominent web server in the web industry and most of the websites are using till today. We will see that is the bottleneck with Apache on heavy load with high concurrency. The latest Apache uses either a prefork method or worker multi-process mode (MPM). In both the cases when the client sends request the Apache will create additional processes/threads to process the request. When a process or thread gets spawned, there is a load on the hardware where it utilizes the CPU and RAM. During the heavier loads, the availability of the resources will get drained and hence Apache won’t accept any new requests/the processing of requests will get slows down.

                              Nginx says it addresses the C10K problem which is highlighted in the paper. Unlike other web servers, Nginx doesn’t use more processes and threads to handle the requests. Nginx adopted the “event-driven and asynchronous” architecture. Nginx won’t create new processes for each web request, instead, it will create worker processes for the main Nginx process. Each of these processes is single-threaded. Each worker can handle thousands of concurrent connections. It does this asynchronously with one thread, rather than using multi-threaded programming. The below simple diagram depicts the way Nginx processes the client requests with minimal usage of system resources.

Nginx

                                    Nginx addresses the high scalability and high concurrency problem hence most of the high traffic sites are using. For example  Netflix, Hulu, Pinterest, Airbnb, WordPress.com, GitHub, SoundCloud, Zynga, Eventbrite, Zappos, etc.

In the coming articles will see how we can configure Nginx as the load balancer. Until then, Happy Learning !!!

Advertisement

Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub(https://github.com/2013techsmarts) where he put the source code of his work related to his blog posts.

Tagged with: , , ,
Posted in Nginx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dzone.com
DZone

DZone MVB

Java Code Geeks
Java Code Geeks
OpenSourceForYou
%d bloggers like this: