TCP network optimization
sudo came /etc/sysctl.conf
= 655360 vm.max_map_count
net.core.rmem_default = 262144
net.core.rmem_max = 2097152
net.core.wmem_default = 262144
net.core.wmem_max = 2097152
# net.core.somaxconn = 655360
# This value inet_listen () function It is limited to not exceed USHRT_MAX (ie 65535), otherwise it will error "sysctl: setting key" net.core.somaxconn " : invalid argument"
net.core.somaxconn = 65535
Execute sudo sysctl -p take effect
view the currently in force: sudo sysctl -a | grep $ { param}
Process-level resource limits optimization
sudo came /etc/security/limits.conf | /etc/security/limits.d/90-nproc.conf
Modify the file is to restart the process | persistent effect. Parameters of identical configuration items, / etc / security / limits.d / 90-nproc.conf will overwrite /etc/security/limits.conf
* Soft nofile 655360 * Hard nofile 655360 * soft nproc 8096 * hard nproc 8096
Modify process limits take effect immediately (temporary)
sudo prlimit --pid <pid> --<limit>=<soft>:<hard> sudo prlimit --pid 12345 --nofile = 655350: 655350 sudo prlimit --pid 12345 --nofile = 655350
Disk IO optimization
parameter name | explain |
sudo blockdev --setra 16384 /dev/sdx | Disk Queue |
sudo sh -c 'echo "4096" > /sys/block/sdx/queue/nr_requests' | Read-ahead size |
sudo sh -c 'echo "500" > /proc/sys/vm/dirty_writeback_centisecs' | Dirty data refresh control for the core processes of running intervals pdflush |
sudo sh -c 'echo "35" > /proc/sys/vm/dirty_ratio' | Write buffer size to control the file system file system, when it is greater than the threshold when the process control pdflush brush plate, the current write dirty pagecache occupancy ratio is greater than the threshold of physical memory is flushed to disk |
sudo sh -c 'echo "5" > /proc/sys/vm/dirty_background_ratio' | Percentile, maximum retention expired page cache (cache dirty pages) of. Is MmeFree + Cached-Mapped reference value |
sudo sh -c 'echo "2000" > /proc/sys/vm/dirty_expire_centisecs' | 1/100 sec. Expiration time cached pages in the data (old data), during the next cycle to be written to disk. The default 30 seconds is a very long time |