Symfony/Optimize performance

From Aimeos documentation

Other languages:
English 100%

Enable APC

A big performance boost can be achieved by installing APCu (the APC user cache). It can cache all configuration and translation entries in the shared memory of the web server which can improve performance by 50%.

Be aware that you have to clear the APC user cache manually each time after you've changed a configuration option or a translation!

In order to tell your application to use the APC user cache, you need to change the apc_enable setting in the ./app/config/config.yml file of your application:

  1. aimeos_shop:
  2.     apc_enable: true
  3.     apc_prefix: 'symfony:'

If you have more than one shop application on the same server, you must assign an unique apc_prefix for each instance! More about APC can be found in the administrator section.

Cache component content

The content cache is usually enabled by default if you haven't disabled it during development in your ./app/config/config.yml:

classes/cache/manager/name => 'None'

If you have a high volume of products (50k+) and your database server gets slower due to the amount of queries executed, you can offload the content cache entries either to another database server or to an in-memory key/value store like Redis.

To move the content cache entries to a Redis server, you have to install the ai-cache extension. The extension contains documentation how to configure your application for Redis support.

Alternatively, you can move the cached component content to another database server. In this case, you must add a db-cache resource block to your ./app/config/config.yml:

  1. resource:
  2.     db-cache:
  3.         adapter: mysql
  4.         host: ...
  5.         port: ...
  6.         database: ...
  7.         username: ...
  8.         password: ...
  9.         stmt: ["SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'"]
  10.         limit: 2
  11.         opt-persistent: 0

You can even distribute the Aimeos database to serveral database servers. More information is available in the developer section.

Use a different domain for static files

Browsers don't load all required files at once referenced inside a HTML document. Instead, they limit the number of concurrent requests for a single domain. To get around this, a common way is to make the files also available via a different domain, so the browsers will download more files in parallel. Thus, rendering the page is much faster for the user.

  • One way is to create a second virtual host configuration in your web server which uses a sub-domain like "". The document root should point to the same directory as your main virtual host (e.g. in the file system to ease maintenance. Otherwise you would have to make sure that the files are in sync in both directories. If the internet connection to your customers is short and fast and your server is able to handle the load, this way is the preferred one - especially, if you are able to serve the files from a memory-based cache like Squid or Varnish.
  • Another option is to use a domain from a content delivery network (CDN) like Amazon Cloudfront. Usually, you can configure these services to retrieve the static files on the first request from your host and deliver them from their caches afterwards. The advantage of a CDN over a sub-domain on your own server is the load-balancing across many servers and the distribution from a server near to the visitors of your web site. Both can improve the speed of your web site a lot.

In both cases, you need to configure the Aimeos Symfony bundle to create links to the product pictures with a different domain. This can be done via an entry in the app/config/config.yml file:

  1. aimeos_shop:
  2.     client:
  3.         html:
  4.             common:
  5.                 content:
  6.                     baseurl:

The value in baseurl must be the URL prefix where the subdirectories for the product pictures and all related files are available.