Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 AppCache performance boost

We're trying to figure out what effect enabling AppCache in the frontend controller has on caching without calling any cache directives on the response object.

I had presumed that simply adding the following line and setting default_ttl to 1:

$kernel = new AppCache($kernel);

would not change the behaviour of the application without calling a cache directive on the response. But as soon as we add this line (and cache:clear) our server is able to handle far more requests per second, which suggests that there is some caching going on.

Turning on debug and setting default_ttl to an hour all we see in the http headers is

X-Symfony-Cache: GET /: miss

Does this mean that there is no reverse proxy caching going on? If so what explains the performance increase?

Any clarification on what happens in this situation would be awesome.

like image 935
user1207727 Avatar asked May 17 '13 13:05

user1207727


1 Answers

This line

$kernel = new AppCache($kernel);

enables the Symfony2 Reverse Proxy. For further explanation follow this link: http://symfony.com/doc/current/book/http_cache.html#symfony2-reverse-proxy. The performance increase should be clear now.

The header means that the "Symfony-Cache" got a "GET" request and found no cached data ("miss"). If you call the same page multiple times in a row the header should change to something like:

X-Symfony-Cache: GET /: HIT 42
like image 71
jovobe Avatar answered Nov 15 '22 04:11

jovobe