6

I created a programme to test sharded MongoDB performance on Linux(Ubuntu) and Windows(Server2008). With inserting large quantity of records, Windows's disk's active time is very high(100%), then performance is very bad. But on Ubuntu, the disk's util% is 60%~70%, and the performance is better than Windows. Can I say MongoDB performance better on Linux?

vjHuang
  • 71
  • 1
  • 1
  • 3

2 Answers2

13

First: all of the filesystems abailable on Windows 2008 server are very, very inefficient. Compared to XFS or ext4, they are up to 40% slower when both the Windows and Linux file systems are optimized.

Second: latency might be an issue. The network stack on a current Linux system simply is faster than on a W2008 server.

Third: if you have a firewall running on your box, latency becomes an even bigger problem for remote access. While Linux' iptables is fast and efficient enough so that the great part of firewall appliances is based on it, the firewalls available for Windows are not, for various reasons.

Plus: Windows is not as efficient with RAM as Linux is. MongoDB uses as much RAM as possible (up to the point it needs), for example for storing (copies of) index files in RAM. Windows takes a much larger share of the available RAM than a Linux machine. So index files might be read from disk than from RAM, which is orders of magnitude slower.

Bottom line: it is a Really Bad Idea™ to run a production mongoDB on a Windows system.

EDIT

As per request in the comments:

You might have recognized that I referenced three reports by Principled Technologies. While I am not affiliated with them in any way, IMHO they made a good job in comparing RHEL 6 and Windows Server 2012 by using industry standard benchmarks and explicitly optimizing both OSes for the task in question as well as using out of the box OSes.

One might argue that this comparison does not prove that all GNU/Linux distributions are faster than Windows Server 2012, the features we are talking about are ones provided by the Linux Kernel and are usually not fiddled with, so it is safe to assume that similar results can be expected from all major distributions.

With the in part extreme performance advantages of Linux (the TCP stack of Linux' is as much as almost 4 times as fast as Windows Server's for large message sizes, which tends to be the case in database applications), I renew my assertion that it is a Very Bad Idea™ to run a production MongoDB on a Windows System.

Markus W Mahlberg
  • 19,711
  • 6
  • 65
  • 89
  • Thanks very much~It's very helpful~ ^_^ – vjHuang Jun 13 '14 at 08:40
  • Can you provide references that support your comparisons? I mean the 40% slower file system, slower network stack, slower firewall, and inefficient RAM usage on Windows part. – Iravanchi Mar 19 '15 at 15:59
  • 1
    Thanks a lot. This is really interesting. Although, the reports are affiliated with RedHat, and I'd like to know what Microsoft has to say about this, or any similar reports from their side. – Iravanchi Mar 19 '15 at 19:15
  • @Iravanchi: As far as I can see, Principled Technologies is about fact based marketing. I honestly doubt that they would falsify or just bias any report, as they would be out of business instantly. – Markus W Mahlberg Mar 19 '15 at 20:26
  • I'm still trying to find updated benchmarks, but I do have to point out that the "Measured Comparative Performance of TCP Stacks" paper is *heavily* outdated and likely has little to no relevance to modern performance. Those benchmarks were performed in 2004-5, when GbE was barely a thing, when TCP offloading didn't exist, etc.. I know on the Windows side Vista had a major networking stack rewrite with incremental improvements since. Linux has definitely had many incremental improvements, but I'm not sure if a rewrite was involved. – Bob Jan 10 '17 at 03:43
  • @Bob Which na tendency implies that a rewrite improves things. Of which I am not convinced per se. – Markus W Mahlberg Apr 16 '17 at 14:36
  • @MarkusWMahlberg You can't use a Trademark symbol by Really Bad Idea™. I think that is Microsoft's motto. – Curt Apr 28 '22 at 23:41
1

You can say MongoDB's performance on Linux is better than Windows because unlike many other databases, MongoDB heavily rely on Operating System to perform Memory Mapped File operation as mentioned here. As mentioned in previous answer, Windows server 2008 FS is pretty slower than Linux FS (ext4) then it does make sense MongoDB will perform better on Linux than Windows. And it also depends on whether you have 32 bit or 64 bit system.

work_in_progress
  • 747
  • 1
  • 10
  • 27