Sysctl.conf large instance
sysctl.conf
fs.file-max = 2097152
# Increase the maximum number of socket connections net.core.somaxconn = 1024 # Increase the size of the receive queue net.core.netdev_max_backlog = 5000 # Increase the number of incoming connections net.core.somaxconn = 4096 # Increase the range of ephemeral ports net.ipv4.ip_local_port_range = 10240 65535 # Reuse and recycle TIME_WAIT sockets faster net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 # Enable TCP SYN cookies net.ipv4.tcp_syncookies = 1 # Increase the number of possible connections net.ipv4.tcp_max_syn_backlog = 8192
# Swappiness setting to avoid swap unless absolutely necessary vm.swappiness = 10 # Increase the amount of memory allocated to file handles and inodes vm.vfs_cache_pressure = 50
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
# Enable TCP window scaling net.ipv4.tcp_window_scaling = 1 # Increase TCP buffer sizes net.ipv4.tcp_rmem = 4096 87380 6291456 net.ipv4.tcp_wmem = 4096 65536 6291456 # Increase the maximum amount of option memory buffers net.core.optmem_max = 25165824
kernel.shmmax = 68719476736 kernel.shmall = 4294967296
sudo sysctl -p
Explanation of Common Settings - fs.file-max: Sets the maximum number of file handles that the kernel will allocate. - net.core.somaxconn: Maximum number of connections that can be queued for acceptance. - net.core.netdev_max_backlog: Maximum number of packets, queued on the input side, when the interface receives packets faster than the kernel can process them. - net.ipv4.ip_local_port_range: Range of ports used for outgoing connections. - net.ipv4.tcp_tw_reuse and net.ipv4.tcp_tw_recycle: Enable reuse and recycling of TIME_WAIT sockets. - net.ipv4.tcp_syncookies: Protect against SYN flood attacks. - net.ipv4.tcp_max_syn_backlog: Maximum number of remembered connection requests, which have not received an acknowledgment from connecting clients. - vm.swappiness: Controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. - vm.vfs_cache_pressure: Controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects. - kernel.shmmax and kernel.shmall: Control the maximum shared memory segment size and total amount of shared memory, respectively.