Mysql on Windows vs Linux

I was working on optimizing a Mysql database today and accidentally stumbled upon a benchmarking exercise. The original Mysql database is hosted on a Windows Server 2003. I develop on a Mysql database server running on Ubuntu Linux. The Linux server ran the same query twice as fast as the Windows server without using caching or anything. I know that Linux does I/O caching on its own as well so I even tried running the query after a fresh reboot to rule out that factor. Then I got help from a colleague and started tweaking with the my.cnf/my.ini to make sure they were the same and each time, the results came back about the same. Mysql on Windows was consistently slower than Mysql on Linux.

Then we decided to load the database onto other servers for more data points on this Mysql performance test. We ran the same query returning 429 rows of data with 13 table joins and a couple of sub-queries. All queries were run on the command line client on the servers themselves to avoid network lag.  All servers are running Mysql 5.0.x.

Results

1. Ubuntu Linux: 0.70 seconds
2. CentOS: 0.78 seconds
3. Windows 2003 Server: 1.40 seconds
4. Windows 2003 Server: 1.42 seconds

Server hardware

1. Ubuntu Linux
AMD ATHLON 64 X2 4200+
2GB DDR400
200GB 7200RPM SATA/150

2. CentOS
Dual Opteron 240
2GB DDR ECC
120GB 7200RPM SATA/300

3. Windows 2003 Server
Dual Xeon
2GB DDR ECC
7200RPM PATA

4. Windows 2003 Server
2 Dual Xeon (4 CPUs)
8GB DDR ECC
3 73GB 10,000RPM SCSI in RAID 5

A followup to the benchmark that clarifies the cause of the differences

3 thoughts on “Mysql on Windows vs Linux”

  1. quite interesting benchmark. would appreciate if you could also elaborate a bit more on the processor specifics for the Windows box as that could as well justify the difference between the Linux run.

    I run both Linux and Windows MySQL datastores from time to time and would prefer to stick with Linux/MySQL if not for budget constraints. However, a Windows/MySQL combo would also do good with the following enhancements:

    – 7200 (or upwards RPM) HDD that’s partitioned with a 16k cluster for the drive that carries the MySQL database itself (hence less reads with larger chunks — as compared to the default 4k or 8k that’s got higher read rates). NOTE that this also has it’s drawbacks for certain situations where the database still isn’t huge enough to maximize this configuration. The less trips to the physical disk, the better…. therefore…

    – …4 to 8gb of RAM would also be a good standard for Windows boxes running MySQL

    – if using a quad-core processor on Windows, I’ve found that setting the priority a bit higher on the mysql process itself (especially for days that reporting and queries are heavy) helps a lot

    – of course, both on Linux and Windows boxes, a gigabit network and proper switch system would help

Leave a Reply

Your email address will not be published.