If you wanted to know if Azure and/or Windows runs your PHP apps slower than a Linux sever or even your local Mac, then read on! In this post, I’ll go over my experience of running some benchmark tests on all 3 of these environments and we’ll see which one reigns supreme.
Here are the specs of the three environments I’ve ran the benchmarks on.
- Mac – Macbook Air (Early 2015) Core i5-5250u, 4GB RAM
- Windows 10 – Core i7-2600 @ 2.8GHz, 8GB RAM
- Azure – Standard Tier
- Linux – Standard Run-of-the-mill Shared Hosting At Major Hosting Provider
In terms of the Mac and Linux environments, they are running the most recent version of Apache as of the of the year 2017. In addition, there is nothing special running on the server such as NGINX. I also want to point out that the Windows 10 machine is faster than the Macbook Air. All servers are running PHP 7+ in very close version proximity.
You can download and run the same PHP Benchmarking Test Scripts I use. There are 2 scripts along with a basic PHP Info output page. Just throw them onto the server and go straight to the page in your browser.
Here is the result of the bench 1 test.
- top-left = Shared Hosting
- top-right = Mac
- bottom-left = Azure
- bottom-right = Windows 10
As you can from the benchmark, the Windows servers really get bogged down from the native PHP string manipulation functions. Consider these stats….
- The Mac is 1.6x slower than the Linux Shared Hosting
- Azure is 2.5 slower than the Mac
- My Windows 10 box is 1.3x slower than Azure
- In the furthest range, which is the Linux Shared Hosting vs. the Windows 10 box. The Windows 10 box is 5.36x slower.
- Comparing hosting to hosting, Azure is 4x slower than the Linux Shared Hosting.
Here is the result of bench 2 test which allows us to get a deeper understanding to what string functions are causing some issues with the Microsoft platforms.
We can see that the main culprit functions are strtoupper, strtolower, number_format, and url_decode. This is concerning since all these functions are pretty common. I personally use the strto__ quite often to do case insensitive string comparisons, number_format for displaying money type data, and url_decode when I want to grab data from the URL. So with these benchmark tests in mind, and seeing the results, one must be weary of using these functions in a Windows environment.