Drupal 站点 - Memcache 连接错误
我们正在努力调整我们的 drupal 网站。 我们使用 Siege 来衡量性能(作为 drupal 访问者)。
环境: Nginx + FastCGI+ Memcache
Siege 运行良好几秒钟,然后我们遇到连接错误: 示例:
HTTP/1.1 200 29.18 secs: 5877 bytes ==> /
HTTP/1.1 200 29.39 secs: 5877 bytes ==> /
warning: socket: -1656235120 select timed out: Connection timed out
warning: socket: -1673020528 select timed out: Connection timed out
使用相同的 Siege 测试配置,Nginx + FastCGI + Drupal Cache 似乎工作正常。 示例:
HTTP/1.1 200 1.41 secs: 5868 bytes ==> /
HTTP/1.1 200 1.40 secs: 5868 bytes ==> /
如您所见,除了连接错误之外,MemCache 的响应时间要长得多。
知道这里可能出了什么问题吗?为什么 Drupal 在负载下会抛出 memcache 错误?
Memcache 在单独的实例上运行。 为 MemCache 分配了 2GB 内存。
We are tying to perf tune our drupal site.
We are using Siege to measure performance (as drupal visitor).
Env:
Nginx + FastCGI+ Memcache
Siege runs fine for a few seconds, and then we run into connection errors:
Example:
HTTP/1.1 200 29.18 secs: 5877 bytes ==> /
HTTP/1.1 200 29.39 secs: 5877 bytes ==> /
warning: socket: -1656235120 select timed out: Connection timed out
warning: socket: -1673020528 select timed out: Connection timed out
Using the same Siege test confiuration, Nginx + FastCGI+ Drupal Cache seems to work fine.
Example:
HTTP/1.1 200 1.41 secs: 5868 bytes ==> /
HTTP/1.1 200 1.40 secs: 5868 bytes ==> /
As you can see, Response time is much higher with MemCache, in addition to the connection errors.
Any idea what could be wrong here... and why Drupal is throwing errors with memcache under load?
Memcache runs on a separate instance. Allocated 2GB memory for MemCache.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜测您的内存缓存连接已用完。 请每秒使用一个简单的脚本检查您的 memcached 安装。 然后开始攻城。 我猜你的 memcached 一段时间后就会停止响应。
测试 memcache php 脚本:
我猜测发生的情况是您没有禁用 memcache 中的持久连接,它们在 php 线程中徘徊。 Memcached 一次可以服务大约 1023 个,而这在围攻时可能还不够。
您还可以尝试 ab,apache 基准测试工具仔细查看
-c
开关。 尝试一下,看看结果在不同的值上如何变化。最后,您应该在 php 计算机上的 memcached 端口(通常为 11211)上运行
tcpdump
,以了解连接发生了什么情况。 drupal 会启动它们吗? 对方主机是否响应 RST 或者是否超时?memcached php 文档 api 中存在一个错误,表明默认情况下连接是非持久的。 默认情况下,它们是持久的(嗯,它们是在我遇到问题时)。
请随意评论这个答案,我会阅读评论并在必要时提供进一步的帮助。
I guess that You run out of memcached connections. Please run a check of Your memcached installation with a simple script every second. Then start Siege. I guess Your memcached stops responding after a while.
Test memcache php script:
What I guess is happening is that You have not disable the persistent connections in memcache and they hang around in the php threads. Memcached can serve ~1023 of them at a time and that might not be enough while Sieging.
You might also try ab, apache benchmarking tool with the close look to the
-c
switch. Play around with it and see how the results change on different values.Finally, You should run a
tcpdump
on Your memcached port (usually 11211) on the php machine to find out what is happening to the connections. Does drupal start them? Does the other host respond with a RST or does it time out?There was a bug in the memcached php documentation api that said that the connections are non-persistent by default. They are persistent by default (well, they were at the time I had the problem with it).
Feel free to comment this answer, I'll read the comments and assist further if necessary.