You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Geode 网络配置最佳实践

介绍

Geode is a data management platform that provides real-time, consistent access to data-intensive applications throughout widely distributed cloud architectures. Geode pools memory, CPU, network resources, and optionally disk storage across multiple processes to manage application objects and behavior. It uses dynamic replication and data partitioning techniques to implement high availability, improved performance, scalability, and fault tolerance. In addition to being a distributed data container, Geode is an in-memory data management system that provides reliable asynchronous event notifications and guaranteed message delivery.

Due to Geode’s distributed nature, network resources can have a significant impact on system performance and availability. Geode is designed to be fault tolerant and to handle network disruptions gracefully. However, proper network design and tuning are essential to achieving optimum performance and High Availability with Geode.

目的

The purpose of this paper is to provide best practice recommendations for configuring the network resources in a Geode solution. The recommendations in this paper are not intended to provide a comprehensive, one-size-fits-all guide to network design and implementation. However, they should serve to provide a working foundation to help guide Geode implementations.

范围

本章节所讲的话题与网络组件的设计和配置有关. 将介绍如下的话题:

  • 网络架构的目标
  • NIC网卡选择和配置
  • 交换机配置参考
  • 通用的网络基础设施参考
  • TCP vs. UDP 协议参考
  • Socket 通信和 Socket Buffer 设置
  • TCP 设置, 拥塞控制, 窗口扩展, 等.

对象

This paper assumes a basic knowledge and understanding of Geode, virtualization concepts and networking. Its primary audience consists of:

  • Architects: who can use this paper to inform key decisions and design choices surrounding a Geode solution
  • System Engineers and Administrators: who can use this paper as a guide for system configuration

Geode: 快速回顾

概要介绍

A Geode distributed system is comprised of members distributed over a network to provide in-memory speed along with high availability, scalability, and fault tolerance. Each member consists of a Java virtual machine (JVM) that hosts data and/or compute logic and is connected to other Geode members over a network. Members hosting data maintain a cache consisting of one or more Regions that can be replicated or partitioned across the distributed system. Compute logic is deployed to members as needed by adding the appropriate Java JAR files to the member’s class path.

使用 Geode 的公司:

  • Reduced risk analysis time from 6 hours to 20 minutes, allowing for record profits in the flash crash of 2008 that other firms were not able to monetize.
  • Improved end-user response time from 3 seconds to 50 ms, worth 8 figures a year in new revenue from a project delivered in fewer than 6 months.
  • Tracked assets in real time to coordinate all the right persons and machinery into the right place at the right time to take advantage of immediate high-value opportunities.
  • Created end-user reservation systems that handle over a billion requests daily with no downtime.

Geode 通信

Geode 成员使用 TCP, UDP 单播和 UDP 多播相结合的方式进行成员之间的通信. Geode 成员与其他成员之间维护着经常性通信 , 为了分发数据和管理整个分布式系统.

成员发现通信

Peer 成员发现是什么定义了一个 分布式系统. 所有的应用和使用了相同配置的缓存服务器, 在同一个分布式系统当中互相发现. 每一个系统成员都有一个唯一的ID, 知道其他成员的 ID 号. 一个成员只能属于一个分布式系统. 一旦它们之间互相发现, 成员即可直接互相通信, 从而独立于发现机制. 在Peer 发现中, Geode 使用了一个成员关系协调器来管理成员加入和离开分布式系统. 主要有两个发现选项: 使用多播和使用 Locators.

  • UDP/IP Multicast  新的成员使用多播地址和端口广播它们的连接信息到所有运行的成员. 现有的成员响应并建立与新成员的通信.
  • Geode Locators Using TCP/IP Peer locators 管理一个分布式成员的动态列表. 新的成员连接到一个Locator 来查询成员列表, 然后加入到分布式系统中.

通用的消息和 Region 操作通信

Geode 支持 TCP, UDP 单播 或 UDP 多播的通信方式来分发消息和执行 Region 操作. 默认情况是TCP. 然而, Geode 也能够配置使用 UDP.

Geode 拓扑

Geode 成员可以配置成多种拓扑结构来提供一个非常灵活的解决方案. 如下的章节总结了以下几种拓扑结构.

P2P 拓扑结构

P2P 拓扑结构是最基本的 Geode 部署网络结构. 在这个配置中, 每一个成员直接与分布式系统中其他的成员进行通信. 新的成员广播它们的连接信息到所有运行的成员. 现有的成员响应新成员的建立连接的请求. 此配置一个典型的例子是在一个应用服务器集群中, 一个应用实例与一个Geode 服务器位于同一个 JVM 上. 此配置如下图所示.

Peer to peer image

客户端-服务器拓扑

客户端-服务器拓扑是 Geode 安装最通用的一种拓扑结构. 在这个配置中, 应用与Geode服务器进行通信使用Geode 客户端. Geode 客户端由一些代码组成, 与应用在相同的进程中. 客户端定义了一个连接池来管理 Geode 服务器的连接, 也能提供一个本地缓存来为应用管理数据. 新的Geode 服务器启动将联系一个 locator 用于加入分布式系统, 同时添加到成员关系视图中. 在一个 Geode 系统服务器中 Locator 用于协调整个系统的成员关系, 同时提供Geode客户端请求的负载均衡. 此配置如下图所示.

注意: 本文章主要关注于拓扑结构的网络配置.

Client server topology

Geode 网络特性

Geode 是一个分布式内存数据平台, 用于提供高性能地, 高标准的可靠性. 在大多数部署配置中, Geode 最网络资源做了扩展性地利用, 如数据分布, 系统管理和客户端请求处理. 结果, 网络性能和可靠性都有比较大的影响.

有了获得最优化的性能, 网络需要展示以下方面的特点.

低延时

延时问题涉及到在跨网络处理数据过程中的各种类型的延时. 这些延时包括:

  • 广播延时 – 这与网络传播距离有关, 数据跨网络到达目的地,  和信号通过的中介地. 延时范围从本地网络(LAN)的纳秒到微秒延时, 到卫星通信系统的0.25秒延时.
  • 传输延时 – 这些延时是发送所有数据包的比特流到链接网络层所需要的时间, 这是一个包长度和链接层速率的问题. 例如, 为了传输一个10 Mb 文件跨 1 Mbps 链接层将需要10秒中, 而跨 100 Mbps 链接层只需要 0.1 秒.
  • 处理延时 – 这个延时是处理包头, 检查比特级错误, 确定包的发送目的地的所花时间. 在高速路由环境处理延时基本是最小的. 然而, 对于网络处理复杂加密或深度包检测, 处理延时还是比较大的. 另外, 处理 NAT 的路由器也有高于正常处理的延时, 因为这些路由器都需要检查, 和修改输入和输出包.
  • 队列延时 – 这些延时都是路由队列所消耗的时间. 网络设计的实际情况是一些队列延时将出现. 有效的队列管理技术是关键的, 可以保障高优先级的流量体验.

最佳实践

It should be noted that latency, not bandwidth, is the most common performance bottleneck for network dependent systems like websites. Therefore, one of the key design goals in architecting a Geode solution is to minimize network latency. Best practices for achieving this goal include:

  • Keep Geode members and clients on the same LAN Keep all members of a Geode distributed system and their clients on the same LAN and preferably on the same LAN segment. The goal is to place all Geode cluster members and clients in close proximity to each other on the network. This not only minimizes propagation delays, it also serves to minimize other delays resulting from routing and traffic management. Geode members are in constant communication and so even relatively small changes in network delays can multiply, impacting overall performance.
  • Use network traffic encryption prudently Distributed systems like Geode generate high volumes of network traffic, including a fair amount of system management traffic. Encrypting network traffic between the members of a Geode cluster will add processing delays even when the traffic contains no sensitive data. As an alternative, consider encrypting only the sensitive data itself. Or, if it is necessary to restrict access to data on the wire between Geode members, consider placing the Geode members in a separate network security zone that cordons off the Geode cluster from other systems.
  • Use the fastest link possible Although bandwidth alone does not determine throughput - all things being equal, a higher speed link will transmit more data in the same amount of time than a slower one. Distributed systems like Geode move high volumes of traffic through the network and can benefit from having the highest speed link available. While some Geode customers with exacting performance requirements make use of InfiniBand network technology that is capable of link speeds up to 40Gbps, 10GbE is sufficient for most applications and is generally recommended for production and performance/system testing environments. For development environments and less critical applications, 1GbE is often sufficient.

高吞吐量

另外对于低延时来讲, Geode 系统的网络需要有高吞吐量. ISPs 和 FCC 经常使用术语'带宽'和'速度', 虽然它们并不是一回事. 事实上, 带宽只是众多影响因素之一. 因此, 更准确地说

带宽描述了一个网络能力, 通常情况下以 bit/s 来表示. 更进一步地, 带宽涉及到数据传输速率 (bits/s) , 通过一个网络连接或接口来支持. 吞吐量,经常是小于网络的全部传输能力. 吞吐量, 可用的链接带宽, 可能受以下的因素影响:

  • 协议低效 – TCP 是一个适配协议, 搜寻在网络资源上的负载均衡需求,  高效利用如下的网络基础设施. TCP 检测和响应了当前的网络条件, 使用几种反馈机制和算法. 机制和算法是经年累月形成的, 但是核心的原理是不变的: 
    ++ 所有的 TCP 连接使用三次握手开始, 这就引入了延时和 TCP 连接创建开销 
    ++ 默认情况下, TCP 慢启动被应用到每一个新建连接. 这就意味着连接并不会立即使用链路层的全部容量. 需要达到一个特定的吞吐量状态所需的时间=客户端服务器之间环回时间+初始化拥塞 窗口大小. 
    ++ TCP 流控和拥塞控制调节所有 TCP 连接的吞吐量. 
    ++ TCP 吞吐量通过当前的拥塞窗口大小来管理.
  • 拥塞 – 当一个链路或节点被加载到这个点时, QoS 性能降级, 此时拥塞就会发生. 典型的影响包括队列延迟, 包丢失或新的连接阻塞. 结果, 在一个拥塞网络上累计增加的负载可能导致网络吞吐量的丧失. 在极端情况下, 网络可能遭遇一个拥塞崩溃,  在拥塞负载消除之后, 吞吐量又恢复了正常,  使得网络不可用. 这种情况初次被John Nagle 在 1984 年提出, 到了 1986 年, DoD 的 ARPANET 已经遇到了这种情况– 互联网的鼻祖, 世界第一个包交换网络. 这些问题使得网络能力持续下降, 在一些场景下, 网络吞吐量下降了1000倍! 现代网络使用了流控, 拥塞控制, 和拥塞避免技术来避免拥塞崩溃. 这些技术包括: 潜在补偿, TCP Window 减少 , 公平队列设备如 路由器. 包优先级是另外一个方法用于最小化拥塞的影响.

最佳实践

Geode 系统经常调用来处理高通量事务流量, 通过网络流入大量的流量. 结果, 那么 Geode 架构主要的设计目标就是最大化网络吞吐量.

达到这一目标的最佳实践如下:

  • 增加 TCP’s 初始拥塞窗口 – 一个大的开始拥塞窗口允许 TCP 传输更多的数据, 显著增强了窗口的增长 – 对于突发的短时连接, 这是一个特别关键的优化.
  • 禁用 TCP Slow-Start After Idle Disabling 在 Idle 状态之后的慢启动将影响 TCP 长连接的性能, 在突发性传输数据的情况下.
  • 启用 Window Scaling (RFC 1323) 启用 窗口扩展将增加最大接收窗口大小, 允许高延迟连接来达到更好的吞吐量.
  • 启用 TCP 低延时 启用 TCP 低延时将有效地告知 OS为了低延时牺牲吞吐量. 对于延时敏感的工作负载, 如 Geode, 这是一个性能与速度之间的平衡点.
  • 启用 TCP Fast Open 启用TCP Fast Open (TFO), 允许应用数据在初始的SYN包中发送出去, 在特定的情况之下. TFO 是一个新的优化, 需要客户端和服务器都支持此功能, 可能并不是所有 OS 都支持这一特性.

容错设计

另一个网络特点在于最优的 Geode 性能是容错. Geode 操作依赖于网络服务, 网络故障对于Geode系统操作和性能有比较重要的影响. 而容错网络设计超出了本章所介绍的范围, 当在设计 Geode 解决方案时, 有一些比较重要的考虑. 对于本章的目的, 这些考虑通过网络三层架构设计来体现, 如下图所示:

Fault tolerance diagram

此模型使用典型的三层架构来设计网络, 以可扩展的模块化构建块或层级来表示网络. 在设计 Geode 系统时, 网络容错考虑如下设置:

  • 接入层冗余设计 – 接入层是第一个入口点进入到网络边界设备和主机设备, 如 Geode 服务器. 对于Geode 系统, 在接入网络层中应该有属性来支持高可用, 包括: 
    ++ Operating system 高可用特性, 例如 Link Aggregation (EtherChannel or 802.3ad), 提供了更高效的带宽和弹性, 减少了复杂度. 
    ++ 默认的网关冗余, 使用了双连接到冗余系统 (汇聚层交换机) , 此交换机使用 Gateway Load Balancing Protocol (GLBP), Hot Standby Router Protocol (HSRP), 或者 Virtual Router Redundancy Protocol (VRRP). 这提供了故障快速切换的高可用性. 
    ++ Switch 容错, 使用一些Split Multi-Link Trunking (SMLT). 使用 SMLT 不仅允许在汇聚层流量跨所有链路是负载均衡的, 而且还允许流量当链路或交换机发生故障时进行快速重分布. 通常情况, 任意一个模块故障将导致无流量, 0.5秒之内 (正常情况下小于 100 毫秒).
  • 汇聚层冗余设计 – 汇聚层网络聚合接入层的节点, 在接入层发生故障之后, 创建容错边界来提供逻辑隔离点. 高可用源自汇聚层到核心层、汇聚层到接入层的双冗余链路设计. 此网络层通常被设计用于高可用, 不需要为 Geode系统做更改.
  • 核心层冗余设计 – 核心层作为骨干网提供网络服务. 核心层需要极快地弹性, 因为所有的网络访问都依赖于它连接. 在核心层使用 L3交换机环境物理硬件增强和 P2P 的互联. 这个核心层被设计成高可用层, 此网络层通常被设计用于高可用, 不需要为 Geode系统做更改.

最佳实践

Geode 系统依赖于网络服务, 网络故障对于Geode系统操作和性能有比较重要的影响. 结果, 网络容错对于 Geode 解决方案来说是一个重要的设计目标. 能够达到此目标的最佳实践包括如下:

  • 使用 Mode 6 的NIC网卡绑定 – NIC 绑定涉及到多个网络连接并行化, 为了增加吞吐量和提供冗余, 防止链路单点故障. Linux 支持6种链路聚合的模式: 
    ++ Mode 1 (主备模式) 在此模式中只有一个备用网卡是运行的. 如果只有一个备用网卡失效了, 那么另外一个备用网卡将成为活跃网卡. 
    ++ Mode 2 (balance-xor) 在此模式中一个备用网卡被选择用于传输, 基于一个简单的XOR计算, 这个计算决定哪个备用网卡可以使用. 此模式提供了负载均衡和容错功能. 
    ++ Mode 3 (broadcast) 此模式在所有的备用网卡接口传输数据. 此模式提供了容错. 
    ++ Mode 4 (IEEE 802.3ad) 此模式创建了聚合组,共享了相同的速度和双工设置, 根据 802.3ad 规范在聚合器上利用所有的备用网卡. 
    ++ Mode 5 (balance-tlb) 此模式根据每个备用网卡的负载情况分发输出流量. 一个备用网卡接收输入流量. 如果备用网卡故障, 另外一个备用网卡接管此故障网卡的 MAC 地址. 
    ++ Mode 6 (balance-alb) 此模式包括 balance-tlb + receive load balancing (rlb), 对于 IPV4 流量来说, 同时不需要任意特定的交换机支持. 接收负载均衡通过 ARP 协商来达到. 绑定驱动器中断了通过本地系统发出的 ARP 回应,  覆盖源硬件地址, 带有备用网卡的唯一设备地址, 例如不同的节点使用不同的硬件地址.

对于 Geode 系统, 推荐使用 Mode 6 方式. Mode 6 NIC 绑定 (Adaptive Load Balancing) 提供了链路聚合和容错. Mode 1 只提供容错, 而Mode 2, 3, 4 需要链接聚合组位于同一个逻辑交换机, 它也可能引入单点故障, 当物理交换机的链路掉线时.

  • 使用 SMLT 作为交换机冗余 – the Split Multi-link Trunking (SMLT) 协议允许多个以太网链路跨多个交换机进行拆分, 防止任何的单点故障, 同时允许交换机跨多个汇聚交换机是负载均衡的. SMLT 提供了增强级弹性能力, 亚秒级故障切换和亚秒级恢复, 对于全线速的Trunks链路, 操作对于终端设备是透明的. 这允许负载共享的高可用网络, 满足5个9的高可靠需求.

Geode 网络设置

为了达到低延时、高吞吐量、容错的目标, OS 的网络设置和 Geode 将需要合理地配置. 如下章节是官方推荐的配置.

IPv4 vs. IPv6

默认情况下, Geode 使用 IPv4. 通过测试 Geode 表明 IPv4 的性能要优于 IPv6. 因此, 通用的推荐是使用带有 Geode 的 IPv4. 然而, 如果需要的话, Geode 也能配置使用 IPv6. 一旦使用 IPv6 , 请确保所有的 Geode 进程都使用 IPv6. 不要使用IPv4 和 IPv6 混合地址.

注意: 对于 Geode 地址使用 IPv6, 设置如下的 Java 属性: java.net.preferIPv6Addresses=true

TCP vs. UDP

Geode 支持TCP和 UDP 两种通信方式. 依赖于 Geode 系统的大小和特性, 以及 Region 的类型来选择 TCP 还是 UDP 通信.

TCP 通信

TCP (Transmission Control Protocol) 提供了可靠的顺序投递系统消息. 默认情况下, Geode 使用TCP来进行内存交换的 P2P 通信. 在如下的场景, TCP 比 UDP 更合适:

  • 对于分布式系统来讲, 分区数据利用分区 Regions, TCP 通常是一个更好地选择, 当 TCP 提供比 UDP更可靠的通信和更好的性能.
  • 相对于 UDP Unicast 而言, TCP 更适合中小型分布式系统, 因为它在 OS 层面比 UDP实现了更可靠的通信, 性能比 UDP 更快.
  • 未预测的网络负载 TCP 提供比 UDP更高水平的容错和可靠性. 而 Geode 实现了重传协议用于保障 UDP 的可靠传输, 对于重度拥塞和不可预测的峰值, UDP 还是不能完全补偿.

注意: Geode 通常使用 TCP 通信在成员故障检测方面. 在这种情况下, Geode 将尝试建立一个与可疑成员的 TCP/IP 连接, 为了确定是否有成员已经失败.

UDP 通信

UDP (User Datagram Protocol) 是一个无连接协议, 比 TCP 使用更少的资源. 然而, UDP 有一些重要的限制将会在设计的时候充分考虑:

  • 64K 字节消息大小限制 (包括消息头开销)
  • 在拥塞网络上有更慢的性能
  • 可靠性有限 (Geode 通过'重传协议'来进行补偿)

如果一个Geode 系统能够在 UDP 的限制下运行, 那么在如下的场景下它比 TCP 更合适:

  • 同步模式 所有成员或大多数成员都使用相同的复制 Regions, UDP 多播可能是最合适的选择. UDP 多播提供了一个高效分发所有事件的机制. 然而, 当开启多播模式时, 分布式系统中的所有进程都接受 Region 的所有事件. 因此, 多播仅适用于 所有的成员都有 Region 定义, 成员对于所有的Region事件都是感兴趣的.

注意: 甚至 当 UDP 多播被用于一个 Region 时, Geode 将发送单播消息. 同时, 对于大多数操作, Partitioned Regions 将使用 UDP 单播协议.

  • 更大的分布式系统规模

随着分布式系统规模的增长, UDP 的开销相对较小是更好的选择. TCP 添加新的线程和套接字到每个成员, 当系统增长时, 导致更多的开销.

注意: 为了配置 Geode 来使用 UDP 对于内存交换的 P2P 消息, 设置如下的 Geode 属性: disable-tcp=true

TCP 设置

下面的章节提供了推荐的 TCP 设置.

Geode 的TCP/IP 通信设置
  • Socket Buffer 大小确定 Buffer 大小设置, 目标是在通信和其他处理之间做出平衡. 更大的 Socket Buffers  允许 Geode 成员来快速分发数据和事件, 但是也减少了内存可用率. 在一些情况下, 特别是当保存非常大的数据对象时, 找到正确的Socket Buffer 大小对于系统性能是很关键的.

理想情况下, 对于任何的数据对象分发来说, Socket Buffers 应该足够大. 这将要避免消息分片, 性能会更低. Socket Buffers  至少应该和最大的数据对象一样大, 带着 keys值和一些消息头开销 - 100 bytes 应该足够大了.

如果可能的话, TCP/IP Socket Buffer  设置应该匹配 Geode 的设置. 参见如下指导.

++ P2P. 在gemfire.properties属性中, Socket-Buffer-size  设置应该在分布式系统中是相同的.

++ Client/server. 客户端的池 Socket-Buffer size 应该匹配服务器的池所使用的设置.

++ Server. 在服务器的cache.xml 文件中, 服务器的 Socket-Buffer size  应该匹配客户端所定义的值.

++ Multisite (WAN). 如果数据中心站点之间链路没有被优化, 它可能导致消息在队列中备份. 如果一个接收队列 Buffer 溢出, 它将发送者不同步, 而接受者不知道这个情况. 一个网关发送者的 socket-buffer-size 应该匹配网关接受者的 socket-buffer-size.

注意: OS TCP buffer size 限制必须足够大来调节  Geode Socket Buffer  的设置. 如果不是, Geode 的值将设置到 OS 限制 – 而不是请求的值.

  • TCP/IP Keep Alive

Geode 支持 TCP KeepAlive 来防止 Socket 连接超时.

gemfire.enableTcpKeepAlive 系统属性放置空闲的连接发生超时 (例如, 通过一个防火墙.) 当配置设置为 true 时, 对于每个 Sockets 来说, Geode 启用了 SO_KEEPALIVE 选项. OS级别的设置允许 Socket 发送验证检查 (ACK requests) 到远程系统为了确定是否保持socket 连接是活跃的.

注意: 对于发送第一个 ACK KeepAlive 请求的时间间隔, 后续的 ACK 请求和请求数量 在关闭 Socket 之前进行发送.

默认情况下, 此系统属性被设置为 true.

  • TCP/IP Peer-to-Peer 握手超时

此属性管理时间量,  一个 Peer 将等待完成 TCP/IP 握手处理. 你能够更改连接握手超时时间, 带有系统属性p2p.handshakeTimeoutMs 的 TCP/IP 连接.

默认设置是 59,000 milliseconds (59 seconds).

对于一个 Java 应用来说, 此设置握手超时到  75,000 毫秒:

-Dp2p.handshakeTimeoutMs=75000

此属性可以通过命令行来设置:

 gfsh>start server --name=server1 --J=-Dp2p.handshakeTimeoutMs=75000 
Linux TCP/IP通信设置

如下的表总结了推荐的 TCP/IP 设置. 这些设置位于 /etc/sysctl.conf 文件

设置推荐值基本原理
net.core.netdev_max_backlog30000Set maximum number of packets, queued on the INPUT side, when the interface receives packets faster than kernel can process them. Recommended setting is for 10GbE links. For 1GbE links use 8000.
net.core.wmem_max67108864Set max to 16MB (16777216) for 1GbE links and 64MB (67108864) for 10GbE links.
net.core.rmem_max67108864Set max to 16MB (16777216) for 1GbE links and 64MB (67108864) for 10GbE links.
net.ipv4.tcp_congestion_controlhtcpThere seem to be bugs in both bic and cubic (the default) for a number of versions of the Linux kernel up to version 2.6.33. The kernel version for Redhat 5.x is 2.6.18-x and 2.6.32-x for Redhat 6.x
net.ipv4.tcp_congestion_window10This is the default for Linux operating systems based on Linux kernel 2.6.39 or later.
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.
net.ipv4.tcp_keepalive_interval30This 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.
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 tcp_keepalive_time seconds, and after that try tcp_keepalive_probes times to send a TCP KEEPALIVE in intervals of tcp_keepalive_intvl seconds. If the retry attempts fail, the socket times out.
net.ipv4.tcp_low_latency1Configure TCP for low latency, favoring low latency over throughput
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 time-wait socket is immediately destroyed and warning is printed. This limit exists to help prevent simple DoS attacks.
net.ipv4.tcp_no_metrics_save1Disable caching TCP metrics on connection close
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 - 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 32MB
net.ipv4.tcp_wmem10240 131072 33554432Setting is min/default/max. Recommed increasing the Linux autotuning TCP buffer limit to 32MB
net.ipv4.tcp_sack1启用 选择确认
net.ipv4.tcp_slow_start_after_idle0By default, TCP starts with a single small segment, gradually increasing it by one each time. This results in unnecessary slowness that impacts the start of every request.
net.ipv4.tcp_syncookies0Many default Linux installations use SYN cookies to protect the system against malicious attacks that flood TCP SYN packets. The use of SYN cookies dramatically reduces network bandwidth, and can be triggered by a running Geode cluster. If your Geode cluster is otherwise protected against such attacks, disable SYN cookies to ensure that Geode network throughput is not affected. 
NOTE: if SYN floods are an issue and SYN cookies can’t be disabled, try the following: 
net.ipv4.tcp_max_syn_backlog="16384"
net.ipv4.tcp_synack_retries="1" 
net.ipv4.tcp_max_orphans="400000"
net.ipv4.tcp_timestamps1Enable timestamps as defined in RFC1323:
net.ipv4.tcp_tw_recycle1This enables fast recycling of TIME_WAIT sockets. The default value is 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 tcp_tw_recycle. 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 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.

 

  • No labels