This site uses cookies to offer you a better browsing experience. Find out more on Privacy Policy.

Docker and PHP Performance on Windows

May 30, 2017 Kamil Purzyński


Docker is a promising tool, which helps to set up different environments such as the development, test, and production environments; and its golden age just has begun. With Docker, you are able to configure the environment so that it is easy to use for other team members. People who use Docker know how valuable it is.

I have been using Docker for a year and I have been enjoying it so much that I cannot imagine my job without it. I work on the Windows operating system but I am also familiar with Linux. Everyone knows that Linux is faster for software development but I wanted to measure how fast it really is in order to choose the best configuration for myself. That is why, I did several performance tests and this article aims to describe them.

Test environments

As I have written above, I work on the Microsoft Windows operating system, so please be aware that each time I say something about Linux I am referring to a system operating in a virtual machine (as I did not natively install Linux on my computer). Below you can find a list of three environments in which I performed the tests:

  • Virtual machine with Docker for Linux
  • Docker for Windows 10 (Professional/Enterprise)
  • XAMPP (working natively on Windows)

Computer specification:

  • Intel Core i5-4570 CPU 3.20 GHz
  • RAM: 16GB
  • Hard Disk: Samsung SSD 850 EVO 256 GB
  • Windows 10 Enterprise x64

VirtualBox resources were reduced to half of CPU power and 4GB of memory. Requests were only handled through a host adapter.

Research

Before starting my research, I had prepared a repository with a Docker configuration that I had written and a PHP code. I intended to create a configuration, which would be similar to the default XAMPP configuration. I then started thinking about which code I could test and I recalled my favourite framework – the Symfony 3 demo repository. The code in the repository is a blog application; there is an admin panel and a few basic features. Below you can find the link to my repository on GitHub:

https://github.com/kamil-p/docker-performance-apache-php7-mariadb

During my tests, I rendered two different pages:

  • a list of blog posts
  • a blog post editing form (involving security logic)

I used jMeter to prepare two test plans. Each plan assumed that it would execute 1,000 requests and measure the response time. The results are presented in two diagrams: i) a rendered list of blog posts, ii) a rendered blog post editing form. On each diagram, you can find the response time in milliseconds (y axis) and a request number (x axis). The results are provided for three environments:

  • Ubuntu Server with Docker operating in a virtual machine
  • Docker for Windows (Docker for Professional/Enterprise edition)
  • XAMPP

The results of a rendered list of blog posts:

The results of a rendered blog post editing form:

Below I have attached an Excel file with the results made available for public inspection.
Test results

As you can see, Docker on a virtual machine proved to be the fastest. This result surprised me because a virtual machine has reduced resources (half of CPU power and 4GB of memory) and works on top of Windows. XAMPP seemed to be the slowest; however, this result probably comes as no surprise to anyone. What is also worth noting is the difference between the fastest and the slowest response time for each environment. As you can see, Docker for Linux is very stable but I would not say this for XAMPP or Docker for Windows. When we compare request response times, we can see huge differences between the results, as, sometimes, the fastest request is even five times faster than the slowest.

Conclusion

The aim of my study was to find reasons for why there are such big differences between those three environments. For both Linux and Windows, I used Docker so I can assume that the containers were the same. The only difference was that, for Linux, all files were stored in a virtual machine (Linux side) so they rely on the EXT3 file system, and for Windows all files were stored on the NTFS file system. I found a couple of articles comparing the performance of EXT3 and NTFS, which indicated that EXT3 was a lot of faster than NTFS. The most interesting article I found was the 2009 text, “On Benchmarking Popular File Systems”, by Matti Vanninen and James Z. Wang. It definitely shows that EXT3 performs better than NTFS when the file size is smaller than the CPU cache and that this is a normal PHP interpreter operation. However, those articles were published quite some time ago – between 2009 and 2012. In order to make sure that the results discussed in those sources are still relevant, we would need to do more research.

Last posts