tcp_rmem,TCP读取缓冲区
cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 4161536
tcp_wmem,发送缓冲区
cat /proc/sys/net/ipv4/tcp_wmem
4096 16384 4161536
tcp_mem,TCP的内存大小
cat /proc/sys/net/ipv4/tcp_mem
932448 1243264 1864896
echo "* - nofile 1048576" >> /etc/security/limits.conf
echo "fs.file-max = 1048576" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf
echo "net.ipv4.tcp_mem = 786432 2097152 3145728">> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 4096 16777216">> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 4096 16777216">> /etc/sysctl.conf
获取当前socket连接状态统计信息
cat /proc/net/sockstat
获取当前系统打开的文件句柄
sysctl -a | grep file
cat /proc/sys/net/ipv4/tcp_rmem
4096 87380 4161536
tcp_wmem,发送缓冲区
cat /proc/sys/net/ipv4/tcp_wmem
4096 16384 4161536
tcp_mem,TCP的内存大小
cat /proc/sys/net/ipv4/tcp_mem
932448 1243264 1864896
echo "* - nofile 1048576" >> /etc/security/limits.conf
echo "fs.file-max = 1048576" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf
echo "net.ipv4.tcp_mem = 786432 2097152 3145728">> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 4096 16777216">> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 4096 16777216">> /etc/sysctl.conf
获取当前socket连接状态统计信息
cat /proc/net/sockstat
获取当前系统打开的文件句柄
sysctl -a | grep file
本文介绍如何通过调整TCP的读写缓冲区大小(tcp_rmem和tcp_wmem)及TCP内存限制(tcp_mem)来优化系统性能,并展示了如何设置文件句柄最大数和端口范围等关键参数。

被折叠的 条评论
为什么被折叠?



