A very common question that we get from our clients who are hesitant to migrate to Joomla 5 is: “Does it run any faster than Joomla 4”? Our answer is: “We don’t know, but we’ll soon run some benchmarks and get back to you!”
Well, we decided that soon is now. Here’s what we did to find the definitive answer to this question…
The Environment
For our benchmarking tests, we selected a dedicated server with the following specs:
- Processor: Intel Dual Xeon Gold 6226R (this processor has 32 cores)
- Memory: 128GB DDR4 SDRAM
- Main storage: SSD
- Database storage: NVMe SSD
- Operating system: AlamLinux 8
- Hosting environment: cPanel/ WHM
- PHP version: 8.2.16
- Database: MariaDB 10.6.17
The above server should handle a large Joomla website with many articles (provided the right core optimization is done).
The Setup
We created, on the above server, 2 cPanel accounts, one called joomla442 (to host the joomla442.com domain) and the other is called joomla502 (to host the joomla502.com domain). As you may have guessed, the first one is meant to host a test Joomla 4.4.2 website, and the second one is meant to host a test Joomla 5.0.2 website.
We then downloaded Joomla 4.4.2 and installed it on the first account, and then downloaded Joomla 5.0.2 and installed it on the second account. After that, we modified the hosts file of the server and our client machine to point the joomla442.com and the joomla502.com domains to the IP of the dedicated server that is hosting the above accounts (not being cheap or anything, but we really didn’t want to buy real domains just for this test).
We then created two unique articles on the first website and copied them to the second website. Both articles were about 1,000 words (if you’re curious, we used AI to auto-generate those articles, and if you’re really curious, the first article was about Medieval England, and the second article was about Medieval Switzerland – both interesting topics for history fans). We ensured that both of these articles were featured, and then we tested each domain and it correctly listed both articles on the homepage.
We did not make any modifications to the websites – we left all the default settings as they were and we did not publish/unpublish any of the plugins or the modules. We also did not install any extension whatsoever and we used the default template, which is Cassiopeia (in case you’re curious, Cassiopeia is the name of a constellation that has a few stars).
The next step was to install ab, which is the apache benchmarking tool (part of the httpd-tools package), by issuing the following command in the linux shell (as root):
yum install httpd-tools
Now we’re ready for the comparison between Joomla 4 and Joomla 5! Are you?
The Comparison
The methodology that we followed for comparing the Joomla 4 and Joomla 5 consisted of 4 areas: the total number of files, the total number of included files (on the homepage and the article page), the number of database queries (on the homepage and the article page), and the benchmarking.
- The total number of files
While not an important factor when it comes to performance, the total number of files in the Joomla folder indicates whether Joomla 5 is going in the right direction when it comes to removing unnecessary files that are no longer used, which is a great indicator of coding methodology. We are happy to say that this is the case, as Joomla 4 has 9,571 files, 3,293 folders, and a zipped size of 76.4 MB, while Joomla 5 has 8,989 files, 3,261 folders, and a zipped size of 69.6 MB. This means that the Joomla team has taken the initiative to reduce the technical overhead in the Joomla core.
-
The number of included files
The number of included files is (usually) inversely proportional to the performance of the website, that’s why we wanted to determine how many files each website is including/requiring when loading the homepage and an article page. We did this by adding the following code to the end of the index.php file in the root directory of each website:
$arrResult = get_included_files();
echo(count($arrResult));We then loaded each website on the homepage and on the same article page.
- Homepage
For the Joomla 4 website, the number of included files was 581, for the Joomla 5 website, the number of included files was 660, 13.60% more files than Joomla 4 (79 more files are loaded in Joomla 5).
- Article page
For the Joomla 4 website, the number of included files was 590, for the Joomla 5 website, the number of included files was 668, 13.22% more files than Joomla 4 (78 more files are loaded in Joomla 5).
Clearly, the results are disappointing as Joomla 5 is including almost 80 more files on both the homepage load and the article page load. What is interesting though was that the number of additional files is almost the same in both tests, which means that something is running on all pages that is requiring those additional files – naturally, we investigated further!
We compared the included files on Joomla 4 with those on Joomla 5, and the biggest difference that we noticed was the additional inclusion of the Fields plugins’ files, the Schema.org plugins’ files, and some events files. Here are the main files that we think are problematic and should not be included on every page load:
libraries/src/Event/AfterExtensionBootEvent.php
libraries/src/Event/Application/AfterDispatchEvent.php
libraries/src/Event/Application/AfterInitialiseDocumentEvent.php
libraries/src/Event/Application/AfterInitialiseEvent.php
libraries/src/Event/Application/AfterRenderEvent.php
libraries/src/Event/Application/AfterRespondEvent.php
libraries/src/Event/Application/AfterRouteEvent.php
libraries/src/Event/Application/ApplicationDocumentEvent.php
libraries/src/Event/Application/ApplicationEvent.php
libraries/src/Event/Application/BeforeCompileHeadEvent.php
libraries/src/Event/Application/BeforeRenderEvent.php
libraries/src/Event/Application/BeforeRespondEvent.php
libraries/src/Event/BeforeExtensionBootEvent.php
libraries/src/Event/Content/AfterDisplayEvent.php
libraries/src/Event/Content/AfterTitleEvent.php
libraries/src/Event/Content/BeforeDisplayEvent.php
libraries/src/Event/Content/ContentEvent.php
libraries/src/Event/Content/ContentPrepareEvent.php
libraries/src/Event/Model/BeforeValidateDataEvent.php
libraries/src/Event/Model/FormEvent.php
libraries/src/Event/Model/NormaliseRequestDataEvent.php
libraries/src/Event/Model/PrepareFormEvent.php
libraries/src/Event/Module/AfterCleanModuleListEvent.php
libraries/src/Event/Module/AfterModuleListEvent.php
libraries/src/Event/Module/AfterRenderModuleEvent.php
libraries/src/Event/Module/AfterRenderModulesEvent.php
libraries/src/Event/Module/BeforeRenderModuleEvent.php
libraries/src/Event/Module/ModuleEvent.php
libraries/src/Event/Module/ModuleListEvent.php
libraries/src/Event/Module/PrepareModuleListEvent.php
libraries/src/Event/Module/RenderModuleEvent.php
libraries/src/Event/Plugin/System/Schemaorg/BeforeCompileHeadEvent.php
libraries/src/Event/ReshapeArgumentsAware.php
libraries/src/Event/Result/ResultAware.php
libraries/src/Event/Result/ResultAwareInterface.php
libraries/src/Event/Result/ResultTypeArrayAware.php
libraries/src/Event/Result/ResultTypeStringAware.php
libraries/src/Event/User/LoginButtonsEvent.php
libraries/src/Schemaorg/SchemaorgPluginTrait.php
libraries/src/Schemaorg/SchemaorgPrepareDateTrait.php
libraries/src/Schemaorg/SchemaorgPrepareDurationTrait.php
libraries/src/Schemaorg/SchemaorgPrepareImageTrait.php
libraries/src/Schemaorg/SchemaorgServiceInterface.php
libraries/src/Schemaorg/SchemaorgServiceTrait.php
plugins/fields/calendar/services/provider.php
plugins/fields/calendar/src/Extension/Calendar.php
plugins/fields/checkboxes/services/provider.php
plugins/fields/checkboxes/src/Extension/Checkboxes.php
plugins/fields/color/services/provider.php
plugins/fields/color/src/Extension/Color.php
plugins/fields/editor/services/provider.php
plugins/fields/editor/src/Extension/Editor.php
plugins/fields/imagelist/services/provider.php
plugins/fields/imagelist/src/Extension/Imagelist.php
plugins/fields/integer/services/provider.php
plugins/fields/integer/src/Extension/Integer.php
plugins/fields/list/services/provider.php
plugins/fields/list/src/Extension/ListPlugin.php
plugins/fields/media/services/provider.php
plugins/fields/media/src/Extension/Media.php
plugins/fields/radio/services/provider.php
plugins/fields/radio/src/Extension/Radio.php
plugins/fields/sql/services/provider.php
plugins/fields/sql/src/Extension/SQL.php
plugins/fields/subform/services/provider.php
plugins/fields/subform/src/Extension/Subform.php
plugins/fields/text/services/provider.php
plugins/fields/text/src/Extension/Text.php
plugins/fields/textarea/services/provider.php
plugins/fields/textarea/src/Extension/Textarea.php
plugins/fields/url/services/provider.php
plugins/fields/url/src/Extension/Url.php
plugins/fields/user/services/provider.php
plugins/fields/user/src/Extension/User.php
plugins/fields/usergrouplist/services/provider.php
plugins/fields/usergrouplist/src/Extension/UsergroupList.php
plugins/schemaorg/blogposting/services/provider.php
plugins/schemaorg/blogposting/src/Extension/BlogPosting.php
plugins/schemaorg/book/services/provider.php
plugins/schemaorg/book/src/Extension/Book.php
plugins/schemaorg/event/services/provider.php
plugins/schemaorg/event/src/Extension/Event.php
plugins/schemaorg/jobposting/services/provider.php
plugins/schemaorg/jobposting/src/Extension/JobPosting.php
plugins/schemaorg/organization/services/provider.php
plugins/schemaorg/organization/src/Extension/Organization.php
plugins/schemaorg/person/services/provider.php
plugins/schemaorg/person/src/Extension/Person.php
plugins/schemaorg/recipe/services/provider.php
plugins/schemaorg/recipe/src/Extension/Recipe.phpThe inclusion of the Fields files, in particular, was concerning. We thought that the latest version of Joomla 4 had those plugins disabled by default, and that’s why they were not included, but a quick check revealed that all the Fields plugins were enabled on Joomla 4, but Joomla 4 had enough intelligence to know that they were not being used, and hence they were not included. The same can’t be said about Joomla 5, that is also including the unused Schema.org plugins. As for the event files, such as the AfterExtensionBootEvent.php, we didn’t want to investigate, but we highly suspect that the website can run without them loading on every page.
To its credit, Joomla 5 is no longer including about 24 files that were included in Joomla 4 on every page load.
Why do we think that this has anything to do with performance?
Every file include (whether used or not) is an overhead that, to a certain degree, impacts the performance of the website negatively. Joomla 4 is much better in that area.
- Homepage
-
The database queries
Judging from the additional number of included files on every page load in Joomla 5 – we were not very optimistic about the database queries, as we had a hunch that Joomla 5 will also disappoint us in the “database” area.
In order to do the test, we added, for each website, the following code to the libraries/vendor/joomla/database/src/DatabaseDriver.php at the very beginning of the execute function, just before the $this->connect() function call:
$sqlQuery = $this->replacePrefix((string) $this->sql);
file_put_contents("queries.txt", $sqlQuery."\n", FILE_APPEND | LOCK_EX);The above code writes all the queries to the queries.txt file under the root directory of the Joomla website. We first tested the homepage, and, to our surprise and delight, the queries were exactly the same. Not one single difference (other than the table alias, of course)! We didn’t believe it, considering the number of additional files Joomla 5 was loading, so we repeated the test multiple times, and every time we had the same results!
We then tested a single article page, and also had the exact same list of queries for both websites, with just one difference: Joomla 5 ran the following additional query:
SELECT *
FROM `#__schemaorg`
WHERE `itemId` = :itemId AND `context` = :contextAs you may have guessed, the above query is caused by the new Schema.org plugin(s) (which, in our opinion, should be disabled by default).
So, from our little experiment, we confirm that Joomla 5 has negligible additional overhead over Joomla 4 in the database department. This is to prove that sometimes our “hunch” can be wrong.
-
The benchmarking
For most non-technical people, this is what really matters: the benchmarking. Which Joomla performs better? If you read through the whole article, then you may have seen signs that suggest that Joomla 5 is slightly slower, mainly because of the additional included files, and the minute database overhead, but let’s do some tests to make sure.
ab is the ideal Apache benchmarking tool, and it works by issuing the following command in the Linux shell:
ab -c 10 -t 10 "http://www.joomla442.com/"
The above command means that we are sending 10 concurrent requests (
-c 10
) over 10 seconds (-t 10
) to the joomla442.com website.So, we ran ab on both sites, and here are the results:
ab -c 10 -t 10 "http://www.joomla442.com/" Benchmarking www.joomla442.com (be patient) Finished 368 requests Server Software: Apache Server Hostname: www.joomla442.com Server Port: 80 Document Path: / Document Length: 35062 bytes Concurrency Level: 10 Time taken for tests: 10.020 seconds Complete requests: 368 Failed requests: 0 Total transferred: 13107792 bytes HTML transferred: 12902816 bytes Requests per second: 36.72 [#/sec] (mean) Time per request: 272.295 [ms] (mean) Time per request: 27.230 [ms] (mean, across all concurrent requests) Transfer rate: 1277.44 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 247 264 9.9 262 317 Waiting: 239 254 9.7 252 306 Total: 247 264 9.9 262 317 Percentage of the requests served within a certain time (ms) 50% 262 66% 263 75% 265 80% 265 90% 270 95% 287 98% 301 99% 307 100% 317 (longest request) ab -c 10 -t 10 "http://www.joomla502.com/" Benchmarking www.joomla502.com (be patient) Finished 344 requests Server Software: Apache Server Hostname: www.joomla502.com Server Port: 80 Document Path: / Document Length: 35825 bytes Concurrency Level: 10 Time taken for tests: 10.010 seconds Complete requests: 344 Failed requests: 0 Total transferred: 12515408 bytes HTML transferred: 12323800 bytes Requests per second: 34.37 [#/sec] (mean) Time per request: 290.992 [ms] (mean) Time per request: 29.099 [ms] (mean, across all concurrent requests) Transfer rate: 1220.97 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 0 Processing: 267 280 10.4 277 327 Waiting: 258 270 9.9 268 317 Total: 267 280 10.4 277 327 Percentage of the requests served within a certain time (ms) 50% 277 66% 279 75% 280 80% 282 90% 290 95% 308 98% 314 99% 320 100% 327 (longest request)
We highlighted the important numbers in bold red, and they are the Complete Requests (which indicates the number of performed requests in 10 seconds) and the Time per request (which indicates the time it takes to process each request). As you can see, Joomla 4 performed 368 requests in 10 seconds, where the mean request time is 272.3 milliseconds. Joomla 5 performed 344 requests in 10 seconds, where the mean request time is 290.9 milliseconds. This small benchmarking test indicates that Joomla 5 is 6.83% slower than Joomla 4.
But, what if we increase the number of concurrent request from 10 to 20 to 30, etc… What will the results be?
Here comes the chart!
Figure 1: Joomla 4.4.2 vs Joomla 5.0.2 You can clearly see, from the above chart, that Joomla 4 outperforms Joomla 5 consistently.
Note: We didn’t install the blog sample data in our tests because we were not sure that the data was the exact same on both Joomla 4 and Joomla 5. But, for those of you who insist that we try the benchmarking test with the sample data, we installed the sample data after finishing the main tests, and the results were pretty much the same, where Joomla 4 has a slight edge over Joomla 5.
Another note: We repeated the same benchmarking on an article page, and, while Joomla 4 still fared consistently better, the difference was really negligible (less than 0.2%).
So, there you have it: with the exception of the number of files/folders in the installation file (which is really the least important factor), Joomla 4 is slightly faster/more optimized than Joomla 5 in every single aspect, just like Joomla 3.8.1 is slower than Joomla 3.7.5. There is still hope though for those of you who want to have a super fast Joomla 5 website, you can contact us, and not only we will help you match Joomla 4’s performance, we will also help you beat it (our fees apply)!