nginx fastcgi_cache much much slower when "caching" WordPress, rather than a test php file

Hi all,

I'm trying to set up fastcgi caching with nginx on a WordPress install. However, when I ab -n 500 -c 50 https://2mb.solutions/ it goes anywhere from around 800 ms to 3000 ms for the whole transfer. The same command, except with https://2mb.solutions/test.php (which simply print microtime(true)), takes anywhere from 200-800 ms. So obviously something's not working right with the fastcgi_cache. You will notice the "x-nginx-cache" header that I added for that domain is a hit in both cases, however. My config is below:

(/storage/sites-enabled/2mb.solutions): http://codepad.org/bwDTWBSZ

/etc/nginx/nginx.conf: http://codepad.org/0Fg1TMar

Feel free to apache bench or other testing tools those two URL's to see the difference.

Any help would be appreciated.

Thanks,

-Michael.

5 Replies

Why not benchmark https://2mb.solutions/ with nginx cache enabled vs. nginx cache disabled for comparison.

I'd also take cloudflare out of the equation when benchmarking.

Hi,

I'll probably end up doing that, the thing I just don't get is why when they're both preported to be a hit on the cache, a simple test php file takes so much shorter than the whole WordPress – unless I'm misunderstanding it, the cache is a simple html file, so the difference should only depend on disk access, etc.

-Michael.

Hi,

I just did a quick benchmark. The time per request was about 1400 ms without cache, and about 1200 with cache. This tells me that the cache is working – though I still have a suspition that something's misconfigured because 200 ms should not be the amount it goes down with an in-memory cache. I turned on cloudflare developer mode, so the requests go directly to nginx through cloudflare. I'm kind of stumped at this point, as I can tell it's caching, just.. seemingly not well.

-Michael.

One other thing to note: Oddly, when I turned on caching, the max request went up either a small amount, or in a few cases, significantly.

-Michael.

Hi,

I have (I think) seen that fastcgi isn't getting contacted by using tcpdump. However, this odd circumstance continues with WordPress still taking much more time than a simple php file. Anyone else have any ideas?

-Michael.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct