TCP keepalive options

Source: Internet
Author: User

The TCP keepalive option has been incorrectly understood,

Assume that after so_keepalive and related parameters are set through the setsockopt function, the socket uses the configured keepalive related parameters.

Otherwise, use the default keepalive configuration (as follows)

[Email protected]:/# sysctl-A | grep keep
Net. ipv4.tcp _ keepalive_intvl = 30
Net. ipv4.tcp _ keepalive_probes = 9
Net. ipv4.tcp _ keepalive_time = 90

Today, I suddenly found that there are a lot of dead connections on the redis server (many of them were connections a few months ago). I checked the configuration and didn't set the keepalive option. The default value is, 9, 75)

After Google queries that the keepalive option is enabled, the system only configures the value after keepalive is enabled by default;

"Remember that keepalive support, even if configured in the kernel, is not the default behavior in Linux. Programs must request keepalive control for their sockets usingSetsockoptInterface. There are relatively few programs implementing keepalive, but you can easily add keepalive support for most of them following the instructions explained later in this document ."

 

See: http://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/ for details

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.