Hiredis timeout with lots of concurrent requests

I am using the redis integration plugin for Varnish called libvmod-redis . I see a problem when, if I get a large number of simultaneous requests, about 350, redis starts the countdown, and I end up with segfault in Varnish.

I get the following errors:

varnishd[27892]: Child (27893) said redis error (connect): Connection timed out varnishd[27892]: Child (27893) said redis error (command): err=1 errstr=Connection timed out varnishd[19528]: Child (19529) said redis error (command): err=1 errstr=select(2): Invalid argument varnishd[19528]: Child (19529) said redis error (command): err=1 errstr=Connection timed out varnishd[19528]: last message repeated 9 times varnishd[19528]: Child (19529) said redis error (command): err=1 errstr=select(2): Invalid argument varnishd[19528]: Child (19529) said redis error (connect): fcntl(F_GETFL): Bad file descriptor varnishd[19528]: Child (19529) said redis error (command): err=1 errstr=fcntl(F_GETFL): Bad file descriptor kernel: [282284.005658] varnishd[19727] general protection ip:7f1f9dea1427 sp:7f1f4123c120 error:0 in libhiredis.so.0.10[7f1f9de9f000+9000] 

My timeout is 1 second and I am using ElastiCache node for Redis. I wonder what exactly may be unsuccessful here. I am not an expert in C, so I feel that something is missing.

+6
source share
2 answers

It would be interesting to see the code, especially around select . Since you have many simultaneous requests, you better check the correctness of file descriptors: it is possible that they are closed during the process ...

+1
source

You can try the following:

  • To get started, try with redis-cli -latency if the problem is the Redis server. If redis-cli does not have a delay problem from his point of view, the problem is with the client.
  • If the problem is with the server, you can follow this guide: http://redis.io/topics/latency
+1
source

All Articles