Redis broken pipe error

This may be offtopic because redis is not something Cleavr made, created or supports. But we do like to share, maybe other people who use Redis also experience this issue.

The issue we have is with WordPress sites running on php 7.4 <> 8.1 with Mysql, Nginx and Redis (all @ Hetzner on AMD machines with dvcpu’s)

The issue is that for large webshops we are getting ‘redis server unavailable’ errors and after switching the redis error logging to debug we found that these errors every time it occurs:

image

When this happens php will also throw an error like:

“PHP message: RedisException: read error on connection to 127.0.0.1:6379 in /xxx/yyy/domain.com/current/wp-content/object-cache.php:1973”

First observations:

  • redis database gets build up to aprox 9GB after 12 hours
  • when we flush redis the problems are gone for like 11 hours

Already tried to:

  1. change redis.conf for the timeout and tcp-keepalive (60/300)
  2. change php fpm settings
  3. changed max open files limit LimitNOFILE=10000
  4. mysqlconf optimized for innodb

We don’t have a solution yet, let us know if you also ever had this issue with redis broken pipes.

Hi,
not related to your issue…
Do you use the paid version of the Redis plugin? My experience is that the free plugin version doesn’t work well with WooCommerce.

@finalwebsites no we didn’t but we see that it does work perfect for some webshops, and for others it doesn’t

Still working on this issue, flushing redis now every 11 hours as a dirty fix. Will post it here as soon as we found the solution.

@yuluma hi, did you found the solution?

Hi @jheff

Yes, we hired an externa redis guru and they tested several things over a period of a week. The switch to unix sockets was - to my guess - the fix for the broken pipes.

unixsocket /var/run/redis/redis.sock
unixsocketperm 770

At this moment our settings for Redis look like this:

protected-mode yes
port 0
unixsocket /var/run/redis/redis.sock
unixsocketperm 770
daemonize no
supervised systemd
timeout 60
loglevel notice
logfile /var/log/redis/redis-server.log
databases 1
save ""
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
maxclients 10000
maxmemory 256mb
maxmemory-policy allkeys-lru
lazyfree-lazy-eviction yes
appendonly no