Home >Backend Development >PHP Tutorial >php memcached extension timeout problem_PHP tutorial

php memcached extension timeout problem_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:57:331301browse

When using the memcached extension in php to access memcached, when the memcached server cannot connect normally, the request response will be slowed down under the default settings. Note: Failure to connect normally refers to network failure, such as the inability of two servers to communicate. As long as the ping is successful, even if the memcached service is not turned on or down, the response time will not be affected, but memcached will not start.

The timeout setting is controlled by the constant Memcached::OPT_CONNECT_TIMEOUT. The default is 4000 milliseconds (the official PHP website shows 1000, and my test versions 1.0.2 and 2.0.1 are both 4000). In addition, there is a big difference between 1.0.2 and 2.0.1. 1.0.2 will connect to the memcached server when executing addServer, and it takes 2 times the timeout time to execute the command. Therefore, when memcached cannot connect, the time spent is 3 times the timeout time.

2.0.1 seems to have a bug in PHP 5.2 and cannot be used. For details, please refer to: https://bugs.php.net/bug.php?id=61283.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632076.htmlTechArticleWhen using the memcached extension in php to access memcached, when the memcached server cannot connect normally, a request will be made under the default settings Response becomes slower. Note: Failure to connect normally means network failure...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn