首页 \ 问答 \ 何时使用MongoDB(When to use MongoDB)

何时使用MongoDB(When to use MongoDB)

我正在编写一个不一定需要扩展能力的应用程序,因为它不会在开始时收集大量数据。 (但是,如果我很幸运,我可能会走上这条路。)

我将在同一个盒子上运行我的Web服务器和数据库(现在)。

这就是说,我正在寻找性能和效率。

我的应用程序的主要部分将加载博客文章。 使用RDBMS(MySQL)我会做6个查询(其中2个查询是连接),只是加载一个博客文章页面。

select blog
select blog_album
select blog_tags
select blog_notes
select blog_comments (join with users)
select blog_author_participants (join with users)

但是,通过MongoDB,我可以将6个表格取消规格化并将其平整为2个表格/集合,并将我的查询最小化为可能只有1个查询,

users
blogs
    ->blog_album
    ->blog_tags        
    ->blog_notes
    ->blog_comments
    ->blog_author_participants

现在,使用MongoDB模式,将会有一些数据冗余。 但是,硬盘空间比CPU /服务器便宜。

1.)这会是一个很好的使用MongoDB的场景吗?

2.)你在扩展到单个服务器之外时是否只使用MongoDB获得性能好处?

3.)使用MongoDB有没有耐久性风险? 我听说在执行插入操作时可能会丢失数据 - 因为插入操作先写入内存,然后写入数据库。

4.)这应该阻止我在生产中使用MongoDB吗?


I'm writing an application that doesn't necessarily need scaling abilities as it won't be collecting large amounts data at the beginning. (However, if I'm lucky, I could down the road potentially.)

I will be running my web server and database on the same box (for now).

That being said, I am looking for performance and efficiency.

The main part of my application will be loading blog articles. Using an RDBMS (MySQL) I will make 6 queries (2 of the queries being joins), just to load a single blog article page.

select blog
select blog_album
select blog_tags
select blog_notes
select blog_comments (join with users)
select blog_author_participants (join with users)

However, with MongoDB I can de-normalize and flatten 6 tables into just 2 tables/collections and minimizes my queries to potentially just one 1 query,

users
blogs
    ->blog_album
    ->blog_tags        
    ->blog_notes
    ->blog_comments
    ->blog_author_participants

Now, going with the MongoDB schema, there will be some data redundancy. However, hard drive space is cheaper than CPU/servers.

1.) Would this be a good scenario to use MongoDB?

2.) Do you only benefit in performance using MongoDB when scaling beyond a single server?

3.) Are there any durability risks using MongoDB? I hear that there is potential for loss of data while performing inserts - as insert are written to memory first, then to the database.

4.) Should this stop me from using MongoDB in production?


原文:https://stackoverflow.com/questions/4981753
更新时间:2022-02-17 17:02

最满意答案

原来是与组成员身份相关的数据库权限问题...我被删除了问题组,一切都恢复了生机。


Turned out to be a database permissions issue relating to group membership... I was removed the problem group and everything came to life again.

相关问答

更多
  • 原来是与组成员身份相关的数据库权限问题...我被删除了问题组,一切都恢复了生机。 Turned out to be a database permissions issue relating to group membership... I was removed the problem group and everything came to life again.
  • 托管代码中存在这些类型的访问违规错误是非典型的。 它们来自内存破坏,可能表明有缺陷的硬件 - 在极少数情况下,这表明CLR本身存在缺陷。 这种类型的错误最可能的原因来自其他地方,例如,如果此代码以某种方式使用本机代码 - 在不安全的上下文中调用本机代码或从本机代码调用本机代码。 引用MSDN AccessViolationException : 在完全由可验证托管代码组成的程序中,所有引用都是有效的或无效的,并且访问违规是不可能的。 仅当可验证的托管代码与非托管代码或不安全的托管代码进行交互时才会发生Acc ...
  • 您不能在终结器中处理托管对象,因为它们可能已经完成(或者,如您在此处所见,部分环境可能不再处于您期望的状态)。这意味着如果您包含一个必须明确处置的类,你的类也必须明确处置。 没有办法“欺骗”并自动进行处置。 不幸的是,在这种情况下,垃圾收集就是一个漏洞抽象。 You can't Dispose managed objects in the finalizer, as they might have already been finalized (or, as you've seen here, portio ...
  • 在.NET 4.0中,运行时处理作为Windows结构化错误处理(SEH)错误引发的某些异常,作为损坏状态的指示符。 这些被破坏的状态异常(CSE)不允许被您的标准托管代码所捕获。 我不会进入为什么或如何在这里。 阅读这篇关于CSE在.NET 4.0框架中的文章: http://msdn.microsoft.com/en-us/magazine/dd419661.aspx#id0070035 但有希望。 有几种方法可以解决这个问题: 重新编译为.NET 3.5程序集,并在.NET 4.0中运行它。 在配置/ ...
  • 这不是一个真正的解决方案,而是更多的黑客/工作方式。 无论如何,我发现异常是随机抛出的,但并不常见,所以解决方法是用以下方法装饰OverlapSkeleton方法 [HandleProcessCorruptedStateExceptions] 和 [SecurityCritical] 这样做可以使用try / catch捕获CSE。 结果代码是: [MethodImpl(MethodImplOptions.AggressiveInlining)] [HandleProcessCorruptedState ...
  • 好的问题是teamcity代理作为服务运行,并且服务无法创建OpenGl上下文,一旦代理从命令行运行然后它就可以工作。 Ok the problem was that teamcity agent was running as a service, and services can't create OpenGl contexts, once the agent was running from command line then it works.
  • 该片段缺少该函数的[DllImport]声明。 但我可以说你使用的那个是错的,最后一个论点必须是out bool 。 当然,你使用的声明遗漏out ,唯一的方法是你可以通过假 。 是的,当本机代码尝试取消引用指针时,这可靠地生成AVE。 The snippet is missing the [DllImport] declaration of the function. But I can tell that the one you use is wrong, the last argument must ...
  • 您正在后台线程中呈现文档时修改文档。 跨线程写入共享数据,同时也读取它们,可能会在遇到时导致随机错误。 您需要使用this.PDFViewCtrl.DocLock(true)和this.PDFViewCtrl.DocUnlock()来启动和完成ImportAnnotations函数。 有关此主题的更多详细信息,请参阅此论坛帖子 You are modifying the document while it is being rendered in a background thread. Writing t ...
  • 数据绑定到隐藏元素时,我看到这个异常。 我们有一些基于某些数据绑定的可见或不可见的字段,但这两个字段都使用另一个数据绑定进行更新。 当在隐藏字段上触发RaisePropertyChanged时,我们得到AccessViolationException。 当控件不可见时,我不得不向我的代码添加一些检查来抑制RaisePropertyChanged。 I finally tracked down my specific problem. It was only happening with an element ...
  • 我查看了你的两个问题,虽然我没有使用GeckoFx的经验,但我会先从本地创建文件的方式开始。 你得到一个AccessViolation -2147467261,这通常意味着内存损坏(或至少锁定内存)。 这可以解释您在其他问题中描述的行为。 如果在globalParameters.getDownloadDirectory()指定的目录本身无效,或者由于导致根问题而导致其损坏,则对话框可能会关闭(这只是猜测,因为它不能解释为什么不抛出错误)。 要调试它,我会在每次创建目录和/或文件时进行记录。 我还会在整个执行 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。