Blog

PHP CMS comparisons #3 - Size and performance

Some people in the Statamic community have commented that my previous tests were unfair (or rather; dumb and crap).

Some arguments pointed towards 1: file size doesn’t matter, and 2: Statamic had «no caching and file watcher was on».

I'm not out here to talk any system down, and only try to fairly make comparisons for my own sake. But in any case, lets dive into the arguments:

1: File size doesn’t matter?

This is not about technical advantages or disadvantages, and people might see this differently than me, but my perspective is like this:

While file size might seem irrelevant to privileged users (often us developers), sitting on fairly new hardware and unlimited fiber-speed internet, its easy to forget that this is not the case for the whole world.

As a simple example comparison of the Kirby install of 6mb vs Statamic at 86mb: At 1 million installs it’ll be 6TB vs 86TB. This will likely be downloaded on local machines, but also on a server. Lets say 2 places (12TB data transfer vs 172TB) Maybe you even have multiple environments and separate installs.

Google estimates roughly 810 million wordpress websites as of 2023. Of course there aren’t as many Statamic, Craft, or Kirby sites. But still, why not lead by example? Data centres alone are responsible for 2.7% of the EU’s electricity demand. By 2030, their consumption is expected to rise by 28%.

The way I see it, at scale, filesize most definitely matters.

2: How about caching?

Just to make that clear from the bat: None of the CMSs in my previous test used caching. It was all fair game on even terms.

But ok, an argument could be made that one would anyway be caching, so therefore the tests were not realistic.

Even though I don’t personally agree to this, and don’t believe the majority of sites use caching, I still got interested to see how it looks if every system uses caching.

Some notes before results

  1. Wordpress was only tested uncached and cached with a plugin. https://www.boldgrid.com/w3-total-cache/. I didn’t find a "native" way to activate caching (without a plugin). Probably just me being dumb. Let me know if you know how!

  2. The three states tested on all the other systems were 1. uncached, 2. cached with the native simple caching mechanism: Craft CMS with {% cache %} tags. Statamic with file watcher off and cache strategy "half". And in Kirby with simply activating cache in the config.php. 3. Full static caching with NGINX rewrites.

  3. The "best case" caching serving static files (Statamic full cache, Craft CMS with Blitz, Kirby with Staticache and Wordpress with w3 total cache" are almost identical, and kind of useless data. All it does at this point is serve html-files without touching php, so they are just included to see the performance gains of that vs uncached and "simple" caching in each system.

  4. All numbers have been averaged based on three tests runs.

  5. I've done tests with OPcache activated and deactivated, apart from on the statically cached examples.

Results:

Response per second comparisons
Response time comparisons

Takeaways:

  1. OPCache makes a big difference.

  2. Kirby cached and uncached are less different than other systems. But regardless, with OPcache turned on Kirby is getting even close to the statically cached sites. Pretty impressive.

  3. Statamic uncached is quite bad.

  4. Craft CMS would really benefit from merging Blitz to core, to be able to offer what Kirby and Statamic does without third party plugins.

  5. Using Laravel Forge, performance was «as if» OPcache was active before actually activating it on the server. Turning it on and thereafter off substantially worsened the results. Is OPcache on by default even though it says it isn’t?

As always, feel free to reach out if you have feedback!

Mastodon
Bsky

PHP CMS comparisons #2 - Stress tests

After my post regarding the size of the codebase of multiple CMS’s, I’ve gotten some comments about the flaws of this approach.

As much as I agree that its too simplistic to make substantial conclusions from, I still believe it’s a great indicator.

However, I’ve been interested in diving a bit further into the performance aspects.

What will be tested?

I will use Locust for stress testing the different CMS’s with exactly the same html/css code, and the same amount of info in the CMS (very little).

Each CMS have been set up with a Tailwind UI premade template.

Image of the Tailwind UI page I use for the html / css

All images have been stored locally in a simple asset folder.

The only information stored as CMS content are:

  1. Title
  2. Lead paragraph
  3. Main image

So, in essence, the test checks all the boilerplate code of each system + a simple fetching of a few content fields.

Images are in all cases unoptimized, and just the same raw image as in the tailwindui examples.

Specs

I've followed the setup from Ben Croker to get up and running on Locust. Link

All sites are hosted on the same regular Digital Ocean Droplets: 1GB ram, - 1 CPU Core, 25gb ssd (6€ on Digital Ocean).

For each load test, we’ll have Locust spawn 10 users at a rate of 1 per second and allow it to run for 60 seconds.

Settings from Locust

Results:

(RPS refers to Requests per second)

–               RPS     Median response time
Static          537.6   15ms
Kirby           426.9   22ms
Craft CMS.      37.4    246ms
Wordpress       45.7    201ms
Statamic.       19.1    500ms

Details:

Static html file

This is our control test. The baseline pure static html (with a css file and the images of course).

Unsurprisingly the static variant is the one with the best results. Lowest median response rate at 15ms, and a RPS of 537.6.

Requests per second
Response time

Kirby

Version 3.9.7

RPS (requests per second) of 426.9, and an average (median) response time of 22ms. By far the best result (again).

Requests per second
Response times

Craft CMS

Version 4.5.6.1

RPS of 37.4 and a median response time of 246ms.

Pretty much 10 times as few requests per second compared to Kirby, and more than ten times the average response time. Still substantially better than Statamic though.

Requests per second
Response time

Wordpress

Version 6.3.2

Using the featured image, title and the_content() for Lead Paragraph.

RPS of 45.7 and a median response time of 201ms.

Second after Kirby, but still, pretty much 10 times slower response times with almost ten times less requests per second.

Requests per second
Response time

Statamic

A blank install of version 4.27.0.

Again, title, lead paragraph and an asset field for the hero section from the cp panel. Otherwise static html.

RPS of 19 and a median response time of 480ms

Requests per second
Response time

Why is it interesting?

Well, to me this is very interesting because it further cements my beliefs that a lighter code base causes less strain on the server, which again gives a leaner and quicker end result.

Of course the test is not perfect. If you do have insights and good ideas on how to further test this in more realistic ways, please reach out to me. I'm not trying to promote any particular system here, I'm just trying to get some basic facts on the table.

Thanks to

Big thanks to Ben Croker of https://putyourlightson.com for the inspiration to do these tests.

https://putyourlightson.com/articles/performance-testing-craft-cms-with-blitz

https://putyourlightson.com/articles/load-testing-craft-cms

In those, he is testing Craft CMS cached vs uncached, and also using a static html as comparison. Highly recommended reading. He is much more qualified at this than me, but I tried my best to follow his lead in this very interesting path of performance testing.

Forge, NGINX and Kirby CMS

I'm a big fan of Laravel Forge for provisioning servers.

Generally setting up a Kirby site is very straight forward, especially on Apache, but with default Forge setup (and Nginx) there are two small things that has tripped me up a few times already. That's why I make these notes for myself.

Disable Go helper function in Kirby

(because of a conflict with Swooles Go function)

# index.php

<?php

// Add in the line below
define('KIRBY_HELPER_GO', false);

require __DIR__ . '/kirby/bootstrap.php';

echo (new Kirby)->render();

Edit October 2024:

I've found a better way to do this is to disable the Swoole library in the php settings.

I add the following to the PHP FPM configuration:

swoole.use_shortname = Off
swoole.enable_library = Off

With this in place, I don't need to disable the helper function anymore in the index.php file.

Nginx config changes

On the site at hand, click the dropdown "edit files" and further "Edit Nginx configuration". Add the two following lines before the location

…

rewrite ^\/(content|site|kirby)/(.*)$ /error last;
rewrite ^\/\.(?!well-known\/) /error last;

// and it continues like normal…
location / {………

Links to Kirby docs on the topics:

Nginx boilerplate config
Deactivating Kirby helpers

Up and running on Kirby

Wow, I really didn't expect to have any readers at this point, but after my CMS filesize comparison post I've had a few people asking me for my RSS feed, which is really cool!

I've also been digging further into Kirby CMS lately, and felt the personal web page was a perfect starting point. So now this page is up and running on Kirby CMS (Version 4 beta 2 at the moment of writing this). Pretty cool!

The process of migrating from Craft CMS was really smooth. Of course – I know – my web page is not exactly content dense, so the "migration" was not really a big task.

So, some might be wondering. Why change from a free Craft Solo site to a paid Kirby site? Good question.

I really like the minimal approach Kirby takes to its CMS, and it aligns better with my personal needs and taste. I also wanted to "put my money where my mouth is". It also just currently feels much more fun, which is not to be underestimated!

Still though, Craft CMS is a great system. It just feels more business and enterprise to me (and feels to be moving even more in that direction). As a personal private web page it's not really a good fit.

Oh, and yeah, a RSS feed is now added! Thanks for the feedback!

Are we living in a digital plastic age?

"The average size of our sites doubled in the last 10 years. We honestly need to think about «digital degrowth».

We are not building better sites than 10 years ago. The quality does not match the resources we waste."

– Bastian Allgeier

https://youtu.be/cYvhYX2Nce4?si=rBCWHmr8O-Bc0uSD&t=2132

This really speaks to me.

I often think about wether its purely nostalgia, or any reasonable thought behind my need to simplify web development. I find it has gotten unnecessarily complicated the last decade, and often not resulting in better experiences on the web.

That's why I really get pulled towards tools that embrace this "less is more" attitude. One examples being Kirby CMS – "Just files and folders. Kirby stores your content in simple text files. Folders are pages. Add images, documents and videos and you are ready to go. It’s that simple.". It was also what attracted me to Perch CMS back in the day: "The really little content management system".

Its also what I always enjoyed about Apple and in particular Steve Jobs and Jony Ive, and the influential Braun designer Dieter Rams. "Less is more".

I guess its a general principle moreso than a specific topic of website development. But it becomes clearer and clearer for me that the path forward (for me) is in decluttering and simplifying. Focus on the essentials, and do them well.

Using Laravel Valet at the same time as DDEV

I mainly work with Craft CMS sites currently, and I made the switch from Laravel Valet to DDEV as per their suggestions last year.

Generally there is much to like about DDEV, especially the aspect of having different versions of PHP per project is a bit easier to maintain than it was in Laravel Valet, and to have this config directly in the project files. 

But I sure do miss the simplicity that Valet had. Just drop a folder into the parked folder, and its instantly available at foldername.test in the browser.

Especially seeing my newfound fascination for the flat file CMS Kirby, I really miss being able to just drop the folder in the Valet directory and be up and running.

So, now I run both side by side. This is how I've done it:

I've made two separate coding folders: One for my DDEV projects (Craft CMS), and one for Valet; my new "lightweight" quick work directory.

To avoid port-issues I set up DDEV projects using a specific port:

#config.yaml
router_http_port: "8080"
router_https_port: "8443"

This somehow still didn't allow me to ddev start my projects initially, because it still squirmed about port 433 being in use. So it was needed to do a ddev poweroff before the ddev start.

PHP CMS comparisons #1 - Filesize

People probably disagree with the usefulness of a blunt size-comparison between CMS'es. But I find it a great indication of complexity vs simplicity, tendencies of bloat, load times ++.

I only really care about PHP CMSes, and my testing list goes like this:

  • Craft CMS

  • Wordpress

    • To have a fair comparison I removed the included themes.
  • Statamic

    • "Blank Site" with no starter kit.
  • Kirby CMS

    • "plainkit" with no theme code included
  • As a fun little extra one I'll add Perch Runway, because I used that a lot back in the day, and always found its great advantage was its "lightness".

…and drumroll:

  1. The winner: Kirby CMS. Weighing in at 6.1MB it is miles ahead of (most) competitors.

  2. Runner up: Perch Runway. At 11.2MB it is almost double the size of Kirby, but still very light compared to the rest. Still, Perch is not actively maintained, and is not a good option for new projects in 2023. It is more included in this list because of my personal history using it.

  3. Wordpress: A whooping 54.9MB without any theme code is almost 10 times the size of Kirby. And we all know how much plugin and theme code usually gets added.

  4. Craft CMS: 70.8MB. My current go-to CMS. There is really a lot to love about Craft CMS, but the size of the codebase is not one of them.

  5. Statamic: 86.3MB. Laravel sure is a great framework underneath, but it definitely comes at a cost. The /vendor folder excluding the /statamic folder is 67MB alone.

I don't know about you, but I really like to live by the principle "as little code as possible", or rather "as little complexity as possible". I feel this is as good of an indicator as many.

As an aside: Statamic and Kirby does not use databases. Craft, Wordpress and Perch will have the added size (and complexity) of databases added on top. Another win for Kirby if you ask me.

Kirby sure is looking like an interesting option going forward. 🤔

Share your work

I saw this tweet the other day, and it resonated with me.

It hits me at the right moment, because I both try to convince myself that this blog has a reason to live, and at the same time try to convince myself to take my work less "seriously", and enjoy the process more.

I've been locked in a "never good enough" state all my life, and finally I think I'm old enough to let go of other peoples expectations and just roll with how things are.

It doesn't even have to be prosess / work, but it can also just be thoughts and unsorted ideas / inspirations.

Another big inspiration on that hand is Chris Coyier. He has always been a great inspiration when it comes to honestly sharing his work. I keep going back to his blog, because so much of the writing he does resonate with me. Not long ago he also made a convincing argument about using a blog as the "ultimate long term storage of ideas, bookmarks, tools and inspiration. I really like that idea.

I've been here many times before, and I might well not be able to follow through on this, but here's to trying!

Hare Brain, Tortoise Mind

I just finished a great little book from John Cleese called Creativity: A short and cheerful guide.

In it, he talked about a book and idea from Guy Claxton, called "Hare Brain, Tortoise Mind" (Which now is on my reading list).

The idea is that the "Hare Brain" involves 'figuring matters out, weighing up the pros and cons, constructing arguments and solving problems.' This is the classic problem-solving way of thinking relying on reason, logic and deliberate conscious thinking.

The most interesting part however, was the idea of the Tortoise Mind, and of its importance on creative work. The Tortoise Mind 'proceeds more slowly … It is often less purposeful and clear cut, more playful, leisurely or dreamy. In this mode we are ruminating or mulling things over, being contemplative or meditative. We may be pondering a problem, rather than earnestly trying to solve it'.

The crucial point being made is that this leisurely Tortoise Mind, for all its apparent aimlessness, is just as intelligent as the much faster 'Hare Brain'.

'When we are not sure what needs to be taken into account, or even which questions to pose – or when the issue is too subtle to be captured by the familiar categories of conscious thought … we need recourse to the tortoise mind.'

This also connects well together with something else I found very interesting, written by Billy Oppenheimer, regarding what the brain is doing when you are doing absolutely nothing.

The neuroscientist Dr. Nancy Andreasen did a study of brain activity when the brain is in a "resting state"—free of inputs/free to wander:
During REST, the brain "uses its most human & complex parts."
"We found activations in multiple regions of the association cortex," Dr. Andreasen wrote. "We were not [seeing] a passive silent brain during the ‘resting state,’ but rather a brain that was actively connecting thoughts and experiences.”

Dr. Andreasen writes about the study in her book, The Creating Brain: The Neuroscience of Genius

Sorting my Digital Life

As a continuation of my decision to move my life away from the Google Cloud I have finally started to take action.

I oftentimes watch a youtube video or two while eating lunch, and two days ago I got very inspired by Matt D'Avellas eposide on "I learned a productivity system for organizing life".
It is very much based on ideas from Tiago Forte, and ideas from his book "Building a Second Brain".

To me, building a Second Brain sounds too esoteric, but the core ideas of generally getting systems in place and organizing your digital life really appeals to me.

So now I have organized all my Apple Notes into the folders "Projects", "Areas", "Resources" and "Archives", and work on giving all kinds of information a clear home. Already two days in I feel it is working wonders. It both makes me want to write more (now that I know where to sort my thoughts), and also makes it way easier to find the information I look for.

Furthermore I also got inspired by the latest podcast discussions between Tim Ferriss and Derek Sivers called "Derek Sivers — The Joys of an Un-Optimized Life, Finding Paths Less Traveled, Creating Tech Independence (and Risks of the Cloud), Taking Giant Leaps, and Picking the Right “Game of Life” (#668)"
Here Derek Sivers goes at length about how one can create a more robust, tech independent direction with all your digital content. They talked a lot about contact and calenders, but for me photos and email are definitely most important.

Therefore I have finally started to take action now, and have done a full Takeout of my data at Google, and go through it piece by piece now, starting with my Photos and emails.

I do however not intend to go "cloudless" with my data. But I am making more intentional decisions this time around. So for Photos I add everything to iCloud. There are so many benefits to be able to have them easily available at my phone at all times, and it gives me great joy to look back at photos. I also share with my family often, and need a good solution for that.

I do have the plan to make a full backup-system of my photos on a yearly basis, and store that in a physical HD at least at one location.

As for email, I have already made the switch to Hey, and will continue that gradual change at all digital plattforms.