Linkworthy

Why My Site Went Down Every Tuesday: It Was My Own Ahrefs Site Audit

Saturday 10 October 2026

Every Tuesday, somewhere between 15:10 and 15:40, UptimeRobot told me my radio station website was down. “Connection Timeout”, every time. The server monitoring showed the CPU at 100% for the same half hour. By the time I looked, the site was fine. That went on from 9 June 2026 (I’d had one alert in April and May put together), and it took me until 29 September to find out why. It was my own Ahrefs Site Audit.

What I ruled out first

A traffic flood. Cron jobs. Malware scans. The WordPress weekly cron. Disk I/O. None of them lined up with Tuesday at 15:00. I’d even left a note in my robots.txt blaming a search engine called Sogou for a “database lock every Tuesday”. It was the wrong suspect.

The clue: a PHP slow log

I switched on the PHP-FPM slow log for the site in Plesk, with a 5 second threshold, and let Tuesday come round again. Nearly every slow request was a Yoast XML sitemap, and the access log showed them arriving from a user agent called AhrefsSiteAudit, only on Tuesdays at 15:00.

I had two Ahrefs Site Audit projects, one for the www address and one for the non-www, both scheduled for Tuesday 15:00 to 16:00. They were crawling the site every week and I’d forgotten! Ahrefs had even been emailing me every Tuesday since at least 1 September to say 36 or 37 of 40 URLs had timed out. That was the site trying to tell me.

Why one crawl took everything down

Table of sitemap requests, 504 errors and load during the Tuesday crawl, and sitemap build time before and after
The Tuesday crawl in numbers

The audit fetched every post sitemap at the same time. Each one took about 18 seconds to build, so they piled up. Of 129 sitemap requests, 112 came back as a 504. The pool of PHP workers (30 of them, the PHP-FPM max_children setting) filled up, the server load reached about 32, and nobody else could get a page.

But Ahrefs was only the trigger. Why was a sitemap taking 18 seconds? Because of a filter I’d written myself on 1 June. It excluded my noindexed posts from the sitemap, and for every sitemap request it checked all 32,000 or so posts, one category lookup each. The outages started on 9 June, a week after I added it. Googlebot had been getting the same slow sitemaps, and some 504s, for four months, and Search Console showed my sitemap timing out until I fixed it.

The fix, in three parts

1. Turn off the audit schedule. That took 10 seconds, once I knew.

2. Keep non-search crawlers away from the sitemaps. My old rule only matched AhrefsBot, so AhrefsSiteAudit walked straight past it. It also sat inside the # BEGIN WordPress block, which WordPress can overwrite. The new one sits above that block:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/([a-z0-9_-]*sitemap[0-9]*|sitemap_index)\.xml$ [NC]
RewriteCond %{HTTP_USER_AGENT} (Baiduspider|QlyzeBot|Reflectionbot|Ahrefs|Semrush|Sogou) [NC]
RewriteRule ^ - [F,L]
</IfModule>

I tested it by asking for a sitemap with each user agent. The crawlers got a 403, and Googlebot and an ordinary visitor got a 200.

3. Make the filter stop doing the work every time. The list of noindexed post IDs is now built 500 posts at a time (one category query per batch, not one per post), kept in a WordPress option for 12 hours, and marked stale when a post is published or updated. A lock means only one request rebuilds it. This is the shape of it:

const CACHE_KEY = 'sitemap_noindex_ids';
const LOCK_KEY  = 'sitemap_noindex_lock';
const MAX_AGE   = 12 * HOUR_IN_SECONDS;

function get_sitemap_noindex_ids(): array {
    $cached    = get_option(CACHE_KEY);
    $has_cache = is_array($cached) && isset($cached['built'], $cached['ids']);

    // Fresh enough: use it
    if ($has_cache && (time() - $cached['built']) < MAX_AGE) {
        return $cached['ids'];
    }
    // Someone else is rebuilding: use the old list meanwhile
    if ($has_cache && get_transient(LOCK_KEY)) {
        return $cached['ids'];
    }

    set_transient(LOCK_KEY, 1, 5 * MINUTE_IN_SECONDS);
    $ids = build_noindex_ids();   // the slow bit, now run about twice a day
    update_option(CACHE_KEY, ['built' => time(), 'ids' => $ids], false);
    delete_transient(LOCK_KEY);

    return $ids;
}

add_filter('wpseo_exclude_from_sitemap_by_post_ids', function ($ids) {
    return array_merge((array) $ids, get_sitemap_noindex_ids());
});

I ran this with stand-in versions of the WordPress functions. Three calls built the list once, it rebuilt after the 12 hours were up, and it didn’t rebuild while the lock was held. On the real site, building the list from scratch fell from about 21 seconds to 2.3. A cached sitemap now takes around 1.3 seconds instead of 18.

What I’d check on your site

  • Look at the schedule on any Site Audit tool you’ve signed up to. Mine was weekly, at a fixed time, and I’d forgotten it.
  • Switch on the PHP-FPM slow log. It names the function that’s slow, which beats guessing.
  • Don’t do work for every post inside a sitemap filter. Cache it.
  • If your uptime monitor goes off at the same time every week, it’s a schedule. Go through the access log for that half hour.

So, the thing that was taking my site down every week was a tool run from my own account, on a schedule I’d set myself, and I’d been blaming a Chinese search engine!

This is the third in a short series. The others cover pages Google crawled and didn’t index and sponsored posts and site reputation abuse.