Read the official Contao announcements.
Composer and Contao for the Rest of the World
by Martin Auswöger – Current issues
Since Version 4.0 and for about seven years now, we are using Composer for installing Contao and all of its extensions. Composer is mainly developed and maintained on voluntary basis by Jordi Boggiano and Nils Adermann. Both of them were our guests at the Contao conference in Potsdam in 2017 as well as in Salzburg in 2018.
Composer has been the industry standard for package management in PHP for many years already, offers more than 300,000 packages to install and has been used for installing around 50 billion packages by now. We are incredibly grateful for this tool, which makes our work a lot easier every single day.
We would like to take this opportunity to point out that Jordi and Nils also offer many useful additional features with “Private Packagist”, which in turn allows them to invest time working on Composer itself again. Go have a look!
Performance issues and a solution
As a developer tool, Composer had never been designed to run directly on a web server. Probably one of the reasons we had a rather rough start with Contao 4. The long execution time and high memory consumption during updates caused problems early on. We solved this problem in 2018 with the introduction of the Composer Resolver Cloud, which you are probably all familiar with by now.
But that wasn't enough for Yanick from the Contao core team. Since August 2019, he has been teaming up with Jordi and Nils to work on optimizations for Composer in order to speed up the update process and reduce memory consumption. A first huge leap was introduced with version 2.0. The last part of this journey has now been integrated just few days ago.
The latest work is planned to be released with the upcoming version 2.2 of Composer. You can already try out the improvements on the command line, the steps you have to take can be found at https://github.com/composer/composer/discussions/10276.
For Contao, PHP and our planet
The results are extremely promising so far and many tests have already reported 10 times the speed as well as a reduction in memory consumption of as much as 90%. We therefore expect that updates will be significantly faster in the future and that many users will no longer have to use our cloud. In my personal tests, an update of a Contao 4.9 installation reduced the memory consumption from 1,475 MB to 123 MB and the execution time from 30 seconds to 5 seconds!
These optimizations go far beyond the Contao universe and will bring improvements for the entire PHP community. To illustrate this better, I allowed myself to perform some extrapolations:
composer updatecommand is executed around 3 million times a day. Assuming the average update is 20 seconds faster now, around 58 million CPU seconds would be saved every day. Assuming an additional reduction of 500 MB of memory, this could be translated to server costs worth 500,000 USD annually. (Used in the example: AWS Lambda 0.0000166667 USD per GB-second)
Assuming that the faster execution does not lead to more usage (no induced demand), more than 235 tons of CO₂ could be saved per year (100W CPU, 400g / kWh CO₂). This corresponds to planting a forest with approx. 200,000 m² and thus almost 30 football (soccer) fields (the German way of measuring large surfaces) of forest area.
Thank you Yanick, thank you Nils and thank you Jordi!
You have not only saved us time but also managed to get some breathing space for the whole planet!
Back to the news overview.