How does running NGINX on Windows 10 compare to running it on the Linux Subsystem?2nd Mar 2017
With the introduction of the Linux Subsystem in Windows 10 it drove me to wonder if running a Web Server will be faster in Ubuntu on Windows or Windows 10 alone - is the subsystem a VM or a part of the OS?
Windows 10 contains a plethora of UI updates and added features, one of them was the introduction of the Linux Subsystem. The Linux Subsystem is layer on Windows 10 that allows you to run Linux based software without the need to run Cygwin or MinGW. What happens is that Windows will install a version of Ubuntu that will lie in its own container - to call this container you simply type "bash" in Command Prompt.
If you're in to Web Development or Server management you've probably heard about NGINX - a scalable, fast and easy to use Web Server that has gained popularity over the, then bloated Apache Web Server.
NGINX is available for both Windows and Linux but is usually best run on a Linux server - what I will be testing here is to see if running NGINX on the Linux Subsystem will be faster than natively through the Windows binary on Windows 10.
To run my tests I have installed the latest Insider Preview build of Windows 10 Enterprise (Build 15025 at the time of this post) on VMWare Workstation with the following specifications:
- Core i7 6700K with 8 Processor Threads at 4Ghz
- 8GB DDR4 3200Mhz Memory
- 80GB M.2 SSD Storage
The tests were conducted on a snapshot of a clean, newly installed version of Windows 10 and the latest Mainline version of NGINX 1.11.10.I had used Apache Bench to benchmark the NGINX installation using the following command.
ab -n 25000 -c 50 http://SERVER_URL/windows.png
This will run an initial benchmark of 25000 connections and perform 50 concurrent requests at each time, the results will be run 3 times for each installation. After 5 tests I will double the load by pushing through 50000 connections and 100 concurrent requests to see both servers hold up.
Time taken to complete tests
Less is better
The chart below illustrates the time taken to complete the full test, this was recorded 5 times to see how well the server can keep intervals of load. The very first test showed that Linux had the edge over Windows but after a little "warm up", Windows handled the load faster than Linux.
Requests per second
Higher is better
This test will check to see how many requests the server is able to handle per second, how fast it can request and serve the requests to the client. The chart shows that Windows had the edge here with around a 100 request difference.
Just to test how much the web server can handle I'm going to double my requests and concurrency to see how the servers will cope, find the charts for Total time taken and requests a second below.
Time taken to complete test
As you can see on tests 2 and 4, the Linux subsystem couldn't provide the requests and timeouts did occur which gave the error:
apr_pollset_poll: The timeout specified has expired (70007)
Total requests a second
Windows took the edge here with an increase of around 300 requests a second, and the fact that Windows did not timeout on any test serves it as a better candidate here.
As you can probably see above, the tests showed that the Windows binary of NGINX performed better than the Linux binary in all cases - the test doesn't cover memory consumption but we can go with the assumption that there was no real difference - or notable difference around this. If you are planning on running a Windows system - NGINX through Windows will serve as a better candidate until the Linux subsystem improves.
Please note that this test was just for fun to see what we can achieve out of using the Linux tools available directly in Windows 10.