At last year's Shopware Community Day__ #scd2021__ we were pleased to welcome many top-notch speakers and one of them was Benjamin Eberlei (Tideways).
Some of you guys expressed an interest in the slides for this talk “Best Practices for Running Shopware 6 in Production”, and finally, here they are!
See Benjamin Eberlei slides of his talk “Best Practices for Running Shopware 6 in Production”
Unfortunately, Benjamin couldn't be on-site at this event and so he wasn’t able to answer upcoming requests straight away. Therefore, we collected them and asked Benjamin to post his responses here.
Q&A with questions from the Shopware Community and Benjamin Eberlei
Does the HTTP cache also apply to the API, especially the Store API?
|As far as I can see, it doesn’t. The HTTP cache is activated through the controller annotation “@HttpCache”, which is not on API controllers. However, you can work around that by using a Symfony listener for a “kernel.response” event and setting the maximum age of the response. See https://symfony.com/doc/current/http_cache.html for more information, but take care that the cached response is also authenticated as you want it to be.|
Would you advise using Cloudflare for a big SW6 project?
|That’s not something I can competently say.|
|Why aren’t you specifying any limits via the args for the consume command? Aren’t you running into memory leak issues that way?|
|It makes sense to restart the worker regularly to avoid memory leaks. I forgot to mention this issue during the presentation. It’s certainly something you have to experiment with for each shop. I thought there were defaults for the time and memory limit, but I’ve just realized that there aren’t. So, you should definitely provide values for them.|
|Why are there so few internal events you can react to via apps, e.g. cache, error and theme compiler?|
|I didn’t write the Shopware core, so that is something you would need to ask the Shopware developers. However, it’s a good idea not to have too many events in a system because it makes it very hard to extend and change in the future.|
What is your experience with deadlocks / global read locks in Shopware 6 when using the message queue (not including the message_queue_stats)? We experience that from time to time on the cart, product or seo_url table.
|In my experience of helping customers with Shopware performance problems I haven't specifically come across deadlock problems yet that couldn't be fixed by increasing the database performance.|
|Why do you still use the intermediate layer enqueue and not configure Symfony messenger directly?|
|No particular reason. That’s what I found works with Shopware. I haven’t tested it with the Symfony internal Redis queue yet.|
|How well will this setup with systemd services work with containerized instances of Shopware 6?|
|You probably shouldn't use systemd with containerized Shopware 6. Instead, you should create two container images, one to run a worker and one for scheduled tasks, and then scale them according to your needs. I don't have any experience with a containerized Shopware setup though, so take this information with a pinch of salt.|
Thanks a lot for your support, Benjamin! Hope to see you at next #scd2022 as well!
Watch Benjamin's SCD talk about running Shopware 6 in production
Did you miss Benjamin's talk? You can watch the full recording of the SCD21 tech stage or quickly jump to Benjamin's talk by using the chapter function (Benjamin's talk starts at chapter 3).
About Benjamin Eberlei
Benjamin develops Profiling and Monitoring Tools for Shopware and PHP applications at Tideways, and is an open-source contributor to Doctrine and the PHP language itself. Benjamin entwickelt an Profiling und Monitoring Tools für Shopware und PHP Anwendungen bei der Tideways GmbH und ist Open-Source Contributor bei Doctrine und zur Sprache PHP.