I ran across this great article, and was pleasantly surprised to see that #drupal is at the top of the charts for performance, especially for the latest version of #php. But - why?
On the surface, this doesn't make sense. Any average D10 site is probably one of the most complex #symfony apps in the world. When Drupal 8 was being built, I remember how the community found and patched a ton of edge case bugs in PHP and Symfony because it is SO BIG and so complex. So - how on earth can it possibly be more performant than Symfony itself or Laravel, or even close to CodeIgniter which is optimized for performance?
I'm sure that there are a number of reasons, but my gut tells me that one of the absolute biggest reasons is due to the incredibly advanced #caching layer. It is one of the biggest unsung heroes of the framework and one of the most amazing secrets.
Drupal not only caches responses for pages, but also for dynamic views. The views are cached at the query level AND the output level... and you can adjust caching on each. Plus, it has a fantastic cache tagging system, so you can clear not just a single cache item, or a cache bin, but a cache tag with any specifically relevant items that are related.
That means that if I update an image, it can not only clear the cache for the content using that image, but also all the views/blocks that display that content as well... and it can do this *without* clearing the entire cache.
As if that wasn't enough, Drupal provides advanced caching options for authenticated users who are often using a blend of common cache, auth cached content, and personalized content at the same time.
This is just a rough description of whats actually going on, but the BEST PART OF ALL is that none of us needs to know, or even care about it.
It. Just. Works. (most of the time)
When you build a Drupal application, you get this amazingly advanced caching for free - pre-configured and ready to go... and then you can tune and optimize it if you really care. Plus, your custom code can easily tie into the same system.
Folks love to bash on PHP as a language and Drupal as a framework because they are "old"... but they have evolved over time and make it easier to solve hard problems.
On the surface, this doesn't make sense. Any average D10 site is probably one of the most complex #symfony apps in the world. When Drupal 8 was being built, I remember how the community found and patched a ton of edge case bugs in PHP and Symfony because it is SO BIG and so complex. So - how on earth can it possibly be more performant than Symfony itself or Laravel, or even close to CodeIgniter which is optimized for performance?
I'm sure that there are a number of reasons, but my gut tells me that one of the absolute biggest reasons is due to the incredibly advanced #caching layer. It is one of the biggest unsung heroes of the framework and one of the most amazing secrets.
Drupal not only caches responses for pages, but also for dynamic views. The views are cached at the query level AND the output level... and you can adjust caching on each. Plus, it has a fantastic cache tagging system, so you can clear not just a single cache item, or a cache bin, but a cache tag with any specifically relevant items that are related.
That means that if I update an image, it can not only clear the cache for the content using that image, but also all the views/blocks that display that content as well... and it can do this *without* clearing the entire cache.
As if that wasn't enough, Drupal provides advanced caching options for authenticated users who are often using a blend of common cache, auth cached content, and personalized content at the same time.
This is just a rough description of whats actually going on, but the BEST PART OF ALL is that none of us needs to know, or even care about it.
It. Just. Works. (most of the time)
When you build a Drupal application, you get this amazingly advanced caching for free - pre-configured and ready to go... and then you can tune and optimize it if you really care. Plus, your custom code can easily tie into the same system.
Folks love to bash on PHP as a language and Drupal as a framework because they are "old"... but they have evolved over time and make it easier to solve hard problems.