High concurrency optimize for linux

Added to /etc/sysctl.conf:

 

vm.swappiness = 0
vm.max_map_count = 1000000
fs.file-max = 1000000

# increase the port range (to allow more sockets to be opened)

# net.ipv4.ip_local_port_range = 9000 65535 # if you run php fpm , should not lower than 9000

# allows OS to reuse sockets in TIME_WAIT state for new connections when it is safe from a protocol viewpoint.

net.ipv4.tcp_fin_timeout = 15



# net.core.default_qdisc=fq  #Enable tcp bbr, required linux kernel 4.19+
# net.ipv4.tcp_congestion_control=bbr
fs.inotify.max_user_watches=1000000

Added to /etc/security/limits.conf:

 

*               soft    nproc           1000000

*               hard    nproc           1000000

*               soft    nofile          1000000

*               hard    nofile          1000000

Added to /etc/pam.d/su:

 

session    required   pam_limits.so

 

Post: 2019.03.26 12:54

Views: 300

Edit blog

Follow me: @twitter @github
Scan QR code and Donate me via alipay:
donate me via alipay
Donate me Bitcoin:136MYemy5QmmBPLBLr1GHZfkES7CsoG4Qh
Powered by josense, Last updated: 2019-04-15 09:45 RSS