为什么在Linux上Mongodb的性能要比Windows更好? [英] Why Mongodb performance better on Linux than on Windows?

查看:603
本文介绍了为什么在Linux上Mongodb的性能要比Windows更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个程序来测试Linux(Ubuntu)和Windows(Server2008)上的分片MongoDB性能. 随着插入大量记录,Windows磁盘的活动时间非常长(100%),然后性能很差.但在Ubuntu上,磁盘的util%为60%〜70%,性能优于Windows. 我可以说MongoDB在Linux上的性能更好吗?

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?

推荐答案

首先:Windows 2008服务器上所有可用的文件系统效率非常非常低.与XFS或ext4相比,在同时优化Windows和Linux文件系统的情况下,它们的速度降低了40%.

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.

第二:延迟可能是一个问题.当前Linux系统上的网络堆栈仅比W2008服务器上的网络堆栈快.

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

第三:如果您的计算机上正在运行防火墙,则延迟成为远程访问的更大问题.尽管Linux的iptables足够快速高效,因此大部分防火墙设备都基于Linux,但是出于各种原因,Windows可用的防火墙却没有.

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在RAM方面的效率不如Linux. MongoDB使用尽可能多的RAM(直至所需数量),例如用于在RAM中存储(副本)索引文件. Windows占用的可用RAM份额比Linux机器大得多.因此索引文件可能是从磁盘读取的,而不是从RAM读取的,这要慢几个数量级.

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.

最重要的是:在Windows系统上运行生产mongoDB是一个Really Bad Idea™.

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

编辑

根据评论中的请求:

  • 关于文件系统速度: 比较文件系统I/O性能:RedHat Enterprise 6与Microsoft Windows Server 2012
  • 对于低效的RAM使用率,您可能需要自己检查一下.闲置时,给定的Windows Server系统使用多少RAM?这与任何给定的Linux Server空转相比如何?很好,假设Windows服务器的GUI仅需要128M -浪费了128MB.乘以20(这不是一个很大的集群大小),我们说的是2.5 GB-如果不多的话,可以很容易地组成配置服务器或仲裁器.对于根本很少需要一个系统的系统,这将花费在GUI上.根据事实,您可能想阅读 比较CPU和内存性能:Red Hat Enterprise Linux 6 vs Windows Server 2012
  • 关于网络堆栈的速度,有多种来源,以下是我倾向于引用的两种来源:
    • 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

      您可能已经认识到我引用了Principled Technologies的三份报告.虽然我与他们没有任何关系,但恕我直言,他们通过使用行业标准基准测试并比较优化了两种OS以解决相关任务以及使用现成的OS,在比较RHEL 6和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.

      可能有人争辩说,这种比较并不能证明所有GNU/Linux发行版都比Windows Server 2012快,我们正在谈论的功能是Linux内核提供的功能,通常不会被打扰,因此可以安全地进行假设所有主要分布都可以预期得到类似的结果.

      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.

      在某种程度上具有Linux的极端性能优势(对于大型消息,Linux的TCP堆栈的速度几乎是Windows Server的4倍,在数据库应用程序中通常如此),我续订了我的文章.断言在Windows系统上运行生产MongoDB是很不好的主意.

      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.

      这篇关于为什么在Linux上Mongodb的性能要比Windows更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆