Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

设置推荐值基本原理
net.core.netdev_max_backlog30000设置包的最大数, 在输入端进行排队, 当接口接收包比内核处理更快时. 推荐设置为10GbE 链路. 对于1GbE 链路使用 8000.
net.core.wmem_max67108864对于 1GbE 链路, 设置最大数为 16MB (16777216) , 而对于10GbE链路为 64MB (67108864).
net.core.rmem_max67108864对于 1GbE 链路, 设置最大数为 16MB (16777216) , 而对于10GbE链路为 64MB (67108864).
net.ipv4.tcp_congestion_controlhtcp这看起来是 bugs 在 bic 和 cubic 上(默认) , 对于 Linux 内核上到版本 2.6.33. Redhat 5.x 内核版本是 2.6.18-x , Redhat 6.x内核版本是 2.6.32-x.
net.ipv4.tcp_congestion_window10默认情况下, Linux OS 是基于 Linux kernel 2.6.39 或以上版本.
net.ipv4.tcp_fin_timeout10This setting determines the time that must elapse before 此设置确定了TCP/IP can release a closed connection and reuse its resources. During this 释放一个关闭连接和重用资源之前 时间必须超时.在这个 TIME_WAIT state, reopening the connection to the client costs less than establishing a new connection. By reducing the value of this entry状态中, 重新打开到客户端的连接的成本低于建立新连接的成本. 通过减少条目值, TCP/IP can release closed connections faster, making more resources available for new connections. The default value is 60. The recommened setting lowers its to 10. You can lower this even further, but too low, and you can run into socket close errors in networks with lots of jitter能够更快地释放关闭的连接, 对于新的连接让更多的资源可用. 默认值是 60. 推荐设置较低, 为10. 你能够进一步拉低这个值, 如果这个值太低, 将会在网络中得到 socket close errors , 并带有大量的抖动.
net.ipv4.tcp_keepalive_interval30_keepalive_interval30此设置确定了在isAlive间隔的等待时间. 默认值是75. 推荐值拉低了这个值, keepalive时间为30This determines the wait time between isAlive interval probes. Default value is 75. Recommended value reduces this in keeping with the reduction of the overall keepalive time.
net.ipv4.tcp_keepalive_probes5How many keepalive probes to send out before the socket is timed out. Default value is 9. Recommended value reduces this to 5 so that retry attempts will take 2.5 minutes在 socket 超时之前, 有多少 keepalive probes 发出. 默认值为 9. 推荐值拉低了这个值为 5 , 因此重试操作将花费 2.5 分钟.
net.ipv4.tcp_keepalive_time600Set the 设置 TCP Socket timeout value to 10 minutes instead of 2 hour default. With an idle socket, the system will wait 超时值为 10 分钟, 默认是 2 小时. 在一个空闲 socket, 系统将要等待 tcp_keepalive_time seconds, and after that try 秒, 在尝试 tcp_keepalive_probes times to send a 次数后 发送一个 TCP KEEPALIVE in intervals of tcp, 时间间隔为tcp_keepalive_intvl seconds. If the retry attempts fail, the socket times out秒. 如果重试尝试失败, socket 将超时.
net.ipv4.tcp_low_latency1配置 TCP 为低延时, 在吞吐量上达到低延时
net.ipv4.tcp_max_orphans16384Limit number of orphans, each orphan can eat up to 限制 孤儿套接字的数量, 每个孤儿套接字将吃掉最大 16M (max wmem) of unswappable memory非交换内存
net.ipv4.tcp_max_tw_buckets1440000Maximal number of timewait sockets held by system simultaneously. If this number is exceeded 通过系统持有的timewait sockets最大数量. 如果此数量超过了, time-wait socket is immediately destroyed and warning is printed. This limit exists to help prevent simple DoS attacks将立即销毁, 并打印出警告信息. 此限制帮助对一些简单的 DDoS 攻击进行防护.
net.ipv4.tcp_no_metrics_save1禁用 连接关闭的缓存TCP metrics
net.ipv4.tcp_orphan_retries0Limit number of orphans, each orphan can eat up to 限制孤儿套接字的数量, 每个孤儿套接字将吃掉最大 16M (max wmem) of unswappable memory非交换内存
net.ipv4.tcp_rfc13371Enable a fix for 开启对 RFC1337 的修复 - TCP 中的 time-wait assassination hazards in TCP破坏风险
net.ipv4.tcp_rmem10240 131072 33554432Setting is 设置是 min/default/max. Recommed increasing the 推荐增加 Linux autotuning TCP buffer limit to 自动调优 TCP Buffer 限制到 32MB
net.ipv4.tcp_wmem10240 131072 33554432Setting is 设置是 min/default/max. Recommed increasing the 推荐增加 Linux autotuning TCP buffer limit to 自动调优 TCP Buffer 限制到 32MB
net.ipv4.tcp_sack1启用 选择确认
net.ipv4.tcp_slow_start_after_idle0默认情况下, TCP 以单个小段开始, 通过每次一个逐渐增加它.这导致了不必要的拖慢, 影响了每个请求的开始.
net.ipv4.tcp_syncookies0很多默认的 Linux 安装使用 SYN 来保护系统免于 TCP SYN包洪泛攻击. 使用 SYN cookies 显著减小了网络带宽, 通过运行 Geode 集群来触发. 如果你的 Geode 集群防护受攻击, 则禁用 SYN cookies 来保障 Geode 网络吞吐量不受影响. 
注意: 如果 SYN 洪泛是一个问题, 那么 SYN cookies 则不能禁用, 尝试配置以下参数: 
net.ipv4.tcp_max_syn_backlog="16384"
net.ipv4.tcp_synack_retries="1" 
net.ipv4.tcp_max_orphans="400000"
net.ipv4.tcp_timestamps1启用时间戳(在 RFC1323中定义):
net.ipv4.tcp_tw_recycle1This enables fast recycling of 启用TIME_WAIT sockets. The default value is Socket快速回收. 默认值为 0 (disabled禁用). Should be used with caution with load balancers应用的时候带有负载均衡的警告 .
net.ipv4.tcp_tw_reuse1This allows reusing sockets in 对于新连接, 这允许TIME_WAIT state for new connections when it is safe from protocol viewpoint. Default value is 0 (disabled). It is generally a safer alternative to 状态重用 Sockets, 从协议视角来说当它是安全时. 默认值为 0 (禁用). 它通常是tcp_tw_recyclerecycle的一个安全替换. The tcp_tw_reuse setting is particularly useful in environments where numerous short connections are open and left in TIME_WAIT state, such as web servers and 设置通常是非常有用的, 在如下的环境 有大量的短连接打开, 留在了TIME_WAIT 状态, 例如 web servers 和 loadbalancers.
net.ipv4.tcp_window_scaling1Turn on 开启 window scaling which can be an option to enlarge the transfer window, 它是一个选项扩大传输窗口:

另外, 增加传输队列的大小也能够帮助提升 TCP 吞吐量. 添加如下的命令到 /etc/rc.local 来完成.

/sbin/ifconfig eth0 txqueuelen 10000

NOTE: substitute the appropriate adapter name for eth0 in the above example注意: 替换合适的网卡适配器名称 eth0 在上面例子中.