调整Linux内核参数:
# vi /etc/sysctl.conf
# tells the Kernel it's ok if services bind to non-existant IP ADDR# net.ipv4.ip_nonlocal_bind = 1# defines the size of the kernel queue for accepting new connections, Defaults to 128net.core.somaxconn = 40000# Maximum number of remembered connection requests, Defaults to 1024net.ipv4.tcp_max_syn_backlog = 40000# Tuning TCP Ports, increase the range to allow for more connections. # The number of avaliable ports limits the number of simultanious open connections.net.ipv4.ip_local_port_range = 1024 65535# Tell kernel to reuse faster the connection in TIME_WAITnet.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1# Resetting the File Descriptors, the maximum number of open files allowed per processfs.file-max = 1000000使设置生效:# sysctl -p调整最大打开文件描述符限制调整文件描述符限制:# ulimit -n 1000000# vi /etc/security/limits.conf# Setting Shell Limits for File Descriptors* soft nofile 1000000* hard nofile 1000000使用PAM模块限制资源:# vi /etc/pam.d/loginsession required pam_limits.so