事件模型尾随着指令,它同意你网络机制。有一些參数对于应用程序的性能有重要的影响。
比方,以下的指令片段所看到的:
user nginx nginx;
master_process on;
worker_processes 4;
events {
worker_connections 1024;
use epoll;
}
[...]
配置了4个进程,每一个进程的处理事务的个数能够同一时候支持1024事件,使用epoll选择机制。
Nginx配置模型是一个简单模型,它使用include指令来激活文件的包括功能,还包括organization 和inclusions。这个指令可以被插入到配置文件的不论什么位置,接受一个文件路径作为參数。比方,以下这些指令。
include /file/path.conf;
include sites/*.conf;
測试性能的工具非常多,我在这里仅介绍三种測试server性能的工具。这三种工具是为压力測试而设计的,各有各的优势。
l Httperf: 它是由惠普开发的,一个相对著名的开源有用程序,只执行在Linux操作系统中。
l Autobench:Perl为Httperf的打包器,提升了測试机制和产生更细节的报告。
l OpenWebLoad:更小尺寸开源压力測试应用程序,它支持windows和linux平台。
更为具体的介绍,请查阅有关资料。比方,介绍Autobench,外文资料。
Autobench is a Perl script that makes use of httperf more efficiently—it runs continuous tests andautomatically increases request rates until your server gets saturated. One of the interestingfeatures of Autobench is that it generates a .tsv report that you can open withvarious applications to generate graphs. You may download the source code from theauthor‘s personal website: http://www. xenoclast.org/autobench/. Onceagain, extract the files from the archive, run make then make install. Although it supports testing ofmultiple hosts at once, we will only be using the single host test for moresimplicity. The command we will execute resembles the httperf one: [alex@example ~]$ autobench--single_host --host1 192.168.1.10 --uri1 / index.html --quiet --low_rate20 --high_rate 200 --rate_step 20 --num_ call 10 --num_conn 5000--timeout 5 --file results.tsv The switches can be configured asfollows: ? --host1: The website host name you wish to test ? --uri1: The path of the file that will be downloaded ? --quiet: Does not display httperf information on the screen ? --low_rate: Connections per second at the beginning of the test ? --high_rate: Connections per second at the end of the test ? --rate_step: The number of connections to increase the rate by after each test ? --num_call: How many requests should be sent per connection ? --num_conn: Total amount of connections ? --timeout: The number of seconds elapsed before a request is considered lost ? --file: Export results as specified (.tsv file)
幸运地是,Nginx嵌入了一种机制。它同意你不中断执行时间的情况下切换二进制文件。假设你依照以下的步骤操作,你不会有请求数据的丢失。
恭喜,这样就完毕Nginx的优雅升级。
原文:http://www.cnblogs.com/lytwajue/p/6973909.html