This article first introduce a variety of WEB server platform, and then affect all WEB server performance analysis done, the last parsed using the most Pubian Muqian the Apache Fuwuqizai service Qingqiu peak of Xiangyingyanchi Xianxiang
In an article last week, we introduced the method set up WEB server, but this is only the first step to establish WEB servers, running in the actual site, the server performance may be unsatisfactory, requiring analysis specific server performance bottlenecks and find solutions. This article first introduce a variety of WEB server platform, and then affect all aspects of WEB server performance were analyzed, the final resolution of the current Apache server using the most popular service requests in response to the peak of a delay in the hope of the WEB server performance bottlenecks analysis of help.
Web platform for the Internet, just how many different combinations of hardware and software? You will certainly surprise the figure. From the configuration of the latest version of IIS (Internet Information Server, Internet Information Server) WindowsXP system to run on Apache server, "ancient" in SunOS 4.x system, really a few. Of course, the most popular of several platform also so few. Windows NT class (especially also configured IIS and SQL Server's system) is a common web platform recently. Meanwhile, the company running the SUN SPARC workstation Solaris (Netscape, Enterprise Edition installed on the Webserver) and the free Apache server systems are more common. In addition, it is quite surprising is that, Linux and FreeBSD these two top open source operating system platform of the above categories constitute a great threat. Is changing the distribution pattern of the server operating system.
Why do so many people choose Windows NT/2000/XP?
Let us not look outstanding running stability, and stable operation of the system normal regardless of time or the performance, Windows NT class operating system application environments in the field in the server market share occupied by an alarming rate, sustained and rapid growth, mainly because it has a very considerate of users easy operation and outstanding development tools.
Many just entering the field of IT users love Windows, this "normal" interface, because it greatly simplifies the daily management. For developers, due to Microsoft to provide the most complete, most efficient development environment to benefit from the NT system is not small. Some development tools like InterDev and Visual Source Safe (in the large project management software version), in combination, developers can easily reduce the development time.
Why do some people choose not to Windows NT?
Windows family, Windows NT, after all, still a member of the family of operating systems there are many problems encountered, affecting some large amount of computation resource consumption over the stability of the application and enforceability. Windows NT 4 used a static kernel, which makes even the implementation of some very simple tasks, such as loading a new drive, it must restart the machine. In addition, comparison, and UNIX, Windows NT is also a lack of a large number of remote management tools. However, with Microsoft's new server operating system 2000/XP release, these problems are being solved, the latest WindwoXP Server Edition can be a good server operating system.
Solaris is a UNIX operating system on the market the most popular variant. Most Internet web site used to provide services to Solaris. In all the different UNIX variants, Solaris has the largest user groups, accordingly, it is also the most profitable of a software. A variety of application server and application environment designed specifically for the Solaris version, such as ColdFusion (commonly used in Windows NT) have been introduced. Solaris system can provide a true enterprise-class reliability and high performance, comparable with other platforms difficult. And Windows NT is different is that when you add additional hard disk to the system when the system does not need to reboot Solaris. In addition, larger companies in the Sun's enterprise-class server, you can not even shut down the case, replace the memory and CPU. Compared with many platforms, Solaris also provides the best multi-processing (multiprocessing) performance.
Why do some people not willing to Solaris?
Well, it is fair to me that the reason people do not choose Solaris. First to point out that, based on Intel chips, SPARC-based Solaris platform is not equivalent to the Solaris platform chips. Although the Intel chip version of the Solaris and SPARC, version of the system has the same high reliability, but the commercial software used for the former than the latter number was significantly more than the same time, due to hardware limitations, Solaris system, some relatively advanced features (such as CPU or memory hot plug upgrade) version of the Intel chip can not be achieved. Some time ago and even news that the latest Solaris will no longer support the Intel platform, which uses Intel hardware platform, users can be a regret.
Select Linux or FressBSD?
Open-source operating system (such as Linux, FreeBSD) in the market to seize a growing market share, people in general acceptance of such systems began at an alarming rate. A few years ago, only a few companies know what Linux in the end, but now it has been in almost every industry are out to promote the professional user. For example, you can buy in the market for more commercial software based on Linux platform, such as Oracle, Sybase and so on.
At the same time, FreeBSD has also made considerable part of the commercial support, some of which is due to the reasons for the popular Linux brought. Many large sites, such as Yahoo, are running FreeBSD platform. FreeBSD and Linux compatibility issues between the very small. Therefore, we find that these two operating system user groups will continue to grow simultaneously.
Unfortunately, many use the open source operating systems because they do not want to pay the related costs, actually resisted using the Linux platform business software. From a certain angle, as if because they used Linux system users as free use of the practice, while not willing to pay for the server to other applications. From the current situation, this market has had a chilling effect. I estimate that as more and more software release based on the platform, this situation will worsen.
This is mainly because the Linux operating system, mostly by small companies and individuals to choose from, but in fact these groups could not afford enterprise-class business software. This situation only in the opensource operating system technologies and markets mature and grow up, and were more large companies (who often have greater needs) accepted only after changing.
On the Internet, on the open source operating system to support the voice of high, but awareness of this type of platform to learn and understand difficult than Windows, Solaris or even much more. In addition, these software are all in a process of rapid development. So you are looking for when you need something, perhaps inadvertently found that the system always some small bug (the wrong computer code or routine of the defect) and not the complete package.
WEB service needs for those small, tight hardware resources for small companies, they are generally more willing to use an open source operating system (instead of a business solution). For the less experienced companies, they tend to choose safe and reliable Windows solution. Web publishing needs of those huge, and to ask the system uptime rate of over 99% or more of the company may choose Solaris. Because olaris stability can meet this demanding operational requirements to provide greater protection.
A server to provide web publishing services, most of the regular host of other comparison was more general load conditions (load conditions) affected. In fact, a web site in a variety of content to accommodate a large number, even one of the simple HTTP server (the server software sense), its load is far beyond the expected HTTP protocol beyond the scope of the original designers .
In fact, the current web site can use a variety of techniques, including static HTML, embedded or server parsed HTML (inline / server-parsed HTML) and CGI (Common Gateway Interface, Common Gateway Interface), and to ODBC (Open Database Connectivity, Open Database Internet access) to achieve a database of interconnection. These different data sources are part of the very common, and the rest are not. In any case, each data source are in a unique way to play a role in web services. In determining appropriate for your site in the end which server, you should clear about, what your needs.
This is any site on the Internet constitutes a fundamental "elements." Although the true sense of completely static HTML to build the site less and less the number, but almost all of the sites are different grades of this "element." Static HTML page is strictly by the standard HTML markup language form, does not require server-side real-time algorithms. This means that, given a static HTML document access request, the server simply transfers the document to the client. Run from the server view of that time slice, the transfer process only takes up very little CPU resources. In order to improve the efficiency of static HTML's visit, mainly to optimize the following aspects: network bandwidth, disk I / O and cache (cache).
Server parsed HTML
Rely on a server parsed HTML page consists of two parts of the code, one standard HTML code, the second is the server running the code (by a third party processing program or web server itself on the page before it is transmitted to the client to explain). This HTML page is an upgrade version of the CGI program (since it is very efficient). At present, the embedded server-side extensions, such as ASP, PHP3, or even an ordinary set of server-side support for the expansion, has been a very common use. The purpose of this extended set of development is to make website content more lively, more modular, to facilitate maintenance. In addition, the server parsing the document to improve the performance of relatively low client mode, the client to minimize the load, but also reduces the data transfer bandwidth requirements. Obviously, you want to get all this money must pay the price. Because the server parsing the document must be in its transmission to the client before the server to interpret, so you give your server to add additional CPU.
Common Gateway Interface (CGI)
CGI to make Web sites with better interactivity and usability. It can be used to collect user input data, allowed to run an external program to perform many tasks associated with user input and the output of the implementation of the results, therefore, after application of CGI, the Internet's use has been greatly expanded. However, to use CGI, it must pay a certain cost. Especially in the CGI and the interpreter (such as PERL) when used, CGI call costs will be high. If your system is running in extreme heavy load conditions, the cost is persistently high. If possible, you should consider the use ASP or PHP3 instead of CGI.
Currently, the Internet's largest online database of resources killers when a non-(online databases) and electronic commerce (e-commerce) applications must go. Web features to provide database and application server rapid growth in recent years, showing strong momentum. From a performance point of view, online database (based on Oracle, SQL Server or Sybase, etc.) and applications such as Japan and China rose, forcing people to pay more attention to performance of the server status. For large sites, the high load of HTTP transfer and database-processing services with each other to seize resources and may eventually lead to a server in a very short time, the collapse or become slow as a snail. In this case, recommend that you use a dedicated database server running in the background (of course, for security considerations), and HTTP server front processing.
As we all know, what choice of a different type of transmission medium, the load must be based on the expected type of decision. Therefore, from this point of view, you should be able to roughly determine whether the need to adopt what kind of hardware. Despite the different platforms provide different levels of performance, the performance of each platform, or there is a certain overlap between, so you can use on the amount of hardware required to make any decision, the initial choice about which you feel most comfortable to use platform.
Below, will be those with Tedingwangzhan (Zhelei site Yiban only use Biaozhun De Chuanshujiezhi and content types, such static HTML, server Jiexiwendang Yi Ji Shu Liang from Shaoliang to moderate the CGI Cheng Xu) bottlenecks associated impact on the system Genju Its Chengduozhuge listed.
Throughput and peak transfer rate or burst transfer rate (Spikes / Burst Transfer Rates)
Webserver client and the file system buffer (Filesystem Cache) memory occupied by the activities of
Access time, the efficiency of access across multiple hard drives
In multi-process or multi-threaded environment performance
Bandwidth available for those composed mainly of static pages for the site, perhaps the most crucial factor, but the problem is often not as simple as you think. Leaving aside the total network throughput and response time do not speak, in high load conditions, the system's burst transfer rate is very important. Although a single T1 or T3 data rates to provide a total bandwidth of a particular site in terms of maybe more than enough, but the maximum data rate (T1 under 1.5mbit / s, T3 under 4.5mbit / s) might not be enough transmission system to meet the peak load. The peak in the user access to certain sites may simply not have access to. This site the user attempts to access it when trying to slow as a snail, while the server itself is still very free. It would appear, to successfully build a web host, in the end you need to consider carefully how much bandwidth is obviously very important.
Available physical memory is another important factor, because the occupancy rate of the memory on the server directly with the increase of the number of requests. Assigned to the calculation of the amount of memory for each concurrent user, and the average number of concurrent users, but you have to consider the matter part. File buffer is also very important, because it will use the disk to minimize the frequency, significantly speeding up the overall speed of the transaction.
Demand depends on the memory used in a specific server software specific circumstances. In addition to the operating system and file system management capabilities beyond the buffer size, you also need to choose your web server software on special hardware requirements are clear.
And the storage medium reading and writing related to the time indicator is also very important for large paper library and database (file buffer significantly reduced role in this) case, in particular. To work in a multi-device conditions, Web server disk system must have superior performance, recommend the use of SCSI hard disk or RAID array. For those major release of the "read only" permission site (users can not upload data), RAID is the best solution. This is because, in the multiple disk RAID arrays in the head, can significantly improve data throughput of read operations.
For those who constitute the main site from static pages is, CPU is only the most minor you need to consider a factor. This is because even a very low-end PC computers can fully exploit T1 channel transmission rate. However, the use, including CGI, server, parsing the document or to provide web access to the database the way the case, you need to focus more CPU performance. In such situations, the transaction processing speed and performance of concurrent processing to distinguish the two concepts is very important. If you need a smaller user groups to provide some much dependent on the CPU applications, then a high-speed CPU may be the single most useful. Danshi, if there are multiple users at the same time large quantities of the page Proposed access requests, so in this case (especially in these pages are Duli process or thread Mode is turned under), multi-CPU Xitong (even if these CPU speed very slowly) maybe even more useful.
Analysis server mode
While the market can buy a variety of Web server, but if the single-visit approach to concurrent terms, all servers can be roughly divided into four basic.
Single-threaded mode (single-threaded mode)
Very effective, can take to improve resource efficiency (except for symmetric multi-processor)
Fork mode (branching pattern)
The high cost of each request, performance is poor, with good handling characteristics of symmetric multi-
Pre-Fork model (pre-fork mode)
Symmetric multi-processing features good response speed is usually faster
Threaded Mode (thread mode)
Efficient multi-processing features, fast response
single-threaded server is usually the method chosen in a single process handles all access requests. On only a single processor machine, the type of server is very efficient. However, it can not add additional processors to improve performance accordingly.
In this simulation test, we have y-axis label of the maximum number of 100 requests / second, which is aimed to assess the single-threaded mode performance. Simulation of the server to maintain the number of requests per second at 70, even so, it has been and is very similar to actual use. We found that in this environment, when handling lighter loads, single-threaded model is very efficient, very quick response time. As the load increased, we also found that deterioration of the performance of the server, this situation can only be improved with better hardware.
In general, the process through additional servers to handle each request as much a part of the process of adding new, relatively low efficiency, response speed is slower. Because this way to cope with high volume client requests will be excessive consumption of resources, obviously, with the request to increase the number and frequency of the system's performance will gradually decline.
fork mode, the test results and the single-threaded mode, the test results are very similar. The difference is that each new process because the high costs compared with Duiyu single-threaded servers, such Moshi under the Guanliweihu the trend will likely http server process increases.
pre-fork fork server similar to server and also through a separate process to handle each request. However, the difference is, pre-fork server process through a large number of pre-open, waiting and processing received requests. As a result of this approach to open the process server does not need to wait for the new process was initiated in Er Xiaohaoshijian, made it possible to more quickly the Suduyingfu Duo user requests. In addition, pre-fork server peak load in the face of great performance was still good condition. This is because any time as long as all the processes have been pre-set is used to process the request, the server can append additional process.
pre-fork server running quite a unique curve. And the previously mentioned fork mode is similar, pre-fork server is through a separate http server process to handle each request, however, and fork the server is different, pre-fork server will increase as the number of requests starts Several new process. Advantage of this method is able to maintain a response to the http communication ability, to the server to provide a little "breathing" time. Drawback is that, in the event the peak load, due to start new server process will inevitably bring about the delayed response.
threaded server and http server (the request must be generated for each new process to deal with) somewhat similar. However, it is thanks to the threading, is generally achieved at lower administrative costs to process the request with the effect of the process.
threaded server and the process by generating a new server to handle requests not very different, but it generates a thread rather than process, therefore, the dependence of its relatively small resources.
The world's most popular non-Apache Web server must go. It uses the Pre-Fork model. Let us see how it works.
The Pre-Fork Apache server design principle is: when the number of idle server processes the default threshold is less than when the user starts an additional process. Another user to set the variable determines the idle maximum number of server processes, while the process if the actual idle more than this maximum value, the server will be shut down idle process.
In order to successfully complete the following simulation tests, we first assume that the following conditions:
1, the number of idle server processes the minimum value of 5
2, the number of idle server processes a maximum of 10
3, the number of server processes the initial value of 5
When the Pre-Fork server in an "infinite plane" on the run state (this machine has infinite physical memory and CPU time, we may just assume that it is real). Pre-Fork server peak load generated in the face of the "Step" (stair-step) effect. In fact, in this case, as assumed before the Pre-Fork server has unlimited resources, so its performance is very satisfactory. However, over time, actual performance was able to modify activities based on the average load the number of server processes which change the maximum and minimum values.
Of course, this station has unlimited resources of the machine apparently does not exist, so let us make a more true in a number of simulation tests. This time, we want to use physical memory taken into account. No harm to make the following assumptions:
1, the number of idle server processes the minimum value of 5
2, the number of idle server processes a maximum of 10
3, the number of server processes the initial value of 5
4, the machine equipped with 256 MB of physical memory. The operating system and file system buffer factors into account, we assume that there is 196MB of memory in which a separate web server for use.
5, each web server process consumes 1.5 MB of physical memory
6, does not consider the CPU and hard disk elements, and we assume that once the machine's memory exhaustion, they can not handle the additional access requests.
The tests show that all the physical memory in the machine was a huge depletion of the peak load before, our platform is more true server performance and that Taiwan has unlimited resources, the ideal server is exactly the same. The number of available physical memory (unit: MB) with a red line marked in the figure, the number of concurrent requests to 130, the memory was run out. This makes the 320 did not respond to requests in the state. If we CPU usage and disk activity and other factors into consideration, these figures will be smaller, and the machine to cope with the lack of available memory, while the busy status of the data exchanged between the memory and hard drive, which obviously reduces performance of the system .
As you know, the factors affecting web server performance countless, to restrict the role of these factors can only give full play to people's creative thinking. Used to publish Web pages in different types of system hardware requirements are different. This is a rough introduction to set up a Web server to be taken into account, I hope it will help you to better understand these system requirements. On this basis, the future, we will publish some articles describe the Web server environment Athlon system, symmetric multiprocessing (SMP) systems and their performance under the Web environment.