Hi!
在 2012年12月13日星期四UTC+8下午1时28分59秒,agentzh写道:
Hello!2012/12/12 Demon:
> 我在使用resty-redis时候遇到这些问题, 2和3在redis2中没有发生.
>
> 1. 是否应该关闭proxy_buffing
明白了!
proxy_buffering 这个配置与 lua-resty-redis 没有任何关系,它仅影响 ngx_proxy 模块。
> 2. 在高并发时候会出现很多 lua tcp socket read timed out, 是否可以通过哪些配置来消灭这个.
1. 请确认你正确地调用了 resty.redis 对象的 set_keepalive 方法启用了 Redis 连接池;
我可以肯定我正确的使用了set_keepalive
2. 请确认你的 timeout 设置没有过小;
net.ipv4.tcp_max_tw_buckets = 3000 这个大小可以么?
3. 请确认你的网络链路状良好;
网络可以确认没有问题。
4. 请确认你的 redis 服务器没有过载(如果过载了,请启用多个 redis 后端并对它们作 sharding)。
后端的几十个redis实例都检查过,没有过载现象。
> 3. 高并发时候前端php的curl会爆Failure when receiving data from the peer和couldn\'t
> connect to host错误, 以前可否遇到过?
>
1. 由于 php curl 没有连接池的功能,所以高并发下容易把你的 php 所在机器的临时端口耗尽;
检查过, php机器上的net.ipv4.tcp_max_tw_buckets都有设置,不会有2w+个端口同时存在的现象。
2. 请确认你的 nginx 的 listen 的 backlog 参数值设置足够大,以免发生因为 accept 队列溢出而导致 SYN
包丢弃。同时可以监视你的 nginx 所在机器的 CPU 使用率。
说到backlog, 昨天有个很有意思的现象,当我设置了listen的backlog=255442时,会马上抛出Failure when receiving data from the peer, 去掉以后过很久才会抛出。
Best regards,
-agentzh