何时使用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
最满意答案
原来是与组成员身份相关的数据库权限问题...我被删除了问题组,一切都恢复了生机。
Turned out to be a database permissions issue relating to group membership... I was removed the problem group and everything came to life again.
相关问答
更多-
AseConnection.Open()抛出AccessViolationException(AseConnection.Open() throws AccessViolationException)[2023-04-07]
原来是与组成员身份相关的数据库权限问题...我被删除了问题组,一切都恢复了生机。 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()指定的目录本身无效,或者由于导致根问题而导致其损坏,则对话框可能会关闭(这只是猜测,因为它不能解释为什么不抛出错误)。 要调试它,我会在每次创建目录和/或文件时进行记录。 我还会在整个执行 ...