- Before making any kernel parameter changes, make a backup $sudo sysctl -a >$HOME/oldsettings.txt
- Edit /etc/sysctl.conf and add the below lines at the end of the file
==============
fs.file-max = 2203600
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_tw_recycle= 1
net.core.netdev_max_backlog= 16384
net.ipv4.tcp_max_syn_backlog= 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_rmem= 4096 87380 16777216
net.ipv4.tcp_wmem= 4096 16384 16777216
net.core.somaxconn= 4096
kernel.sched_migration_cost = 5000000
==============
- Reload the updated kernel parameters by running $sudo sysctl -p
- check the updated values are reflected in
$cat /proc/sys/net/ipv4/tcp_tw_reuse
$cat /proc/sys/net/ipv4/tcp_tw_recycle
==============
$sysctl <parameter name>
e.g.: $sysctl net.ipv4.ip_local_port_range
$cat /proc/sys/fs/file-max
$cat /proc/sys/kernel/sched_migration_cost
==============
==============
daemon soft nofile 10000
daemon hard nofile 50000
ec2-user hard nofile 30000
ec2-user soft nofile 50000
==============
- check whether the parameters have been updated by running sysctl again with parameter name
$sysctl <parameter name>
e.g.: $sysctl net.ipv4.ip_local_port_range
$cat /proc/sys/fs/file-max
$cat /proc/sys/kernel/sched_migration_cost
- Edit /etc/security/limits.conf and add soft and hard limits for httpd ("daemon") and default "ec2-user"
==============
daemon soft nofile 10000
daemon hard nofile 50000
ec2-user hard nofile 30000
ec2-user soft nofile 50000
==============
- No reboot of instance is required.
This comment has been removed by a blog administrator.
ReplyDelete