简体   繁体   English

在mongodb中是否存在将集合分成多个数据库的性能原因?

[英]In mongodb is there a performance reason to separate collections into more than on database?

I have an application using a MongoDB database and am about to add custom analytics. 我有一个使用MongoDB数据库的应用程序,我即将添加自定义分析。 Is there a reason to use a separate database for the analytics or am I better off to build it in the application database? 是否有理由使用单独的数据库进行分析,或者我最好在应用程序数据库中构建它?

Here are the reasons I can think of: 以下是我能想到的原因:

  • Name collisions between production collections and analytics collections 命名生产集合和分析集合之间的冲突
  • You need a different replica set configuration for analytics 您需要不同的副本集配置才能进行分析
  • You need a different sharding configuration for analytics 您需要使用不同的分片配置进行分析
  • You want different physical media for some data (production data on fast disks, analytics on slow disk, for example) 您需要不同的物理介质来存储某些数据(例如,快速磁盘上的生产数据,慢速磁盘上的分析)
  • Starting in Mongo 2.2, the "global write lock" will be a per-database lock, so different databases will isolate analytics traffic from production traffic a bit more. 从Mongo 2.2开始,“全局写锁定”将是每个数据库的锁定,因此不同的数据库会将分析流量与生产流量隔离开来。

Unless something on this list applies to you, then you don't need to split them out. 除非此列表中的内容适用于您,否则您无需将其拆分。 Also, it's much easier to move a collection across DBs in MongoDB than an RDBMS (as you don't have foreign keys to cause trouble), so IMO it's a relatively easy decision to delay. 另外,在MongoDB中移动集合比在RDBMS中更容易(因为你没有外键导致麻烦),所以IMO是一个相对容易的延迟决定。

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

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