Flow/Optimize performance

From Aimeos documentation

Flow
Other languages:
English 100%


Content

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 "static.example.com". The document root should point to the same directory as your main virtual host (e.g. example.com) 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 Flow package to create links to the product pictures with a different domain. This can be done via an entry in the Configuration/Settings.yaml file:

  1. Aimeos:
  2.   Shop:
  3.     client:
  4.       html:
  5.         common:
  6.           content:
  7.             baseurl: https://static.example.com/media/

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