Oliverde8's blue Website

akeneo-logo.jpg

Optimizing Akeneo / Configuring APC & OpCache

Optimizing Akeneo / Configuring APC & OpCache

Since I started using Akeneo I never really was impressed by the load times. The time it takes to go from the grid to the product edit page is simply to long. I had times around 7 seconds for a relatively small project and well it needed to be improved. 

After a little investigation I found that the slowest operation was in Symfony\Component\Translation\Translator::initializeCacheCatalogue 

The strange part is that it was the inclusion of the php files that was slow even throught I had apc cache activated. So I decided to look a bit more in what was going on. 

First of all I saw a few post on the internet that suggested to change apc.ttl from 0 to 3600. I did so to see what happanes and I started having slightly faster page load times. It wasn't a huge change but still. The issue with 3600 vs 0 is that when set at 0 the cache should not actually empty due to expiration. It only empties if the cache is full : 

 In the event of a cache running out of available memory, the cache will be completely expunged if ttl is equal to 0

But when I changed the ttl to 3600 it started working by deleting the oldest files in cache. 

Otherwise, if the ttl is greater than 0, APC will attempt to remove expired entries.

So I was still not having the desired effect with this change as simply my cache apc was to small to fit all op cache in it. So the final solution was to simply increase the cache size : 

apc.shm_size = 512

Once I have increased the size from 32M to 512M it divided per 2 the load times to go from the product grid to the product edit interface. 

So this is the solution for PHP5.4 Note that you should not be using PHP5.4 !

In 5.5+ we have opcache integrated so we need to do a similar change : 

opcache.max_accelerated_files = 65407
opcache.memory_consumption = 256M

I have put less memory in opcache storage as the data cache isn't part if it. There is probably a need to optimize the apcu cache size as well. I will see that next time.