My previous post recorded the abnormal traffic I observed at the EdgeOne layer after this CPU alert occurred, as well as the adjustments I ultimately made to adaptive rate limiting, JavaScript challenges, and anti-hotlinking within the capabilities of the personal edition.
However, EdgeOne primarily resolved issues at the traffic entry layer.
In fact, before this CPU alert, I had already noticed that the page cache status of W3 Total Cache was somewhat off.
My Page Cache lifetime is set to 4 days, so logically I should be able to see page files surviving for 2 days, 3 days, or even nearly 4 days in the cache directory. But during previous actual checks, I found that the cache was generally very fresh, with almost no pages older than 2 days.
I didn’t continue investigating deeper at the time because I was batch-processing a large number of historical articles.
Batch updating articles can itself trigger page cache invalidation, homepage refreshes, and other operations, so seeing a short cache age at that stage did not clearly distinguish:
Whether there was an actual issue with W3 Total Cache itself, or if it was normal cache invalidation caused by the batch processing of historical articles.
So this issue was temporarily shelved at the time.
The batch processing of historical articles has long since finished, and the site has returned to a relatively stable operating state. If the page cache still consistently fails to exceed 2 days, the explanation of “articles are being batch updated” no longer applies.
Since I encountered another server CPU alert this time, I decided to thoroughly investigate this lingering issue:
Why, with a Page Cache lifetime clearly set to 4 days, do the actual cached pages consistently fail to last more than 2 days?
As I continued investigating, I first discovered an issue that had been persisting for about half a month:
The combined Sitemap used by W3 Total Cache for page cache preloading had actually been failing to generate all along.
Tracing further, I ultimately pinpointed the issue to Yoast SEO’s post-sitemap.xml: when generating the post Sitemap, the PHP-FPM 256M memory limit was exhausted, resulting in an HTTP 500 response.
This time, I will continue documenting the server-side troubleshooting process.
1. W3TC Combined Preload Sitemap Consistently Failing to Generate
My WordPress uses W3 Total Cache’s Disk Enhanced page caching, with page cache preloading enabled.
To preload both the Chinese and English sites simultaneously, I previously wrote a custom combined Sitemap generation script that merges the URLs from:
www.shuijingwanwq.comand:
en.shuijingwanwq.cominto:
w3tc-preload-sitemap.xmlwhich is then fed to W3TC Preload.
While investigating further, I checked the generation logs and found consecutive entries showing:
status: FAILED
读取失败:https://www.shuijingwanwq.com/post-sitemap.xml
curl: (22) The requested URL returned error: 500There was also one occurrence of:
curl: (28) Operation timed out after 30002 milliseconds with 0 bytes received
This means the combined Sitemap had not been updating properly for a long time, not because W3TC itself couldn’t read the Sitemap.
The problem occurred earlier:
Combined Sitemap generation script
↓
Reads www's post-sitemap.xml
↓
HTTP 500 / Timeout
↓
Combined Sitemap generation failsThis also explains why W3TC’s page preloading hadn’t been receiving the latest URL list previously.
2. First Ruling Out Linux Cron Not Running
Seeing a scheduled generated file not updating for a long time, the first natural suspicion is:
Is Linux Cron simply not running properly?
The system Cron for this combined Sitemap is configured to execute at the 17th minute of every hour.
Continuing to check /var/log/cron, I could clearly see:
09:17:01
10:17:01
11:17:01
12:17:01
13:17:01
14:17:01
15:17:01
16:17:01
17:17:01
18:17:01It was triggering normally every hour:
/usr/bin/flock -n /run/lock/swq-w3tc-preload-sitemap.lock
/usr/local/bin/swq-w3tc-preload-sitemap.py
So we can rule out one direction here:
It’s not that the scheduled task isn’t running, but rather that every time the scheduled task runs, it fails when reading the upstream Sitemap.
The approaches to these two situations are completely different.
If Cron simply wasn’t running, fixing Cron would be the end of it.
The current problem clearly requires tracing further into WordPress / PHP.
3. Why Does www’s post-sitemap.xml Return 500?
Next, I tested directly:
https://www.shuijingwanwq.com/post-sitemap.xmland found that it indeed returns an HTTP 500.
The English site’s:
https://en.shuijingwanwq.com/post-sitemap.xmlalso had a similar issue.
But the site’s:
sitemap_index.xmlwas accessible normally.
Therefore, the problem was further narrowed down:
It wasn’t that the Yoast Sitemap functionality was entirely broken, but rather that an exception occurred when actually generating the post Sitemap.
After checking the PHP-FPM logs, I quickly found the most critical line:
PHP Fatal error:
Allowed memory size of 268435456 bytes exhaustedHere:
268435456 bytesis exactly:
256 MBThe logs also showed the exception occurring in:
wp-includes/class-wpdb.phpduring the database result reading process.

Combining this with the complete call stack at the time and tracing upwards, I could see the request entering Yoast SEO’s post Sitemap generation logic, including:
wpdb->get_results()
WPSEO_Post_Type_Sitemap_Provider->get_posts()Therefore, the direct cause of post-sitemap.xml returning an HTTP 500 could be confirmed:
When Yoast SEO generates the post Sitemap, a single PHP request exceeds the current 256M memory_limit.
4. Why Does Generating a Sitemap Consume So Much Memory?
This actually surprised me a bit at first.
A Sitemap seems to just generate a batch of URLs, which theoretically shouldn’t require a particularly large amount of memory.
But looking further into Yoast’s implementation, you find it’s not a simple query for:
post IDfollowed by concatenating URLs.
Generating a post Sitemap requires reading a certain amount of post data.
By default, a single Yoast Sitemap can contain approximately:
1000 URLsMy WordPress has accumulated several thousand articles, many of which are lengthy technical posts containing large amounts of code, logs, and configuration content.
Therefore, the actual volume of data a single Sitemap request needs to process is not small.
When the PHP-FPM single-request memory limit is only:
256Mthe current scale of articles can already hit this limit.
This HTTP 500 was actually the threshold being genuinely hit.
5. Two memory_limit Entries Still Exist in php.ini
Continuing to check:
/usr/local/php/etc/php.iniI found another spot prone to causing confusion.
There are actually two entries in the configuration file:
memory_limit = 128Mand:
memory_limit = 256MBefore modification, their positions were approximately at lines:
430
1883The one that actually took effect in the end was the latter:
256MTo avoid future confusion caused by duplicate configurations, I didn’t just modify one of them this time; I unified both to:
memory_limit = 512MAfter the modification, checking again:
430:memory_limit = 512M
1883:memory_limit = 512MThe actual effective value for PHP-FPM also became:
memory_limit => 512M => 512M
A special note is needed here:
Setting
memory_limitto 512M does not mean that every PHP-FPM worker will immediately occupy 512M upon starting.
It is merely the memory limit allowed for a single PHP request.
However, my server doesn’t have a lot of total memory, so this adjustment shouldn’t be interpreted as “the more memory, the better.”
More accurately, the current 256M has been proven insufficient by an actual failure, so I increased it to 512M first and will continue monitoring.
If high concurrency later causes overall server memory pressure due to high single-request memory usage, I will need to re-evaluate.
6. After Adjusting to 512M, post-sitemap.xml Returns to Normal
After modifying php.ini, I first checked the PHP-FPM configuration for syntax errors, then reloaded PHP-FPM.
I then requested the Chinese site again:
https://www.shuijingwanwq.com/post-sitemap.xmlTest results:
HTTP: 200
Size: 756668 bytes
Time: 8.156836sTesting the English site:
https://en.shuijingwanwq.com/post-sitemap.xmlThe result also recovered:
HTTP: 200
Size: 224628 bytes
Time: 15.314945s
This step is quite critical because it wasn’t just seeing the logs stop reporting errors, but directly verifying the originally failing target URL.
Before the fix:
post-sitemap.xml
→ HTTP 500After the fix:
post-sitemap.xml
→ HTTP 200So, at least for this Sitemap 500 issue, insufficient 256M memory was the direct cause.
7. Combined Preload Sitemap Finally Resumes Updating
After the upstream post-sitemap.xml recovered, the combined Sitemap generation script was naturally able to retrieve the complete Sitemap data again.
Right after completing the fix, I manually regenerated the combined Sitemap once, which counted:
www 3321
en 3323
total 6644Later, when preparing the screenshots for this article, the system Cron continued to update automatically, and it currently shows:
www: 3323
en : 3325
all: 6648
This actually verifies the previous conclusion once again:
Linux Cron itself was never broken.
It executed every hour previously, but only because:
post-sitemap.xml = 500it kept failing to generate.
Now that the upstream has returned to normal, the same system Cron can continue to automatically update the combined Sitemap without any modifications.
As of the screenshot time:
Chinese site: 3323
English site: 3325
Total: 6648The number of URLs has continued to grow.
8. This Means Newly Added Pages Were Not Entering the Latest Preload List
The prolonged failure to generate the combined Sitemap previously had another rather direct impact:
Articles and pages added during this period did not enter the latest W3TC combined preload Sitemap in a timely manner.
The old file previously contained approximately:
www: 3197
en : 3213
Total: 6410Whereas it has now grown to:
www: 3323
en : 3325
Total: 6648The difference between the two is:
6648 - 6410 = 238This means that as the site continued to update, a noticeable gap emerged between the old preload list and the current actual number of URLs.
This doesn’t mean that these 238 URLs definitely have no page cache at all.
Because W3 Total Cache can still generate cache normally after users or crawlers actually visit the pages.
However, their absence from the latest active preload list means:
We can no longer rely on W3TC Preload to actively and continuously cache these new pages in advance.
For a personal blog with low normal traffic, this issue might not be obvious normally.
But once a sudden surge of automated access occurs, the first request to an unpreloaded page requires actual execution of WordPress / PHP, which can increase instantaneous server pressure.
9. Current Preload Speed Can Still Cover the 4-Day Cache Lifetime
In W3 Total Cache’s current Page Cache configuration:
Cache lifetime: 345600 secondswhich is:
4 daysPreload is currently set to:
Execute every 300 seconds
Preload 7 URLs each timeAfter conversion:
Per hour:
12 × 7 = 84 URLs
Per day:
84 × 24 = 2016 URLsBased on the latest count at screenshot time:
6648 URLsCompleting a full cycle takes approximately:
6648 ÷ 2016 ≈ 3.30 dayswhich is about:
3 days 7 hoursCompared to the:
4-day cache lifetimethis theoretically still leaves a margin of about:
17 hoursTherefore, I did not increase the:
7 URLs / 5 minutesany further because of this issue.
After all, this ECS only has 2 vCPUs.
Preloading itself is also a real page request; setting the speed too aggressively could conversely create sustained PHP pressure.
At this stage, it is more appropriate to first restore the original mechanism and then observe whether the cache can gradually form a stable 1-day, 2-day, and 3-day lifetime.
10. Why Not Directly Reduce the Number of URLs per Sitemap in Yoast This Time?
Since the problem occurred when Yoast generated a larger post Sitemap in a single pass, another potential solution was actually:
Reducing the number of URLs per Sitemap from the default of about 1000.
Theoretically, this would indeed reduce the amount of data a single request needs to process.
However, I didn’t go with this approach first this time.
The reason is that the current 256M limit wasn’t only hit by the Sitemap.
That same day, the PHP-FPM logs also showed other WordPress / W3TC requests hitting the 256M memory limit.
This indicates that as the site scales:
256M has already become tight for the current WordPress production environment.
Therefore, first increasing the PHP-FPM single-request limit to:
512Mis more in line with the current actual situation.
I temporarily kept Yoast’s Sitemap pagination count at its default, avoiding adjusting multiple variables simultaneously.
If the Sitemap starts consistently consuming abnormally high memory in the future, I will then separately consider reducing the number of URLs per Sitemap.
11. The Problem Wasn’t Actually “W3TC Preload Being Too Slow”
There is a rather easy trap to fall into during this troubleshooting.
When I first noticed the page cache count was inconsistent with expectations, it was easy to suspect:
Is W3TC preloading only 7 URLs at a time too slow?So naturally, I thought about increasing:
7directly to:
10
20
or even moreBut continuing to investigate revealed that the real problem wasn’t “too few preloads per batch” at all.
It was:
W3TC Preload
↓
Depends on combined Sitemap
↓
Combined Sitemap needs to read Yoast post-sitemap.xml
↓
post-sitemap.xml returns 500 due to 256M OOM
↓
Combined Sitemap generation fails long-term
↓
W3TC never gets the latest URL listIf I hadn’t continued investigating the cause and just kept increasing the preload speed, not only would it fail to solve the problem, but it could further increase server pressure.
This is why performance issues can’t be diagnosed just by staring at the last parameter that manifests.
12. Behind the CPU Alert, There Was Actually More Than One Issue
Returning to the initial CPU alert.
The first post already confirmed:
Short-term massive abnormal accesswas indeed an important external factor triggering the high server load.
But continuing the analysis towards the origin server, I also discovered:
W3TC combined preload Sitemap long-term failureThis was another internal issue that had been present for some time.
So this incident cannot be simply summarized as:
EdgeOne failed to block abnormal traffic.
A more accurate understanding should be:
External:
Short-term abnormal automated traffic
↓
EdgeOne massive requests to origin
Internal:
Partial page preload mechanism long-term abnormality
↓
More requests rely on the origin server's actual cache status
↓
PHP-FPM bears greater pressureWith the issues on both sides stacking, a server with only 2 vCPUs is naturally more easily pushed to 100% CPU.
13. I Thought It Was Over Here, But There Was Another Layer
Reaching this point, I originally thought I could wrap things up.
Because several key issues had already been restored:
Yoast post-sitemap.xml
500 → 200
PHP memory_limit
256M → 512M
Combined Sitemap
Resumed automatic updating
URL count
6410 → Current 6648Next, as long as W3 Total Cache followed:
Every 5 minutes
Preload 7 URLsto continue running, it should be able to gradually rebuild the complete page cache.
But while checking further, I discovered an even stranger issue:
W3TC’s
w3_pgcache_primeandw3_pgcache_cleanupWP-Cron Events were surprisingly not working properly.
Even more absurdly:
Manually create Event
→ Shows success
Execute wp-cron.php
→ Event disappears againTo finally verify whether W3TC itself was deleting the tasks, I even temporarily created a completely random Cron Probe.
As a result, a new Event scheduled for two hours later, unrecognized by any plugin, also disappeared after running wp-cron.php.
Continuing to trace this, a very critical set of results ultimately emerged:
Database:
DB = YES
WordPress get_option("cron"):
NOThat is to say:
MySQL already contained the new Cron data, but WordPress was reading an old version from the Object Cache.
This issue ultimately led to the relationships among:
WP-Cron
WP-CLI
W3TC Redis Object Cache
alloptions
Multiple domains
Polylang
admin.shuijingwanwq.comThis part is already a relatively independent issue, so I will leave it to be documented separately in the next post.
14. Solving the “Origin Server Preload Entry” First This Time
At this point, a fairly clear conclusion can be drawn for this stage.
Initially seeing:
W3TC page cache seemingly not meeting expectationsdid not mean:
W3TC Disk Enhanced itself was brokenThe first issue discovered this time actually occurred upstream from it:
Yoast Sitemap
↓
PHP memory insufficient
↓
post-sitemap.xml 500
↓
Combined Sitemap generation fails
↓
Preload URL list long-term unable to updateUltimately, through:
PHP memory_limit
256M → 512Mthe post-sitemap.xml for both the Chinese and English sites was restored, and the combined Sitemap resumed automatic updating.
And currently:
6648 URLsat a preload speed of 7 URLs every 5 minutes, it is theoretically still possible to complete a full preload cycle within the 4-day Page Cache lifetime.
Therefore, at this stage, I did not further increase the preload intensity, nor did I perform any full page cache purges.
Letting the existing cache run naturally is the more prudent approach right now.
As for why the WP-Cron Event later inexplicably disappeared, and how I ultimately caught the stale Redis alloptions cache using DB=YES / get_option=NO, I will continue in the next post.

