标签:style class blog code http ext
事件模型跟随着指令,它允许你网络机制。有一些参数对于应用程序的性能有重要的影响。比如,下面的指令片段所示:
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;
测试性能的工具很多,我在这里仅介绍三种测试服务器性能的工具。这三种工具是为压力测试而设计的,各有各的优势。
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的优雅升级。
深刻理解Nginx之基本配置和升级(2),布布扣,bubuko.com
标签:style class blog code http ext
原文地址:http://blog.csdn.net/john_f_lau/article/details/34560487