First WordPress benchmark

It’s been a while since we produced any benchmarks, so it’s time to put Peachpie to the performance test again. And it’s not going to be a small one – this time, we will benchmark an entire real world application in WordPress.

Recap

The Peachpie project aims to treat PHP as a natural compiled language of the .NET platform, right alongside C#, VB and F#. One of the consequences of this is that it allows developers to bring their projects over from the PHP platform to .NET and .NET Core and take advantage of everything they have to offer. One of the most tangible benefits of such a migration is .NET’s performance and we’ll take a closer look at this today.

Results

Let’s start off right away by showing the results of our benchmarks, because that’s what you’re here for, but first things first. We are running a freshly installed version of WordPress 4.7, a MySQL database running on Docker and a standard ThinkPad laptop with a low voltage Core i7 processor and two platforms – .NET Core 2.0 and the latest Apache server with PHP 7.2. If this configuration is relevant to you, please carry on reading. For the first test we set up four concurrent users and 128 requests to the WordPress home page.

Peachpie 0.9

Server Software:        Kestrel
Server Hostname:        127.0.0.1
Server Port:            5004

Document Path:          /
Document Length:        51356 bytes

Concurrency Level:      4
Time taken for tests:   7.733 seconds
Complete requests:      128
Failed requests:        0
Total transferred:      6599552 bytes
HTML transferred:       6573568 bytes
Requests per second:    16.55 [#/sec] (mean)
Time per request:       241.656 [ms] (mean)
Time per request:       60.414 [ms] (mean, across all concurrent requests)
Transfer rate:          833.43 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:   177  241  30.1    239     329
Waiting:       84  127  22.8    125     188
Total:        177  241  30.1    239     329


Apache 2.4.29 + PHP 7.2

Server Software:        Apache/2.4.29
Server Hostname:        127.0.0.1
Server Port:            5004

Document Path:          /
Document Length:        51425 bytes

Concurrency Level:      4
Time taken for tests:   10.879 seconds
Complete requests:      128
Failed requests:        0
Total transferred:      6616576 bytes
HTML transferred:       6582400 bytes
Requests per second:    11.77 [#/sec] (mean)
Time per request:       339.969 [ms] (mean)
Time per request:       84.992 [ms] (mean, across all concurrent requests)
Transfer rate:          593.94 [Kbytes/sec] received

The two numbers that are relevant here are requests per second and time per request. Peachpie’s 16.55 req/sec outperforms PHP 7.2’s 11.77 req/sec and its time of 60.414 ms/req also beats PHP’s 84.992 ms/req comfortably. The following two graphs visualize the significant difference here:


This means that Peachpie can serve about 40% more requests per second than PHP 7.2 and serves the average request 40% faster than PHP. And this is by no means the final number, as we have not focused on code optimization at all yet. There should still be a lot of room for improvement left. For the sake of completeness, let's also take a look at different types of pages in WordPress and various concurrency levels, using the same exact methodology:

Home Page requests/second (more is better)

Blog post requests/second (more is better)

As you can see, the trend is the same, as Peachpie can consistently serve more requests per second than PHP 7.2 can, but the difference gradually evens out if we increase the concurrency. The most notable difference can be observed with just one user requesting the respective page, particularly the blog post, where Peachpie was able to serve more than twice as many requests per second.

Disclaimer

First and foremost, we don't consider ourselves benchmarking experts by any stretch of the imagination. There may be flaws to our methodology and if you have any improvement ideas, we are more than happy to hear constructive criticism. However, please understand that we are only interested in a comparison on the Windows platform. We are testing PHP and Peachpie on Windows, not some distro of Linux with a very particular configuration of PHP etc. Also, we received some requests to test with php-fpm and Nginx against Apache, for example - if you are interested in how this would pan out, please go for it. Another important point is that the numbers are by no means final. We are thrilled that they turned out as good as they did, but we are nowhere near done with optimizing. We are certain that there is still a ton of space for tweaks and improvements, so we'll definitely repeat these benchmarks after a round of code optimizations.

Test hardware

  • Ordinary Lenovo ThinkPad Yoga 260 laptop
  • Core i7 6500U @ 2.5 GHz, 2 physical core, 4 logical cores
  • 8GB DDR4 @ 2133MHz
  • Disk 0 (C:) SSD 250GB, SAMSUNG MZNLN256HCHP-000L7, Average response time 6,1 ms

Test software

  • Windows 10 Pro, x64, Version 1709
  • MySQL running on Docker (image "mysql")
  • .NET Core 2.0 + Peachpie 0.9.0-CI00684 (Release) (build from here)
  • xampp-win32-7.2.1-0-VC15 - Apache 2.4.29 + PHP 7.2.1
  • ApacheBench, Version 2.3 (ab.exe)
Edit: We didn't do any configuration of PHP, which was all done by XAMPP. Therefore, we also didn't manually enable opcache, which may have a significant influence on the performance of PHP if not enabled by default.

Test procedure

To see how to run WordPress with Peachpie, please refer to our tutorial on this topic or check out the video that shows all the steps in detail. wp-home After a clean installation of WordPress, we set up concurrent requests using the well known ApacheBench tool. For this benchmark, we chose 4 concurrent users making 128 requests. After that, we switched to PHP 7.2 and Apache and made the same benchmarks with the aforementioned settings.

Conclusion

The benchmarks above are the first benchmarks we produced for an entire real-world application. They serve as a good first indication of what's possible for PHP with the power of the Peachpie and .NET platforms. However, they are by no means final. We have yet to give performance enhancing optimizations a detailed look, as we are completely focusing on getting Peachpie to version 1.0. There are hundreds of possible tweaks that can be made that are likely to increase the performance even more.

What can we say, though - kudos to PHP for the amazing performance enhancements they have made. Most benchmarks we saw indicate that WordPress on PHP 7.0 is about twice as fast as it was on PHP 5.4, so the improvements to the platform over the last couple of years are truly astonishing.

Also, we encourage everyone to think of Peachpie not just as a tool that helps speed up PHP applications, but also as a platform that enables you to develop with .NET and PHP side by side within one project. We will continue producing benchmarks for various applications from time to time to monitor the progress of our development. There will be other major real-world projects to add to the portfolio of apps you can already run on Peachpie very soon, so stay tuned for updates!

Share this article:Share on FacebookShare on VKPin on PinterestShare on Google+Tweet about this on TwitterShare on LinkedInShare on Reddit