简体   繁体   English

MongoDB在服务器上的读取性能非常慢

[英]MongoDB very slow read performance on server

Basically, I have a Windows service which performs a batch job. 基本上,我有执行批处理作业的Windows服务。

I have two collections that are related, customerAccounts and events. 我有两个相关的集合,customerAccounts和事件。 The events collection logs actions that customers performed on a site, containing the timestamp, the name of the event, the page it occurred on and the username. 事件收集记录客户在站点上执行的操作,包括时间戳,事件名称,发生的页面以及用户名。

The service runs through each account and works out their journey phase and risk of account closure based on what events they have in the Events collection and a set of user-defined rules. 该服务遍历每个帐户,并根据其在事件集合中具有的事件和一组用户定义的规则,计算出其旅行阶段和帐户关闭的风险。

There are about 3,500 accounts and around 100,000 events in my database at present. 目前,我的数据库中大约有3500个帐户和大约100,000个事件。 The service takes just over 1 minute to run on my development PC, but takes seemingly forever on the server (I've estimated it takes roughly 2.5 hours based on modifying the service so it only performs the job on a single customer account. 在我的开发PC上运行该服务仅需一分钟多一点,但在服务器上却要花很长的时间(我估计修改该服务大约需要2.5个小时,因此只能在一个客户帐户上执行该工作。

My machine is a Core i7 with 16GB of RAM, the server is an Intel Xeon E5-2609 (64bit, Win 2008 R2) with 24GB of RAM. 我的机器是具有16GB RAM的Core i7,服务器是具有24GB RAM的Intel Xeon E5-2609(64位,Win 2008 R2)。 I put the database on a much older server (32bit, Windows 2003) and the service took about 2 minutes to run. 我将数据库放在一台更旧的服务器(32位,Windows 2003)上,该服务运行了大约2分钟。 So, I know that on my dev machine it takes just over a minute, and on older server hardware it takes just over 2 minutes, yet on a modern server it's taking a matter of hours. 因此,我知道在我的开发机上只需要一分钟多的时间,而在较旧的服务器硬件上只需要2分钟多的时间,而在现代服务器上则需要几个小时。

Originally, the Mongo Shell was warning that NUMA was enabled on the server and should be switched off to avoid performance problems. 最初,Mongo Shell警告服务器上已启用NUMA,应将其关闭以避免性能问题。 This has since been turned off but hasn't seemed to have an affect on performance. 此后已关闭,但似乎对性能没有影响。

When I run db.currentOp(); 当我运行db.currentOp(); on the server, I've noticed that it's always got a query "createIndexes" of some nature (the indexes were created ages ago), yet when I mongodump/restore the database to my dev machine and run the service/currentOp, the "createIndexes" query isn't there. 在服务器上,我注意到它总是有某种性质的查询“ createIndexes”(索引是在很久以前创建的),但是当我mongodump /将数据库还原到我的开发机并运行service / currentOp时,“ createIndexes”查询不存在。 Apart from that, nothing else seems to jump out at me. 除此之外,似乎没有其他事情让我跳出来。

Does anyone have any ideas / help on this mysterious performance issue? 在这个神秘的性能问题上,没有人有任何想法/帮助吗? I'll post currentOp/mongostats if/when required. 如果需要的话,我会发布currentOp / mongostats。

Quick answer: I re-installed Mongo. 快速解答:我重新安装了Mongo。 No fancy configuration, just ran the setup and it fixed the issue. 没有花哨的配置,只需运行安装程序即可解决此问题。

I never worked out why Mongo was constantly creating indexes. 我从来没有弄清楚Mongo为什么不断创建索引。 The log file is 0.25GB for a single day full of event logs for "creating index". 一天的事件日志中,日志文件的大小为0.25GB,用于“创建索引”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM