My application is very modular and uses many components and partials. At one moment I decided to cache some of components to speed things up.
To test caching I duplicated prod env like cache_prod and enabled cache. Settings.yml looks like this:
- Code: Select all
prod:
.settings:
logging_enabled: on
cache: off
cache_prod:
.settings:
logging_enabled: on
cache: on
cache.yml
- Code: Select all
default:
enabled: off
with_layout: false
lifetime: 86400
I have no other cache.yml files in modules that turns cache on, and I thought that prod and cache_prod performance must be the same at this stage, but its not. cache_prod is actually almost twice slower than prod. cache_prod does not write any cache files.
When I setup cache_prod with Web Debug Bar, I can see in the log records like this:
- Code: Select all
28 Info main Call "modMenu->executeMenu()"
29 Info PartialView Render "/modules/modMenu/templates/_menu.php"
30 Info ViewCacheManager Generate cache key
So maybe the difference comes from "ViewCacheManager Generate cache key", but why it generates cache key, as this key does not seems to be used - it does not generate cache files and cache for the menu component is not enabled at all?
When I compare time needed for same partial (for which cache is not enabled) to render in cache enabled env and env with disabled cache, I see that first case is about 10 times slower. I am passing some model objects to the partials and if they are serialized for key generation, as far as I know this can be slow. If this is the case, I come again to the above question - why cache key is generated for module with disabled cache?
