• Resolved blizo

    (@blizo)


    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 http://www.conf 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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Try using a timeout of 5s, that might resolve it.

    For both, WP_REDIS_TIMEOUT and WP_REDIS_READ_TIMEOUT.

    Thread Starter blizo

    (@blizo)

    Hi @tillkruess

    Thanks for the reply. I have tried what you recommended and the site still froze. There were 2 admins working on the backend when it happened.

    I couldn’t even connect via SSH. I just had to wait for server to become responsive again.

    I found this thread which describes the same problem with oom-killer in the syslog file and possible solutions for it:
    https://serverfault.com/questions/344525/php-fpm-invokes-oom-killer

    I’ve tried the first recommendation by reducing ‘www.config’ settings. Here’s how it looks:

    pm.max_children = 100
    pm.start_servers = 25
    pm.min_spare_servers = 25
    pm.max_spare_servers = 40
    pm.max_requests = 300

    The second recommendation I haven’t tried but if the server crashes again I might have to!

    The Redis database side of things makes it more complicated for me to understand what to do next.

    Would resizing the Droplet with more RAM fix this? Or would the Redis db also need more RAM?

    I see there is a paid version of this plugin. Would that be a priority or hardware is the next best thing to try?

    I also spotted this Redis warning in the syslog, is this anything to be concerned about?

    Aug 8 14:39:07 project systemd[1]: Starting Clean php session files…
    Aug 8 14:39:07 project sessionclean[1277008]: PHP Warning: Module "redis" is already loaded in Unknown on line 0
    Aug 8 14:39:07 project systemd[1]: phpsessionclean.service: Deactivated successfully.
    Aug 8 14:39:07 project systemd[1]: Finished Clean php session files.

    Thanks for your help. I greatly appreciate anything you can recommend.

    Also here’s the server graphs for today.. The spike is when it crashed.

    • This reply was modified 11 months, 2 weeks ago by blizo.
    • This reply was modified 11 months, 2 weeks ago by blizo.
    • This reply was modified 11 months, 2 weeks ago by blizo.
    • This reply was modified 11 months, 2 weeks ago by blizo.
    Thread Starter blizo

    (@blizo)

    How can I tell if Redis is helping or hindering this website?

    It’s a Woocommerce site with about 500 products.

    Plugin Author Till Krüss

    (@tillkruess)

    New Relic APM is excellent for this kind of insight.

    Thread Starter blizo

    (@blizo)

    Hi @tillkruess

    Thanks for the tip. I wasn’t aware of New Relic.. At a quick glance some of the features look similar to DigitalOceans native insights?

    I’ve attached DOs Redis insights from today. Does anything look critical?

    The spike on the CPU usage at 11am was when the site crashed. How come the spike hasn’t gone down since? The cache is fuller?

    None of the stats are at 100% which would suggest Redis isn’t failing?

    • This reply was modified 11 months, 2 weeks ago by blizo.
    Plugin Author Till Krüss

    (@tillkruess)

    Those are just surface metrics. New Relic will give you an in-depth view of transactions.

    If you’re using DO’s managed Redis instances, their support team can probably assist you with your infrastructure.

    We simply provide a plugin for WordPress to communicate with Redis.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘RedisException: read error on connection & Failed to read FastCGI header’ is closed to new replies.