Cache Doesn't Improve Request Per Second


In many tutorials, caching significantly improves requests per second using benchmarking tools like WRK and AB. For some reason, caching doesn’t seem to improve request per second at all - it ​might even make it worse. I’ve been stuck between 1k to 3k requests per second.

Can someone please help me understand how some people seem to reach 12k to 30k requests per second using the same benchmarking tools?

I’m using the following optimizations:

  1. Load balancing w/ 5 web servers
  2. Browser cache
  3. FastCGI cache
  4. HTTP2 w/ server push
  5. Gzip compression
  6. Image resizing w/ resized image cache
  7. Cache in RAM
  8. Webp images
  9. HTML and CSS minification
  10. Removing unused CSS
  11. Lazy loading images

I’ve also tried:

  1. CDN
  2. Dedicated CPU web server
  3. Systemctl
  4. HAProxy

Here is my nginx.conf file.

I’ve been trying to figure this out for over three weeks now but I’m stumped…

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The only thing I can think of would be that even though you have layers upon layers of caches, somehow requests still get through to the php (or backend service), and not being loaded from cache.

From reading “Browser Cache”, I’m assuming you’re not using an API backend entirely.

What I’d do would be to strip off all the caching layers, then start with each one by one.

So you might start with only FastCGI, then test to see. See if it improves rps.

Considering the layers of caches, would it be possible that somehow, each layer makes the request going to the layer seem like a new dynamic request, thus triggering a brand new request on each cycle? Just a thought.