Not much to say, directly online on the server's sysctl.conf file, of course, this is the credit of the predecessor Daniel:
#---kernel optimization started--------
# Auto-Restart after 1 seconds when kernel panic
Kernel.panic = 1
# Allow more PIDs (to reduce rollover problems); May break Some programs 32768
Kernel.pid_max = 32768
# size of the maximum shared memory segment allowed by the kernel (bytes)
Kernel.shmmax = 4294967296
# Total amount of shared memory that can be used on the system at any given moment (pages)
Kernel.shmall = 1073741824
# Format of file names generated when program core is set
Kernel.core_pattern = core_%e
# automatically converts to panic when an oom occurs
Vm.panic_on_oom = 1
# indicates how much free memory the Linux VM is forced to keep at minimum (Kbytes)
Vm.min_free_kbytes = 1048576
# The value above 100 will cause the kernel to tend to recycle the directory and Inode cache
Vm.vfs_cache_pressure = 250
# indicates the degree to which the system is switching behavior, the higher the value (0-100), the more likely the disk exchange will occur
Vm.swappiness = 20
# Use only 10% as the system cache
Vm.dirty_ratio = 10
# Add System file descriptor limit 2^20-1
Fs.file-max = 1048575
# Network Layer Optimization
# listen () default parameter, maximum number of pending requests, default 128
Net.core.somaxconn = 1024
# Increase Linux auto-tuning TCP buffer limit
Net.core.wmem_default = 8388608
Net.core.rmem_default = 8388608
Net.core.rmem_max = 16777216
Net.core.wmem_max = 16777216
# Enter the maximum device queue for the package. Default is 300
Net.core.netdev_max_backlog = 2000
# Open SYN Flood attack protection
Net.ipv4.tcp_syncookies = 1
# Turn on and record spoofing, source Routing and redirection package
Net.ipv4.conf.all.log_martians = 1
Net.ipv4.conf.default.log_martians = 1
# Processing of packages for passive routing
Net.ipv4.conf.all.accept_source_route = 0
Net.ipv4.conf.default.accept_source_route = 0
# Turn on reverse path filtering
Net.ipv4.conf.all.rp_filter = 1
Net.ipv4.conf.default.rp_filter = 1
# Make sure no one can modify the routing table
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
# Increase system IP Port limit
Net.ipv4.ip_local_port_range = 9000 65533
# TTL
Net.ipv4.ip_default_ttl = 64
# increase TCP Maximum buffer size
Net.ipv4.tcp_rmem = 4096 87380 8388608
Net.ipv4.tcp_wmem = 4096 32768 8388608
# TCP Auto Window
net.ipv4.tcp_window_scaling = 1
# Enter the maximum request queue for the SYN packet. Default 1024
Net.ipv4.tcp_max_syn_backlog = 8192
# Opens the Time-wait socket reuse feature, which is very effective for Web servers with a large number of connections.
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_tw_reuse = 0
# Indicates whether to enable a more accurate method than a timeout (see RFC 1323) to enable calculation of RTT; This option should be enabled for better performance
Net.ipv4.tcp_timestamps = 0
# indicates the number of times that the native has initiated a TCP SYN connection timeout retransmission
Net.ipv4.tcp_syn_retries = 2
Net.ipv4.tcp_synack_retries = 2
# Reduce the time in the Fin-wait-2 connection state so that the system can handle more connections.
Net.ipv4.tcp_fin_timeout = 10
# Reduce the time of TCP keepalive connection detection, so that the system can handle more connections.
# If a TCP connection is idle for 300 seconds, the kernel will not initiate probe. If Probe 2 times (2 seconds each time) is unsuccessful, the kernel abandons completely and considers the connection to be invalid.
Net.ipv4.tcp_keepalive_time = 300
Net.ipv4.tcp_keepalive_probes = 2
NET.IPV4.TCP_KEEPALIVE_INTVL = 2
# The maximum number of TCP sockets that the system can handle that does not belong to any process
Net.ipv4.tcp_max_orphans = 262144
# The system keeps the maximum number of time_wait sockets, and if this number is exceeded, the time_wait socket is immediately cleared and the warning message is printed.
Net.ipv4.tcp_max_tw_buckets = 20000
# Cache limit Optimizations for arp_table
NET.IPV4.NEIGH.DEFAULT.GC_THRESH1 = 128
NET.IPV4.NEIGH.DEFAULT.GC_THRESH2 = 512
NET.IPV4.NEIGH.DEFAULT.GC_THRESH3 = 4096
#------Kernel optimization End--------
For more information on Linux kernel parameters, see:
http://yangrong.blog.51cto.com/6945369/1321594
This article from "Yang Cloud" blog, reproduced please contact the author!
Linux Kernel High performance optimization "Production Environment instance"