RedisException: read error on connection & Failed to read FastCGI header

[ad_1]

Hi I am new to Redis and have been using it for about 1 month now.

Recently the site has been freezing and not loading. Please can someone recommend how to prevent this from happening?

These are the errors from today in apache2/error.log

AH01071: Got error 'PHP message: RedisException: read error on connection to 127.0.0.1:6379 in /var/www/html/wp-content/object-cache.php
AH01067: Failed to read FastCGI header

Also here’s the syslog:

redis-server invoked oom-killer: gfp_mask=0x1100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
Out of memory: Killed process 1208953 (mysqld)

And php8.0-fpm.log

WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 35 idle, and 60 total children

As of today I’ve implemented what appears to be the common fixes for the RedisException error.

I have changed the Redis Connection Timeout from 1s to 0s via wp-config.php

define( 'WP_REDIS_TIMEOUT', 0 );

And updated php.ini default_socket_timeout from 60 to -1

default_socket_timeout = -1

Regarding the other error AH01067: Failed to read FastCGI header

I’ve lowered the PHP memory list to 128M

memory_limit = 128M

Since these changes the site hasn’t had any problems.

The site tends to not load when the admin is editing content.

I would like to know if there is more I can do?

To better solve the FastCGI header error I read upgrading the memory can help. I can get more memory if its required, I’m just not sure if it is?

If anyone else is in my situation. When the server did freeze I had to restart PHP FPM to get it working again. This is the command I used:

sudo service php8.0-fpm restart

My attempt to fix WARNING: [pool www] seems busy is also a guess. Here’s how the settings are:

pm.max_children = 150
pm.start_servers = 40
pm.min_spare_servers = 40
pm.max_spare_servers = 60
pm.max_requests = 500

If someone can advise it would be greatly appreciated it.

The website is on a DigitalOcean dedicated Droplet:

  • CPU-Optimized / 4 GB / 2 vCPUs / 50GB Disk

This is the Redis database cluster:

  • 1 GB RAM / 1vCPU / 10 GB Disk

If more memory is required should both the Droplet and Redis database increase its memory?

What is considered low diskspace? Would getting more help? From the Ubuntu SSH login screen:

Usage of /:   75.0% of 48.27GB
Memory usage: 81%
Swap usage:   44%
Processes:    177

From the “Diagnostics” info tab in the WordPress Redis Object Cache plugin:

Status: Connected
Client: PhpRedis (v5.3.7)
Drop-in: Valid
Disabled: No
Ping: 1
Errors: []
PhpRedis: 5.3.7
Relay: Not loaded
Predis: 2.1.2
Credis: Not loaded
PHP Version: 8.0.29
Plugin Version: 2.4.3
Redis Version: 7.0.11
Multisite: No
Metrics: Enabled
Metrics recorded: 2247
Filesystem: Working
Global Prefix: "wp_"
Blog Prefix: "wp_"
WP_REDIS_HOST: "127.0.0.1"
WP_REDIS_PORT: "6379"
WP_REDIS_DATABASE: 0
WP_REDIS_TIMEOUT: 0
WP_REDIS_READ_TIMEOUT: 1
WP_REDIS_PREFIX: "private"
WP_CACHE_KEY_SALT: "private"
WP_REDIS_PLUGIN_PATH: "/var/www/html/wp-content/plugins/redis-cache"
WP_REDIS_PASSWORD: ••••••••
Global Groups: [
    "blog-details",
    "blog-id-cache",
    "blog-lookup",
    "global-posts",
    "networks",
    "rss",
    "sites",
    "site-details",
    "site-lookup",
    "site-options",
    "site-transient",
    "users",
    "useremail",
    "userlogins",
    "usermeta",
    "user_meta",
    "userslugs",
    "redis-cache",
    "blog_meta"
]
Ignored Groups: [
    "counts",
    "plugins",
    "themes",
    "theme_json"
]
Unflushable Groups: []
Groups Types: {
    "blog-details": "global",
    "blog-id-cache": "global",
    "blog-lookup": "global",
    "global-posts": "global",
    "networks": "global",
    "rss": "global",
    "sites": "global",
    "site-details": "global",
    "site-lookup": "global",
    "site-options": "global",
    "site-transient": "global",
    "users": "global",
    "useremail": "global",
    "userlogins": "global",
    "usermeta": "global",
    "user_meta": "global",
    "userslugs": "global",
    "redis-cache": "global",
    "counts": "ignored",
    "plugins": "ignored",
    "themes": "ignored",
    "blog_meta": "global",
    "theme_json": "ignored"
}
Drop-ins: [
    "advanced-cache.php v by ",
    "Redis Object Cache Drop-In v2.4.3 by Till Krüss"
]

Here’s more server info from the WordPress tools site health info tab:

Server architecture Linux 5.15.0-75-generic x86_64
Web server  Apache
PHP version 8.0.29 (Supports 64bit values)
PHP SAPI    fpm-fcgi
PHP max input variables 1000
PHP time limit  0
PHP memory limit    128M
Max input time  60
Upload max filesize 5M
PHP post max size   10M
cURL version    7.81.0 OpenSSL/3.0.2
Is SUHOSIN installed?   No
Is the Imagick library available?   Yes
Are pretty permalinks supported?    Yes
.htaccess rules Custom rules have been added to your .htaccess file.

The website itself doesn’t get much real time traffic maybe about 10 users browsing the website at the same time.

I would of thought the server could cope so not sure why its not.

If anyone can give any advice it would be greatly appreciated!!

Thank you

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer