FastCGI Cache VS WP Super Cache or use Together?

October 22, 2018 1.7k views
Ubuntu 16.04 Nginx Caching

I am confused about what I found on web and I want a PRO answer. Why someone would need wp super cache when you can cache dynamic php with FastCGI?

1 Answer

FastCGI cache is faster than WP Super Cache because the latter uses .htaccess and and PHP itself to route the visitor to the cache (files). So before the visitors get to a hit on a cached page, WP Super Cache has to performance some logic both in the form of .htaccess (rewrites) and PHP itself (all WP plugins must use php). Whereas FastCGI uses compiled bindings that are fast and routes traffic directly to the cache.

Now, an HTTP cache like Varnish will always be faster than the two. That’s because you’re traveling one fewer hop down the stack to get to the data, which in the case of Varnish sits at the HTTP level as an HTML object and can be served hot.

So to illlustrate:

So to get to the:

FastCGI cache: Nginx -> FastCGI -> File

WP Super Cache cache: Nginx -> FastCGI -> PHP -> File

Varnish cache: HTTP

  • Very helpful answer. From your answer I understood that varnish is the winner. Do you recommend using varnish + lemp stack, many people say use varnish only with apache, which are your thoughts on that?

Have another answer? Share your knowledge.