nginx单机1w并发设置

nginx单机1w并发设置_第1张图片

关闭keep-live,提高链接回收

keeplive_timeout 0; 

events{
worker_connections 1024;
}

more /proc/sys/net/core/somaxconn

[root@localhost ~]# echo 50000 > /proc/sys/net/core/somaxconn 
[root@localhost ~]# more /proc/sys/net/core/somaxconn 
[root@localhost conf]# cat /proc/sys/net/ipv4/tcp_tw_recycle 
0
[root@localhost conf]# echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle 
[root@localhost conf]# cat /proc/sys/net/ipv4/tcp_tw_recycle 
1
[root@localhost conf]# echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse 
[root@localhost conf]# cat /proc/sys/net/ipv4/tcp_tw_reuse 
1
[root@localhost conf]# cat /proc/sys/net/ipv4/tcp_syncookies 
1
[root@localhost conf]# echo 0 > /proc/sys/net/ipv4/tcp_syncookies
[root@localhost conf]# cat /proc/sys/net/ipv4/tcp_syncookies 
0
[root@localhost conf]# ulimit -n
1024
[root@localhost conf]# ulimit -n 50000
[root@localhost conf]# ulimit -n
50000
work_processes 1;
worker_rlimit_nofile 10000;

你可能感兴趣的:(nginx单机1w并发设置)