RavenDB:如何防止高RAM使用率? [英] RavenDB: How can I prevent high RAM utilization?

查看:79
本文介绍了RavenDB:如何防止高RAM使用率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 我的应用程序包含一些返回大结果集的查询(尽管我已经用 Take(300) lambda对其进行了限定。 / li>
  • 在高峰使用期间,我已经看到Raven.Server.exe消耗大量RAM。

    • 事实上,这些时候,Raven.Server.exe可以耗尽我服务器的可用RAM。

    • My application includes a few queries which return large result sets (although I've capped it with a Take(300) lambda.
    • During peak usage times, I've seen Raven.Server.exe consume an unusually large amount of RAM.
      • In fact, during these times, Raven.Server.exe can exhaust my server's available RAM.

      如何避免这种情况?


      • 经过几次Google搜索,我发现其他人也遇到了这个错误摆在我面前。

      • 但是RavenDB在过去的几年中发展了,有许多配置代码选项可以限制Raven的RAM数量。 Server.exe可以完全使用和禁用缓存。

      • After a few Google searches, I can see that other people have encountered this error before me.
      • But RavenDB has evolved during the past few years and there are many configuration and code options which can limit the amount of RAM that Raven.Server.exe can consume and disable caching entirely.

      任何人都可以告诉我哪些选项最适合 我的情况?

      Can anyone tell me which options are most applicable for my situation?

      这是我在服务器配置选项中找到的内容:

      Here is what I found for server configuration options:

      • Link 1
      • Link 2
      • Link 3

      这是我在代码选项中找到的内容:

      Here is what I found for code options:

      • Link 1
      • Link 2

      对我来说很明显,这个默认设置未得到遵守:

      It's clear to me that this default setting is not being respected:


      Raven / MemoryCacheLimitMegabytes

      Raven/MemoryCacheLimitMegabytes

      RavenD中内部文档缓存的最大大小(MB) B服务器。
      默认值:总系统内存的50%减去Esent缓存的大小。

      The max size in MB for the internal document cache inside RavenDB server. Default: 50% of the total system memory minus the size of the Esent cache.

      在我的服务器上,内部版本2330,未设置任何自定义配置,Raven.Server.exe占用了95%的可用RAM!

      On my server, with build 2330, without any custom configurations set, Raven.Server.exe was consuming 95% of the available RAM!

      编辑::我能够在测试环境中执行大读(无写)操作时重现此内容。

      I was able to reproduce this in a test environment when executing only heavy reads (and no writes).

      推荐答案

      @Ayende Rahein 对RavenDB的了解远远超过是的,但这对我有用:

      @Ayende Rahein knows infinitely more about RavenDB than I do, but here is what worked for me:


      1. Take(300)太多了。我需要将其更改为 Take(128)

      2. 使用3.10 GHz四核客户端计算机时,我使用的是2.50 GHz在 Parallel.ForEach 循环内进行查询的单核心服务器。我需要指定并行度: Parallel.ForEach(对象,新的ParallelOptions {MaxDegreeOfParallelism = 3},currentObject => {/ *我的查询* /});

      3. 我需要配置以下选项在我的 DocumentStore 实例上:
        _store.Conventions.DisableProfiling = true;
        _store.Conventions.ShouldCacheRequest = url =>假;
        _store.DisableAggressiveCaching();

      4. 在需要分页查询并在单个会话中发出多个批处理请求的情况下,我需要以下内容:

        ravenSession.Advanced.Evict(doc); //对于每个加载的文档

      1. Take(300) was too much. I needed to change this to Take(128) .
      2. With a 3.10 GHz quad core client machine, I was peppering a 2.50 GHz single core server with queries inside of a Parallel.ForEach loop. I needed to specify the degree of parallelism: Parallel.ForEach(objects, new ParallelOptions { MaxDegreeOfParallelism = 3 }, currentObject => { /* My Query */ });
      3. I needed to configure the following options on my DocumentStore instance: _store.Conventions.DisableProfiling = true; _store.Conventions.ShouldCacheRequest = url => false; _store.DisableAggressiveCaching();
      4. And in cases where I needed to page my query and make multiple batch requests within a single session, I needed the following:
        ravenSession.Advanced.Evict(doc); // for each loaded doc

      我希望这会对其他人有所帮助!

      I hope this helps somebody else!

      这篇关于RavenDB:如何防止高RAM使用率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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