Maison  >  Article  >  développement back-end  >  php memcached 扩展 timeout 问题_PHP教程

php memcached 扩展 timeout 问题_PHP教程

WBOY
WBOYoriginal
2016-07-13 10:57:331245parcourir

php 中使用memcached扩展来访问memcached时,当memcached服务器无法正常连接,在默认设置下会造成请求响应变慢。注意:无法正常连接指网络故障,如两台服务器无法进行通信等,只要能ping通,就算memcached服务没有开启或down掉,不会影响响应时间,只是memcached没有启作用。

设置timeout时间通过常量Memcached::OPT_CONNECT_TIMEOUT来控制,默认是4000毫秒(php 官网显示1000,我测试版本1.0.2和2.0.1都是4000)。另外1.0.2和2.0.1还有很大差别。1.0.2在执行addServer时就会连接memcached服务器,而且执行命令时候需要2倍的timeout时间,所有当memcached无法连接时候,花费时间是3倍的timeout时间。

2.0.1在php 5.2中似乎有bug,无法使用,具体参看:https://bugs.php.net/bug.php?id=61283。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632076.htmlTechArticlephp 中使用memcached扩展来访问memcached时,当memcached服务器无法正常连接,在默认设置下会造成请求响应变慢。注意:无法正常连接指网络故障...
Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn