Why Mongodb performance better on Linux than on Windows?

前端 未结 2 2018
轻奢々
轻奢々 2021-01-03 02:11

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

相关标签:
2条回答
  • 2021-01-03 02:39

    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.

    0 讨论(0)
  • 2021-01-03 02:48

    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:

    • As for the filesystem speed: Comparing Filesystem I/O performance: RedHat Enterprise 6 vs. Microsoft Windows Server 2012
    • As for the inefficient RAM usage, you might want to check it for yourself. How much RAM does a given Windows Server system use while idling? How does this compare to any given Linux Server idling? Let's be nice and assume that the Windows server just needs 128M for its GUI - it is 128MB wasted. Multiplied by 20, which is not a big cluster size, we are talking of 2.5 GB – which could easily make up a config server or arbiter, if not more. And this would be spent on a GUI, for a system which seldomly needs one, if at all. As per hard facts, you might want to read Comparing CPU and Memory Performance: Red Hat Enterprise Linux 6 vs Windows Server 2012
    • As for the speed of the network stack, there are multiple sources, here are two which I tend to refer:
      • Measured Comparative Performance of TCP stacks, older, but we are talking of orders of magnitude, which at least gives an idea
      • Comparing Network Performance: Red Hat Enterprise Linux 6 vs Windows Server 2012

    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.

    0 讨论(0)
提交回复
热议问题