Performance Tips

General tips and tricks

subjectstandardoptimuminfo
PHP version-7.4.xPHP 7.4.x, depending on the circumstances, this version offers a possible performance increase of up to 25-30% (PHP stack). Furthermore, the Memory_Limit - depending on the number of plugins and data sets used - should be at least 512MB.
Bytecode cacheAPCZendOpcache + APCuInstalling and configuring a Bytecode cache is more than recommended - it will likely increase PHP stack execution by an additional up to 25%.
MySQLMySQL 5.7.xMySQL 5.7.x or MariaDB derivateIf possible you should make use of the latest major productive MySQL version available. This will positively affect the execution of joins and subselects and read accesses. MySQL should be used in the current major version released for production purposes, as there have been significant improvements in the execution of joins, subselects and read accesses to the database.
webserverApache 2.2 or 2.4NginxIf your shop generates particular large amounts of traffic, you might consider an alternate webserver such as e.g. Nginx. Make sure, that the mod_rewrite module is enabled and that there is a possibility to change webserver settings in .htacces.
Debugging / profiling--Make sure there are no profiling tools like xDebug or XhProf active and running on your server. Those will negatively affect PHP execution. The same is true for any Shopware debugging & benchmark plugin. So you should never use them in a productive environment.

With every new iteration of Shopware there are performance improvements to be expected. Always keeping your software up-to-date should be your admin's first priority.

Choosing an adequate hoster

A hoster should resemble the aspired range of expertise in its offer. There should be an equally fitting upgrade path available, so that hosters can alter their offers according to the development and growth of your shop. You should consider the following topics:

  • Shared hosting vs. vServer vs. dedicated server
  • Software stack resembles the above mentioned recommendations?
  • Any prior Shopware experience at hand?
  • Are there any Shopware based reference shops available?

Generally we recommend accepting services from one of our certified web hosters. A current list of hosters can be found following this link: Shopware hosting partner.

How to measure performance?

When measuring a shop's performance, loading times can only be an indicator for an expected level of performance. Characteristics present in your shop, ranging from item count to internal structure or momentary capacity utilisation will always have a significant influence on palpable loading times.

You should perform the following analysis steps in a test system - you can create this in a subfolder using these instructions: https://docs.shopware.com/en/shopware-5-en/tutorials-and-faq/shop-transfer-live-system-test-environment

  • Deactivate all third-party extensions without exception
  • Assign Standard Responsive Theme
  • Warm up cache
  • Check Performance again

If these steps have led to an improvement, the factors must be excluded step-by-step. If there is still unsatisfactory performance, it is advisable to determine the following benchmark values:

  • How many articles does the shop have? How many variants?
  • How many categories does the shop have? How many category assignments?
  • How many simultaneous accesses are there?
  • Where is the poor performance noticeable?
  • Can a time be defined here at which the problems occur?

The cronjob "Cleanup" is elementary for a cleanup of the system - the following database tables are cleaned up here:

  • _s emarketing_lastarticles - article history older than 30 days
  • _s statistics_search - Similar search terms older than 30 days
  • _s core_log - backend log entries older than 30 days
  • _s order_notes - watch lists which are older than one year and have no user assignment
  • _s statistics_referrer - Referrers older than 90 days (default)
  • _s statistics_article_impression - article views older than 90 days (default)

Please also check the number of records in the following database tables:

  • _s articles_categories_ro
  • _s articles_details
  • _s articles_prices
  • _s articles_also_shown_ro

Measuring performance with Firebug

To generate comparable measurements, we recommend to install the Shopware demo data plugin before running tests in your shop. Firebug is a browser extension which can be installed directly via your browser. If installed it will display load times for every page component in your browser's networking tab.

Particularly relevant are the entire webpage's load times - most likely the first entry of the list. To gather relevant measurements you should load the landing page, listing pages and details pages several times and note all loading times. By calculating the means you will receive meaningful statistics on your shop's performance.

Measuring performance with Apache benchmark

Call the benchmark using a linux shell:


ab -n 10 -c 1 http://HOMEGPAGE_URL / CATEGORY / DETAILPAGE

Here you should go for the median of all connection times (= total time).

Analysing performance

taskcontact personinfo
Identify problematic componentcustomer / hosterTry and localize the source of the performance drops. Possibly this could be your webserver, the database server, your PHP stack and so on.
Analysing slow SQL querieshosterWhat database queries affect the overall performance of your shop?
Analysing the hosting platformhoster / customer

Do you have a hosting environment suitable for the size and the aggregated traffic of your particular shop? Do you use current and recommended server components? Do you employ dedicated servers instead of vhostings or webspace packages? Do you run any other applications apart from Shopware on your server?

AccessibilitycustomerIs there an ERP system cloggin up the connection with large amounts of data? Are there regular tasks running on your shop server, potentially lowering the performance.

Optimizing the MySQL configuration

The standard configuration of many distributions is not ideally suited for productive environments. But don't worry, there is a script for that! "Mysqltuner" provides hints towards suboptimal configuration and parameter settings.


wget http://mysqltuner.com/mysqltuner.pl
chmod +x mysqltuner.pl
./mysqltuner.pl

Many properties and performance drops

Set the attribute optimizer_search_depth = 0 in your MySQL configuration. Read more.

Tips & Tricks

Standard sorting for category lists

In case you have defined your own sorting criteria here, you should make sure there is an index in your database for each of the table's columns.

Switching your update strategy

There are several different processes active when one of your shop's pages is accessed. For example SEO links are generated, the search engine's cache is generated as well as the necessary data for displaying top selling items or other items of interest based on similar customer behaviour. Thoroughly check if and how using this function may benefit your enterprise and consider switching the update strategy from "live" (per page request) to "cronjob" (cumulative, time-controlled). To do so navigate to Configuration > Cache/performance > Cache/performance > Settings (tab).

Look for the entries SEO (1), Search (2), Top seller (3) and Referral Marketing (4) to make your changes there. To make use of cronjob functionalities, you first will have to install two custom plugins, "Cron" and "CronRefresh". With these plugins you can time control server requests and should schedule them, most likely towards night time. If you are not sure how that works, kindly refer to this wiki article: Cronjobs.

Activating HTTP cache

With Shopware you can make use of caching instead of live fetching all the data for each user from the database. As each database access uses up scarce web ressources, consider activating http- caches. This will create a cache file, that incorporates the most important information from the article's listing and its details page, therefore preventing unnecessary database queries. This will also make browsing your shop a bliss as it will improve the performance greatly. For keeping prices up-to-date, this cache is invalidated when prices change!

With the cronjob we created above, we made sure the cache file doesn't grow too big, as it is deleted regularly (standard value: every 24h). This has proven to be quite practical as the http-cache might grow by 1-2GB each day if frequently used. Activate the http cache via Configuration > Cache/performance > Cache/performance > Settings (tab) > Http cache and check the plugin and all changes made for compatibility with your shop. It may be wise to make a test run before going live with the changes you made.

Inspecting plugins

There are not only a few cases in which the use of plugins severely impacted a shop's performance. To see if that might be the case in your shop, too, it might be wise to deactivate all third-party plugins and compare the frontend performances with and without activated plugins.

An easy way of doing this is to conduct an SQL query in a test environment. Both queries shown hereunder can be run in phpMyAdmin and will deactivate a plugins that are not part of the default Shopware configuration.

UPDATE `s_core_plugins` SET `active`= 0 WHERE `source` <> 'Default' AND author <> 'shopware AG';

Step-by-step instructions are to be found in the following wiki article: Shopware SQL.

Alternatively you may want to use the Plugin safe mode provided via the Plugin manager from Shopware 5.3 onwards.

Once the shop runs smoothly again, you can try and make out the plugin impacting your shop's performance by reactivating the third party plugins step-by-step. You can also re-evaluate the need for each individual plugin and tidy up your shops backend a little.

"Debug" plugin

Shopware out-of-the-box comes with a "Debug" plugin, that is able to monitor and benchmark individual processes on a server. It will provide you with sufficient information on e.g. the duration of page requests and it will hint at processes e.g. database queries, controller etc. that might slow down individual requests.

Optimizing servers

Have you ever heard about extended caching, namely ZendOP and APCu? Either way, you should consider installing and activating both in your shop to boost performance even more. To evaluate the current performance levels of a shop, use the tools found in Configuration > Caches/performance > Caches/performance > Settings > Performance checks

System check

Shopware gathers information on your system configuration and lists them in Configuration > System info.

Here you find entries like "memory_limit" (1). Exceeding the memory limit e.g. will negatively impact performance. Be aware that memory limits can be tweaked and e.g. virtually enlarged, making a thorough examination of your system worthwhile.

Compiler Caching

Visiting Configuration > Theme manager > Settings you have the opportunity to deactivate compiler caching. This is generally advised during the normal productive shop cycle. Because compiler caching greatly slows down a shop, it should only be used when you are developing and tweaking on the infrastructure anyway.

Was this article helpful?