Brief Introduction to Application Operation Management in Linux Apache

Source: Internet
Author: User
Tags linux shell commands litespeed litespeed web server perl interpreter perl script microsoft iis

Linux Apache has been developing for a long time and many users are familiar with Linux Apache. Here I will share my personal understanding and discuss with you that tux is a type of GPLGNU General Public License) A licensed kernel-based Web server. Currently, it can only provide static Web Services. Dynamic Content Services are provided only when it is applied in conjunction with the kernel module, user module, and general user area Web server backend.

Generally, Web servers in the user zone do not need to change many places to adapt to TUX. However, the user data segment code must have an interface to be called by the TUX system.
Although dynamic content services are growing rapidly, static content services must also be provided. For example, all image files are static. TUX can provide highly efficient static content services in the Linux kernel, just like the NFS Network File System Service running in the kernel.

TUX also supports Processing dynamic content. The TUX module uses webpage buffering to store dynamic content objects. When a dynamic request arrives, a TUX module sends a combined dynamic request and caches the request. This is the structure of TUX's zero copy cache verification. It is recommended that TUX modules not run in the user zone, although they can also run in the internal core zone .)
This new dynamic content processing requires a new API. The current cgi api interface cannot be fully used in TUX APIs. Therefore, the current CGI program needs to modify the current program in order to use TUX. If the CGI program does not need to increase the TUX speed, TUX can also handle it with a general CGI. To implement this function, we need to use the CGI Module of TUX. TUX can also handle complex CGI or other requests, which redirects requests to another web Server background program, such as Linux Apache. That is to say, static content, TUX module, old CGI programs, and specific programs written for the TUX Web server can all be run on the TUX master server.

In a word, the difference between TUX and other Web servers and the benefits of TUX include:
TUX is run as a part of Linux kernel 2.4.x or higher, and the other part can be run as a user zone.
TUX caches TCP validation and uses them to accelerate network data transmission.
With a specific network card, TUX can direct the distributed DMA from the page cache to the network, thus avoiding data copying.
When TUX does not know how to process a request or receives a request that cannot be run, it generally sends the request to the background of the Web server in the user zone to process it. A typical user zone Web server is Linux Apache.

New Features of TUX 2.0

TUX 2.0 is upgraded from TUX 1.0 and is still conservative in compatibility with user zone modules.
Features added include:
The real zero-disk read copy, TUX1.0 is put in a temporary cache.
Generate a zero copy of network writes.
Zero copy resolution.
Other new features:
Improve the support of user de-function modules.
Support for virtual hosts, which does not limit the number of virtual hosts.
CGI can be bound to a specific process.
Fix some bugs.

Basic requirements of the System

TUX must be based on the 2.4.x kernel or a later version.
X86-based servers.
Alternate Web servers, such as Linux Apache, are used to process unknown requests.
Current restrictions:
The kernel module only supports the server.
TUX is only tested on x86 Linux.
TUX can request other Web servers such as Linux Apache to process requests. In the current version, it does not handle rollback well. Lighttpd, thttpd, shttpd
The vast majority of web servers in China are neither IIS nor Apache. in all respects, I think Linux Apache is a big winner, at least half of the market share.
However, apart from IIS/Apache, we have many options. For websites with high loads and high concurrency, high-performance and lightweight web server is a good medicine. Recently, the Server load on hand was too high, and swap was swallowed up, causing the machine to be very slow. Later I checked that Linux Apache had consumed almost all the resources, at that time, there were 9XX apache processes.
Therefore, replacing Linux Apache with a lightweight web server enters the calendar. These optional objects are introduced below:

Lighttpd

Official homepage: www.lighttpd.net
Lighttpd is an open-source software led by Germans. Its fundamental goal is to provide a secure, fast, compatible, and flexible web server environment for high-performance websites. It features low memory overhead, low cpu usage, good performance, and rich modules.
Lighttpd is one of the many OpenSource lightweight web servers. Supports important functions such as FastCGI, CGI, Auth, output compress, URL rewriting, and Alias. Linux Apache is popular because of its rich functions, many functions of lighttpd are implemented accordingly. This is very important for apache users, because these problems must be addressed when migrating to lighttpd.
In practical use, lighttpd is indeed very good. The above mentioned apache overload problem is completely solved using lighttpd. The main problem with apache is that, under intensive concurrency, constant fork () and switching, as well as high memory usage compared with lighttpd), system resources are exhausted. Lighttpd uses the Multiplex technology, the code is optimized, the size is very small, the resource usage is very low, and the response speed is quite fast.
The rewrite Technology of apache is used to hand over heavy cgi/fastcgi tasks to lighttpd. Taking full advantage of both, the load on that server is now reduced by an order of magnitude, the response speed has also increased by one or even two orders of magnitude!

Below is a passage from their official site:
"LightTPD is the BEST webserver out there, much faster than apache and much more flexible/retriable/secure than tux, and its fcgi php support is simply unbeatable ."
Thttpd
Http://www.acme.com/software/thttpd/
Thttpd is a very small and lightweight web server. It is very simple and only provides HTTP/1.1 and simple CGI support, on its official website, there is a comparison chart + Benchmark with other web servers such as Linux Apache and Zeus. For more information, see. In addition, thttpd is similar to lighttpd. For concurrent requests, the fork () method is not used to dispatch the child process, but Multiplex technology is used. Therefore, the performance is very good.
Thttpd supports multiple platforms, such as FreeBSD, SunOS, Solaris, BSD, Linux, and OSF. For small web servers, fast speed seems to be synonymous. With Benchmark provided by official sites, thttpd is at least as fast as the mainstream web servers and faster under high loads, because its resource usage is small.
Thttpd has another notable feature: URL-based file traffic limit, which is very convenient for download traffic control. Like Linux Apache, plug-ins must be used for implementation, which is less efficient than thttpd.
Shttpd

Official Website: http://shttpd.sourceforge.net/Shttpd is another lightweight web server, with more features than thttpd, support CGI, SSL, cookie, MD5 authentication, can also be embedded (embedded) to the existing software. The most interesting thing is that no configuration file is required!
Because shttpd can be embedded with other software, it is very easy to develop the web server of the embedded system. According to the official website, if shttpd uses uclibc/dielibc (simplified subset of libc) the overhead is very low. Its features are as follows:
Stand-alone server, or embeddable into existing C/C ++ program
GET, POST, PUT, DELETE methods
CGI
SSL
Digest (MD5) authorization
Multiple (and user defineable) index files
Directory listing
Standard logging
Cookies
Inetd mode
User-defineable mime types
No configuration files
No external dependencies
Because shttpd can be easily embedded into other programs, shttpd is an ideal web server development prototype. developers can develop their own webserver Based on shttpd!

The following is an official LiteSpeed Web Server article I have translated.
For images, see ......
Http://www.litespeedtech.com/benchmark.html
Comparison of the performance of several web servers:
Tested web server software
Test Environment
Test Results
Use small static files as the benchmark
Based on CGI
Based on FAST CGI
Based on the PHP script: mod_php vs. FastCGI PHP
Based on the Perl script: mod_perl vs. lsperld conclusion.

Tested web server software

The following web servers are included in this test.
Linux Apache 1.3.33
Linux Apache 2.0.52 (prefork mpm)
In IIS 6.0
LiteSpeed 2.0 Standard
LiteSpeed 2.0 Professional
Thttpd 2.25b
TUX 3.2
Boa 0.94.14rc20
Lighttpd 1.3.12
Aolserver 4.0.7
Mathopd 1.5p3
LSWS is short for LiteSpeed Web Server.
Originally, zeus and sunone would also like to be included in this benchmark, but those software statements cannot be published on their testing results.
Test Environment
Network switches: D-Link Gigabit Eight Ports Switch DGS-1008D
Server Hardware: Dell PowerEdge SC1600
CPU: Single Intel Xeon 2.4 GHz/533FSB/512KB L2 Cache
Memory: 256 mb ecc PC2700
Hard Drive: 36 GB 10 k rpm scsi drive Seagate ST336607LW
NIC: on board Intel PRO/1000 Gigabit Adapter
Server Software:
Fedora Core 3 with stock kernel BRL. 10-1.760
IIS 6.0 on Windows 2003 Enterprise
Web Server deployments:
Linux Apache 1.3.33
Linux Apache 2.0.52
Microsoft IIS 6.0-default
LiteSpeed 2.0 Standard-default
LiteSpeed 2.0 Professional-default
Thttpd
TUX 3.2-default
Boa
Lighttpd
Aolserver
Mathopd

If you want to know the specific configuration at that time, you can view it in the original article, Web Server Configurations: http://www.litespeedtech.com/benchmark.html.
Note: Both LiteSpeed and lighttpd support the new I/o event transmitter sys_epoll () in the 2.6 kernel (). But what's interesting is that. We found that the results of these two server benchmark tests were not as good as the previous standard time transmitter poll.
At least when we test the concurrency level through the Network <= 1000, we only use poll () for all our tests.
The result may be completely different from the loop test on the local machine.
Client Hardware: MSI K7D
CPU: Dual Athlon MP 2000 +/266FSB/256KB L2 Cache
Memory: 1 GB PC2100
Hard Drive: 36 GB 1000 rpm scsi drive
NIC: Intel PRO/1000 Gigabit Adapater
Client Software:
OS: RedHat 8.0 with kernel 2.4.22smp
Test Tool: apache.pdf (AB) 1.3.33
Test results:
It runs three times in each case, and the best result is adopted. The server is restarted when a web server software is tested.
Use small static files as the benchmark
The small static page size is only 100 bytes. The reason for testing with small files is to avoid network bandwidth bottlenecks. We only want to demonstrate the performance of the web server, not the kernel.
Non-KeepAlive test: AB-n 100000-c:/100.html "> http: //:/100.html

CGI Benchmark Test

A simple c cgi script (echo) is used for testing here. It is an example of c cgi/fcgi in the fcgi 2.4 package. Print all cgi environment variables.
CGI Test: AB-n 3000-c:/cgi-bin/echo "> http: //:/cgi-bin/echoPHP script Benchmark Test: mod_php vs. FastCGI PHP
Two simple php scripts are used for testing. One is hello. php and only outputs hello world. The other is phpinfo. php, which only calls phpinfo (). The opcode accelerator is not configured here ). Because they have little influence on these two simple php scripts.
Hello. php test: AB-n 10000-c:/phpinfo. php "> http: //:/phpinfo. php

Perl script Benchmark Test: mod_perl vs. lsperld
A Hello World perl script generates a response body of 77 bytes. Used for testing.
Linux Apache 2.0 is not tested. It is too troublesome to install mod_perl for both 1.3 and 2.0 on the same server.
Linux Apache 1.3 is configured to use Apache: Registry to process perl scripts.
Lsperld is a Perl Fast CGI script that can run CGI perl scripts in a persistent Perl interpreter, Just Like Apache mod_perl's Apache: Registry, compile perl scripts, and cached to the memory.
Hello. pl test: AB-n 10000-c http://www.litespeedtech.com/
LiteSpeed web server is an Apache interchangeable, full-featured high performance, secure HTTP server specifically engineered from the ground up with security and scalability in mind.
The stability of lighttpd, thttpd, and shttpd has not been affirmed.
This document will be supplemented later. If the translation is incorrect, please refer to the original article.

  1. Analyze why access to Linux Apache is too slow
  2. Configuration and optimization of the Linux Apache Server System
  3. Installation and configuration of Apache Virtual Host in Ubuntu Linux
  4. Brief Introduction to the Collection programming language of Linux shell commands
  5. Describes how to mount partitions in Linux.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.