We hesitated for a while, but we finally decided to put our money where our mouth is. Our website is now powered by PeachPie and runs on ASP.NET Core.
Our website is now powered by PeachPie 0.9, and runs like a charm!
Why did we wait until now?
If you’re thinking that it’s a good idea to at least have our own website run on PeachPie if we want to convince people to use the platform, you’ve got a fair point. Our website is written in WordPress and after all PeachPie has been able to compile and run WordPress for quite some time. So why wait?
First and foremost, PeachPie is still under development and we update the versions frequently, which means we also have to maintain our website accordingly. Secondly, we really wanted to make sure PeachPie is stable enough to run a website in production. And finally, albeit this is a fairly poor excuse, we were focused on other projects (like MediaWiki) and just didn’t get around to it for a few weeks.
However, it’s time to put our money where our mouth is and run our website on PeachPie as a proof of concept.
Our setup coming in
Peachpie.io used to run on PHP 5.6.33, namely on a slightly outdated version of WordPress (4.5.13) with a small number of plugins:
- Google comments widget
- Simple share buttons adder
- Syntax highlighter evolved
Our website runs on Microsoft Azure with a MySQL database (ClearDB) and the standard Azure PHP configuration.
Reasons to migrate
We frequently mention the benefits of running PHP applications on the secure, managed .NET platform, but the truth is that a relatively small personal website such as ours generally might not feel the need to migrate. We get about 200 unique visitors a day and we don’t currently have an e-shop, so performance really isn’t that big of a deal to us. In addition, PHP is doing an unbelievable job at improving its performance, as our latest benchmarks showed. However, there are other very realistic use cases even for a comparatively small website like ours.
Our website has been unreachable 27 times from August 2017 until February 2018 for a total downtime of over 9 hours. It was still available 99.33% of the time, but the frequent downtime could be a real headache for some websites. PHP on Azure is definitely not the most stable setup, but PeachPie can really provide an awesome fix for this issue. Another aspect is security, as the .NET web server monitors the appearance of each request and doesn’t allow for the processing of dangerous requests by default, e.g. those that contain a forbidden combination of characters that often indicates an attempt at SQL hacking.
Are there any downsides? For starters, we will always want to run on the latest version of PeachPie, so we will inevitably have to update our website with each new major release. Additionally, it may well be that our compiled site might be slower than the pure PHP form, and given that PeachPie is in version 0.9, not all aspects are that smooth yet. If we were to add new plugins, the process right now is slightly more complicated.
Peachpie.io on ASP.NET Core
Since about 2 weeks ago, we are officially running Peachpie.io on PeachPie. We have the same version of WordPress, and are running it on ASP.NET Core using the Kestrel web server, all of which powered by PeachPie 0.9 on Microsoft Azure.
As you can see from the request headers above, the
X-Powered-By: ASP.NET and
X-Powered-By: PeachPie 0.9.0-CI00862 indicate that our website definitely runs on ASP.NET, and there is no PHP running whatsoever.
For now, we just wanted to do this as a proof of concept that it is in fact possible to run a completely unmodified version of WordPress compiled under ASP.NET Core in a production setting. Speed-wise we’re getting virtually the same performance as we did with PHP, but we still have quite the powerful joker up our sleeves in the form of the ASP.NET response caching mechanism. We have yet to implement it, because there is quite a bit of configuration work to be done in order to make it work, but we experimentally tried it and our site loaded virtually instantly.
There are several things this switch enabled us to do:
- We shifted the complexity of configuring everything to the C# code with the help of the ASP.NET Core middleware
- We removed the dependency on a specific web server
- We can now write plugins and themes for WordPress in C#
- We can make use of the ASP.NET Core response caching mechanism, distributed memory cache and many others
- We obtained various tooling for diagnostics, performance analysis and exception handling from .NET
- Even PHP now runs stably on Azure with Windows Server
The main impact we see until now is the far superior stability of our site. Since migrating to .NET two weeks ago, our site has yet to be down – compare that to PHP as explained above. Also, we’re seeing quite a bit less CPU usage, which of course translates to a smaller spend on cloud processing time.
In any case, we kindly ask that you don’t read too much into it yet. This is merely a proof of concept, there are still imperfections and there is so much room for improvement in the performance department.