We are currently experiencing a lot of Redis errors with the message
Unable to connect: read error on connection, trying next server
We run Redis on FreeBSD using PHP Redis and we have a hard time reproducing the error on Ubuntu so this might be a hint. There's a long-running issue on that topic on github.
Basically we get a socket from the operating system with a call to connect(host, port, timeout)
in phpredis, but when we do a select(db_index)
afterwards, we get an exception.
Could there be an issue with persistance? I assume that connect does nothing in the background and select tries to access the connection, which is actually closed.
We don't run into a timeout. We tried tuning TIME_WAIT without success.
Any other ideas on where the problem might come from? What is the best way to track the issue down? dtrace maybe?
Update
We are currently looking into our BGSAVE settings. Interestingly it takes half a second and more to create a fork for the process which regularly writes the data to disk (persistence) and maybe redis can't respond to connect()
requests during that timespan.