解决memcache连接奇慢问题一例
来源:互联网 发布:淘宝客服的重要性 编辑:程序博客网 时间:2024/04/27 12:54
最近用xdebug观察线上程序的运行时间统计,发现往日里跑起来像飞的memcache居然是系统中拖后腿的耗时大户,连接时间特长。
运行环境
- webserver是apache + php
- php memcache extension版本是3.0.2,当时是最新的beta版…
- 有4个memcache server可供使用
- 代码中会利用php的Memcache::addServer依次连接四个memcache,长连接方式
现象
完成四次addServer一共需要300ms以上,但是一旦连接上,获取单个item飞快,时间在3ms以下。
更可恶的问题在于,虽然执行了四次Memcache::addServer,但是实际使用的始终是最后一个memcache,这实在让人崩溃。
问题解决
使用了一点搜索技巧,在pecl.php.net上找到了类似的bug: First get slow when using multiple memcached servers
这个bug的描述如下:
We are monitoring memcached performance and noticed that when we added a second memcached via Memcache::addServer the first get request is always slower than the subsequent ones although we are using persitent memcached connections. Switching from crc32 to fnv hashing didn’t help either. Is that delay explainable
看起来是最新的memcache extension有一些问题,尝试将这个扩展降级成最新的稳定版2.2.6,然后重启apache看看,memcache连接过慢的问题果然已经解决。
结论
吃螃蟹果然是要付出代价的。。
- 解决memcache连接奇慢问题一例
- 解决memcache连接奇慢问题一例
- 解决eclipse下载插件奇慢的问题
- 解决MYSQL连接慢问题
- Session保存到Memcache中,解决读取数据慢问题
- 解决SSH连接速度慢的问题
- 解决oracle连接很慢问题
- linux中解决SSH连接慢问题
- 解决ssh连接特别慢的问题
- 解决oracle连接很慢问题
- Multi Index在vs2005下编译速度奇慢问题的解决
- Ubuntu无线网速奇慢的问题
- 解决ssh连接慢
- 解决linux ftp连接速度慢的问题!
- 解决linux ftp连接速度慢的问题!
- kip-name-resolve 解决局域网mysql连接慢的问题
- 糊里糊涂地就解决了远程桌面连接慢的问题!...
- 解决Win7远程桌面连接2003/xp慢的问题
- 图书商流系统简介
- VC中使用系统托盘
- PHP安装
- 不要过度迷信小型机
- html中的label标签
- 解决memcache连接奇慢问题一例
- 程序员兼职创收的新方法 - 依托平台开发应用
- HTML 静态页面制作遇到问题
- 精挑细选九句电影台词彻底搞定面试官
- 盛大独创游戏式管理,员工可给自己加薪
- Head First C# 中文版 图文皆译 第六章 继承 page245(244页是填词游戏,跳过)
- 组织一支 山寨 软件开发团队
- 分布式系统的十大误区
- 2009 中国软件技术英雄会