Alright, so the database lock might have been a red herring. Did some other stuff, and it seems to have really helped:
Forum slowdown fix — Dec 2, afternoon
The symptom: Even after this morning's PHP fixes, pages were still taking 5–10 seconds to start loading, intermittently for members and on almost every request for guests.
What I found:
Result:
Still to do:
Forum slowdown fix — Dec 2, afternoon
The symptom: Even after this morning's PHP fixes, pages were still taking 5–10 seconds to start loading, intermittently for members and on almost every request for guests.
What I found:
- The database wasn't it. MySQL was idle even during slow loads.
- Timing from the server itself showed every request waiting 7–10 seconds before the first byte, even for a static file with no PHP involved, so the delay was in Apache.
- Apache's status page showed all 150 of 150 connection slots busy and 0 idle. Nearly all were in the "reading request" state: clients holding connections open without sending anything. Every new request waited in line for a free slot.
- Connections per IP showed no single abuser, but a constantly rotating set of visitors each holding 4–6 connections. That's typical of HTTP/1.1, which Apache's old prefork mode forced every browser and bot to use. (One persistent visitor was ClaudeBot, Anthropic's crawler, but at 14 of about 150 connections it wasn't the main cause, so we didn't block it.)
- Apache timeouts(WHM → Apache Configuration → Global Configuration):
- Timeout: 300 → 30 seconds
- KeepAliveTimeout: 5 → 3 seconds
- The effect was immediate: 150 busy / 0 idle became about 80 busy / 56 idle.
- Switched Apache from prefork to mpm_eventin EasyApache 4, which also added:
- mod_http2: browsers now use one connection instead of about six. Confirmed HTTP/2 in the browser.
- mod_reqtimeout: wasn't installed before. It drops clients that send requests too slowly, instead of letting them hold slots.
- mod_cgid replaces mod_cgi; no functional change.
- Raised Apache's limits for event mode: Server Limit 16, Max Request Workers 150 → 400.
Result:
- Time to first byte: 7–10 s → about 0.22 s, consistently.
- Apache now: about 9 busy / 116 idle out of 400.
Still to do:
- Browser caching rules in .htaccess, so static files aren't re-downloaded on every page.
- XenForo's guest page cache, before reopening guest access fully.
- Longer term: moving off CentOS 7, and PHP 8.2 → 8.3.