01. Too much time – What is Nginx?
A little joke, I recently went to work, I thought I was very busy, but found that I actually have time to solve their needs emanating from the heart… ! Divergent…
How do you say? Time can’t just slip away, can it? I lost, was a pursuit of the program ape; Code farmers with dreams; Fantastical…
Suddenly found that I am always self-deprecating, self-deprecating can make yourself a little stronger so a drop, let oneself often feel that he is a small waste. As father Time whispered in my ear: Hello… . . Your life experience card, still have XXX, XXX, XXX, well, I glanced at it, THIS x number, I still know.
The birth or birth of any technology requires an understanding of the background and problems encountered. Apparently, no problem.
Why read Nginx?
Hemp, that is not because, the title all said, but also to ask why, you are not hasty.
Well, look what this guy can do:
Nginx’s innate event-driven design, fully asynchronous network I/O processing mechanism, minimal interprocess switching, and many optimizations make Nginx inherently good at handling Internet requests under high concurrency pressure, while reducing resource consumption and squeezing server hardware resources to the hilt.
You see it, is not to learn the operating system network IO processing mechanism; Has not learned the computer network HTTP all sorts of small knowledge; Is not master how to deal with high concurrency problems of the solution and design ideas; Is not learning optimization between operating system processes; Read the source code of Redis. Ok…
What is Nginx?
Without further discussion, let’s take a look at Nginx’s competitors — Apache, Lighttpd, Tomcat, Jetty, IIS — which are all Web servers, or World Wide Web servers, They also have the basic functions of Web servers: Communication based on Uniform Resource Descriptors (URIs) or Uniform Resource Locator (urls), based on REST architecture style. Provide various web services to client programs such as browsers through HTTP.
If you study Java, how can you not know Tomcat? Well, the most frequently used Springboot framework also has Tomcat built in. However, it is inherently a heavyweight Web server, its performance is not comparable to Nginx, we are not studying here, we are studying Nginx.
Well, IIS only runs on Windows, so we’re not looking at that.
Apache has many advantages, such as stability, open source, cross-platform, etc., but it has been around for so long that it was designed to be a heavyweight Web server that did not support high concurrency.
Like the number of Internet users in China… Will Apache survive? I’m afraid that if people in my village visit at the same time, it will consume a lot of memory on the server, and the operating system kernel will consume a lot of CPU resources to switch between hundreds of Apache processes, and reduce the average response speed of HTTP requests. All these make Apache unable to become a high-performance Web server. This led to the emergence of Lighttpd and Nginx.
There is no doubt that Lighttpd and Nginx, are lightweight, high-performance Web server, European and American industry developers prefer Lighttpd, while domestic companies prefer Nginx, Lighttpd is used less.
Key, nginx people also open source, according to my observation from zhihu, the elder brothers early code about more than 40,000 lines, easy to read, easy to understand, which design ideas can let us chew, perhaps to our solution to the problem has a good help, perhaps to our next XXX, also have a lot of help ha.
Why nginx?
Choose it, there is a natural reason to choose it, all things exist have its existence significance, I am in that XBB again.
- lightweight
- Faster: Faster than tortoise, that’s for sure.
- Highly reliable
- Easy extension
- Low memory consumption: In general, 10,000 inactive HTTP keep-alive connections consume only 2.5MB of memory in Nginx, which is the foundation of Nginx’s support for high concurrent connections.
- Supports 100,000 concurrent applications on a single machine
- Hot deployment
I play with Nginx from time to time, but I never thought it was so strong.
summary
Well, this section is so short that I want to read a novel…
Real dog, as long as you’re happy…
Since this section is short, the next section is written and shared right away…
I am also very busy to take time to talk about their feelings, well, not to say. To work… Leave tears of sorrow.
reference
- Nginx is easy to understand