How to write a web server

Almost everyone deals with web servers more or less every day. The more famous web servers are Apache Httpd, Nginx, and IIS. These softwares run on thousands of machines to provide us with stable services. When you open the browser and enter the URL, the web server will transmit the information to the browser and then present it to the user. Then since there are so many ready-made, mature and stable web servers, why do we need to reinvent the wheel? I think the reasons are as follows: to lay a

    solid foundation. A good developer must have a solid foundation, and building wheels is a good way. Learn a compiler? Look at the textbook and write one. learn operating system? Write a prototype out. In the field of programming, you can only dare to say that you can really do it if you do it yourself. Now I am learning network programming, so I plan to write a Server.

    Implement new functionality. Mature software may not consider your special needs too much in order to meet the needs of the public, so you can only implement this special need yourself. Nginx does a pretty good job of this, it provides user-defined modules to customize the functions they need.

    Help beginners easily grasp the architecture of mature software. For example, Nginx, although the code is beautifully written, but if you want to fully understand its architecture and some of its custom data structures, you have to check a lot of materials and reference books, and these architectures and data structures are to improve the software. The design of scalability and efficiency has nothing to do with the essential parts of high-concurrency servers, and beginners will be confused. And Zaver shows what a high-concurrency server should look like with the least code. Although it is not as high-performance as Nginx, the benefit is that it is not as complicated as Nginx, and the server architecture is completely exposed to users.


How to write a web server

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326990380&siteId=291194637