Timeout connects too many solutions after using PHP to connect to Redis

Source: Internet
Author: User
Tags php redis

This problem, you will definitely encounter after using PHP Redis. Therefore, this dish in the principle of open-minded advice, but also around the internet for advice. The answers are the following two kinds:

1, Redis does not actively close.

After the discovery, this answer is purely baseless assertion, nonsense.

2, configure the/etc/sysctl.conf, change the following configuration:

Net.ipv4.tcp_syncookies = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_fin_timeout = 20

On this plan, although more reliable, but not exactly the bull's eye. After executing the/sbin/sysctl-p, the connection to the Timewait state was found to be not improved.

After a search, finally the dish finally found the cause, the solution is configured as follows:

/etc/sysctl.conf

Net.ipv4.tcp_syncookies = 1

Net.ipv4.tcp_tw_reuse = 1

Net.ipv4.tcp_tw_recycle = 1

Net.ipv4.tcp_timestamps = 1

Net.ipv4.tcp_fin_timeout = 20

After the configuration is complete, perform/sbin/sysctl-p and run Redis again for problem resolution.

Data reference:

http://www.2cto.com/net/201503/381132.html Server TCP connection timewait too much optimization and detailed analysis

Timeout connects too many solutions after using PHP to connect to Redis

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.