WordPress slow - Cannot find solution

Ok, so I have a fast dedicated server with 32GB Ram, 6 Cores, 15mb cache, 2x1 TB Harddrives, with RAID-1. Everything has been optimized and Nginx settings perfected. We have about 240 sites.

Here is the problem-
The sites are fast, but then...
When we are working on them they start slowing down, after a few hours it goes from 1.5 sec load time to about 15 seconds. If there are multiple people working then that time goes from 1.5 sec to about 30 sec within an hour or so.
When we are not working on them it takes about 24 hours to go from 1.5 sec to about 20 sec load time.

Found a temporary solution, but I need a permanent one.
The temp solution is:
I deactivate ALL plugins and then activate ALL plugins. It seems to reset something and it is fast again. Literally, like nothing is wrong.

When I look at NewRelic everything looks good except it says that about 95% of the load is in admin-ajax.

So my question is what is the long term solution? Why is it when I deactivate them all and then activate them all it gets back to being fast? Any help is very much appreciated! Thank you!

  • Adam Czajczyk

    Hello Brandi,

    I hope you're well today and thank you for your question!

    Hardware resources and web server (NGINX in this case) optimization are very important factors here but not the only ones. There are two often missed issues that can result in similar behavior and these are the number of connections/queries that server can handle at the time (though it's more important in case of Apache than NGINX) and the MySQL optimization.

    In this case however I'd say that a plugin (or some of them) is affecting performance, judging upon your "temporary solution". I suppose that something is causing a "flood" of "admin-ajax.php" calls (as you mentioned) and this gradually "clogs" server resources. Disabling all plugins simply "unclogs" it because it stops "admin-ajax.php" calls.

    The important part then would be to identify that particular plugin. That said, I'd like to ask you to enable WordPress debugging by adding following lines to the "wp-config.php" file of your site:

    define('WP_DEBUG',true);
    define('WP_DEBUG_LOG',true);
    define('WP_DEBUG_DISPLAY',false);

    After this id done, please go through a "slow down - reset" cycle one or two times and then
    - access your site via FTP
    - go to "/wp-content" folder
    - download the "debug.log" file
    - rename it to "debug.txt" and attach to your post here.

    I'd also like to take a closer look at the site so it would be great if you could grant me a support access to it using our WPMU DEV Dashboard plugin along posting debug file here.

    Here's a guide on granting access:
    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,
    Adam

  • Brandi

    I have enabled support access. I added the debug lines to the file, but no debug file has been generated yet. I have been working off and on trying to make it generate, but nothing so far. I am looking at the /wp-content/ folder and no other files have been added so far.

    This is part of the wp-config:
    define('WP_ALLOW_MULTISITE', true);
    define('WPMU_ACCEL_REDIRECT', true);
    define('WP_DEBUG', true); define('WP_DEBUG_LOG',true); define('WP_DEBUG_DISPLAY',false);

    So far the speed is not doing bad. About 4 hours ago it was 1.66 sec load on one of the sites and now the same site is 2.16 sec load time. So not bad at all, but I know it probably will creep up to 30+ seconds again by tomorrow afternoon.

  • Brandi

    So for whatever reason the server is not generating a debug log and as far as server issues nothing is appear to according to our host.

    The sites all slow down regardless of what browser I am on and also appears slow on tools.pingdom.com

    On new relic it is still showing that the admin-ajax is what most of the time is spent on. When I deactivate all the plugins and then reactivate all the plugins back to back it temporarily fixes the problem. We generally have to do this about 3 times a day. (Attached is an image of what I see in NewRelic)

    Any other suggestions?

    Also, is there a way to create a cron job that deactivates all plugins and then reactivates them all like every 2 hours?

  • Brandi

    So I upgraded my subscription with NewRelic so I could find which of the plugins is causing the issue. It is the domain mapping plugin from you all. Attached is the screenshot. We have roughly 240 domains currently being mapped, and we are having to deactivate and activate every couple of hours.

    So the domain mapping plugin is currently taking all the time and the hook that is causing the issues admin_init. It seems to be causing an excess in the admin-ajax for whatever reason. When I deactivate then activate it, it seems to clear it out. Now we just need a permanent solution.

    Any ideas on how to fix this quickly?

  • Adam Czajczyk

    Hello Brandi,

    Thank you for this additional information.

    This is quite surprising, I must admit but we'll of course need to take a closer look. I feel I need to include Domain Mapping developer in this so I asked him for help here and am awaiting his response.

    Just in case he'd like to take a closer look at your setup: would you agree to provide me with full access credentials? Since it's a Domain Mapping/server related issue the support access may not be enough as it doesn't let us work with plugin's files. That said, please send in:

    Subject: "Attn: Adam Czajczyk"

    - Mark to my attention, the subject line should contain only: ATTN: Adam Czajczyk
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - login URL and admin account login credentials (may be a temporary admin account) data
    - Include FTP log-in details (hostname, username & password)
    - Include hosting control panel access details (login address, username & password)
    -- cPanel's usually the control panel used for this, but your provider may use something else; I'll need this for accessing your site's database, preferably via phpMyAdmin
    - Include any relevant URLs for your site

    Please use our contact form here http://premium.wpmudev.org/contact/.
    Select "I have a different question" from the drop-down list.

    Please be sure to make a full backup of your entire site first!

    Please note also that developers response may be a bit slower than ours here on support forum as he deals with a lot of complex issues on daily basis.

    I'll keep you informed.

    Best regards,
    Adam

  • petemaster5000

    I'm having problems with wpmu domain mapping now too since upgrading wordpress from 4.5.1 to 4.5.2. I get the "domain is unavailable to access...dns" but the domain is guaranteed pointing to the correct IP. If I disable the "check for dns before" and "check after..." in the mapping settings, it will map the domain, but shows in red: Invalid.... but the website will work even despite the mapping thinks it's invalid.

    The really strange thing is, I mapped a different domain on same server, on hour earlier and it worked. no config changes since.

    Anyone else have this issue?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.