Working with D6, trying to get a page running more efficiently. I made a lot of progress by installing the Cache Backport module and configuring Redis, so devel shows my DB queries are a fraction of what they were before. Load testing shows that the site can handle a much heavier load than ever. Making progress.
The problem now is that the initial connection to the site is slow, usually 2-3 seconds but often as high as 5 or 6. It's not the database doing it, Devel shows queries are very fast, less than 500 ms on average. It seems to be pretty random. I'm working off a test server right now, I'm the only one on it, but I know it's not just me because any tests with external services show the same thing. My log files are clean, both Apache and syslog. The only other symptom I've seen is that prior to the page's load, PHP will spawn 6 processes and CPU will be high.
I've tried using XDebug to trace PHP's behavior but nothing is jumping out at me. It's definitely loading a few different files, including the Domain module, but I can't really tell what's happening.
I'm using fcgi, Debian 7, Apache is using mpm-worker, if that matters at all.