nginx وب سروری برای تمام فصول
TRANSCRIPT
http://www.efazati.org
1
2
http://www.devside.net/articles/apache-performance-tuningThe more RAM your system has, the more processes [and threads] Apache can allocate and use; which directly translates into the amount of concurrent requests/clients Apache can serve.
1http://daverecycles.com/post/3104767110/explain-event-driven-web-servers-to-your-grandma
3
4
5
/usr/local/nginx/sbin/nginx
2http://nginx.org/en/CHANGES3http://flask.pocoo.org/
6
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ app.py ~~~~~~~~~ :author: (c) 2011 - Mohammad Efazati <[email protected]> :license: BSD """from flask import Flaskfrom flask import render_template_stringfrom werkzeug.contrib.fixers import ProxyFix app = Flask(__name__)@app.route('/')def index(): return render_template_string('<h1>Hello Zconf</h1>') app.wsgi_app = ProxyFix(app.wsgi_app)
#user nobody;worker_processes 1;
#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;
events {
7
worker_connections 1024;}
http { include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0; keepalive_timeout 65;
server { listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / { include uwsgi_params;
uwsgi_pass 127.0.0.1:3031;
8
} error_page 500 502 503 504 /50x.html;
location = /50x.html { root html; } } }
# uwsgi --socket 127.0.0.1:3031 --file application/app.py --callable app --processes 4 --daemonize logs/uwsgi.log
efazati@efazati-PA65-UD3-B3:~$ ab -n 100000 -c 10 -g test_data_1.txt http://zconf/This is ApacheBench, Version 2.3 <$Revision: 655654 $>Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking zconf (be patient)
9
Completed 10000 requestsCompleted 20000 requestsCompleted 30000 requestsCompleted 40000 requestsCompleted 50000 requestsCompleted 60000 requestsCompleted 70000 requestsCompleted 80000 requestsCompleted 90000 requestsCompleted 100000 requestsFinished 100000 requests Server Software: nginx/1.0.6Server Hostname: zconfServer Port: 80 Document Path: /Document Length: 20 bytes Concurrency Level: 10Time taken for tests: 19.961 secondsComplete requests: 100000Failed requests: 0Write errors: 0Total transferred: 17600000 bytesHTML transferred: 2000000 bytesRequests per second: 5009.86 [#/sec] (mean)Time per request: 1.996 [ms] (mean)Time per request: 0.200 [ms] (mean, across all concurrent requests)Transfer rate: 861.07 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median maxConnect: 0 0 0.0 0 0Processing: 1 2 1.5 2 35Waiting: 1 2 1.5 2 35Total: 1 2 1.5 2 35
10
Percentage of the requests served within a certain time (ms) 50% 2 66% 2 75% 2 80% 2 90% 2 95% 3 98% 6 99% 12 100% 35 (longest request)
11
12
http://articles.slicehost.com/nginxhttp://articles.slicehost.com/2009/8/14/debian-lenny-nginx-configurationhttp://wiki.nginx.orghttp://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-sourcehttp://wiki.nginx.org/Installhttp://wiki.nginx.org/NgxWSGIModulehttp://library.linode.com/web-servers/nginx/python-uwsgi/debian-6-squeezehttp://wirtel.be/2011/02/24/nginx_gunicorn_flask/http://brandonkonkle.com/blog/2010/sep/14/django-uwsgi-and-nginx/http://en.wikipedia.org/wiki/Nginxhttp://projects.unbit.it/uwsgi/wikihttp://projects.unbit.it/uwsgi/wiki/Dochttp://projects.unbit.it/uwsgi/wiki/RunOnNginxhttp://library.linode.com/web-servers/nginx/configuration/basichttp://www.baus.net/on-tcp_corkhttp://en.wikipedia.org/wiki/Web_server_benchmarkinghttp://en.wikipedia.org/wiki/Reverse_proxyhttp://en.wikipedia.org/wiki/Proxy_serverhttp://www.webfaction.com/blog/nginx-apache-memory.pnghttps://farm4.static.flickr.com/3241/2298693485_df1606c495.jpg?v=0http://www.ehow.com/list_6183870_list-server-software.html
13