Last active
August 29, 2015 14:18
-
-
Save n37r06u3/86f2fc9bd792217d4c2e to your computer and use it in GitHub Desktop.
web server config(nginx + gunicorn+ django)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import os | |
bind = "127.0.0.1:8080" | |
workers = multiprocessing.cpu_count()*2 | |
worker_class = 'gevent' | |
timeout = 10000 | |
daemon = True | |
pidfile = os.path.join(os.path.dirname(__file__), '..', 'log','gunicorn_server.pid') | |
errorlog = os.path.join(os.path.dirname(__file__), '..','log','gunicorn_server.log') | |
loglevel = "error" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data www-data; | |
worker_processes 48; | |
pid /run/nginx.pid; | |
worker_rlimit_nofile 204800; | |
events { | |
user epoll; | |
worker_connections 204800; | |
} | |
http { | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 65; | |
types_hash_max_size 2048; | |
server_names_hash_bucket_size 128; | |
client_header_buffer_size 2k; | |
large_client_header_buffers 4 4k; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
charset utf-8; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
gzip on; | |
gzip_min_length 1k; | |
gzip_buffers 4 16k; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_types text/plain application/x-javascript text/css application/xml; | |
gzip_vary on; | |
include /etc/nginx/conf.d/*.conf; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Transactions: 9796 hits | |
Availability: 97.96 % | |
Elapsed time: 52.50 secs | |
Data transferred: 1.22 MB | |
Response time: 0.80 secs | |
Transaction rate: 186.59 trans/sec | |
Throughput: 0.02 MB/sec | |
Concurrency: 148.41 | |
Successful transactions: 9796 | |
Failed transactions: 204 | |
Longest transaction: 19.64 | |
Shortest transaction: 0.03 | |
FILE: /usr/local/var/siege.log | |
You can disable this annoying message by editing | |
the .siegerc file in your home directory; change | |
the directive 'show-logfile' to false. | |
$ siege -c 1000 -r 10 -u http://xxx.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net.ipv4.tcp_max_tw_buckets = 6000 | |
net.ipv4.ip_local_port_range = 1024 65000 | |
net.ipv4.tcp_tw_recycle = 1 | |
net.ipv4.tcp_tw_reuse = 1 | |
net.ipv4.tcp_syncookies = 1 | |
net.core.somaxconn = 262144 | |
net.core.netdev_max_backlog = 262144 | |
net.ipv4.tcp_max_orphans = 262144 | |
net.ipv4.tcp_max_syn_backlog = 262144 | |
net.ipv4.tcp_synack_retries = 1 | |
net.ipv4.tcp_syn_retries = 1 | |
net.ipv4.tcp_fin_timeout = 1 | |
net.ipv4.tcp_keepalive_time = 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment