本文介绍了Solr在Tomcat上,Windows OS占用所有内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会不断增长到> keeps growing up to > 7GB Ram and does not reduce, even after 24 hours.After a restart of Tomcat, or a Reload Core in the Solr Admin the memory drops back to 1 a 2 GB Ram. Memory leak?

是否可以为Tomcat上的Solr进程配置最大内存使用量?还有其他选择吗?最佳做法?

Is it possible to configure the max memory usage for the Solr process on Tomcat?Are there other alternatives? Best practices?

谢谢

推荐答案

我有以下设置(尽管问题小得多)...5000个文档,文档大小从1MB到30MB.对于2 CPU/2GB系统上的Tomcat进程,我们要求在1GB以下运行

I have the following setup (albeit a much smaller problem)...5000 documents, document sizes range from 1MB to 30MB.We have a requirement to run under 1GB for the Tomcat process on a 2 CPU / 2GB system

经过一番实验后,我想到了JAVA的这些设置.

After bit of experimentation I came up with these settings for JAVA.

-Xms448m
-Xmx768m
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-XX:ParallelCMSThreads=4
-XX:PermSize=64m
-XX:MaxPermSize=64m
-XX:NewSize=384m
-XX:MaxNewSize=384m
-XX:TargetSurvivorRatio=90
-XX:SurvivorRatio=6
-XX:+CMSParallelRemarkEnabled
-XX:CMSInitiatingOccupancyFraction=55
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+OptimizeStringConcat
-XX:+UseCompressedOops
-XX:MinHeapFreeRatio=5
-XX:MaxHeapFreeRatio=5

这些有帮助,但是即使有这么小的数据集,我也遇到了OutOfMemory和Tomcat使用过多内存的问题.

These helped but I encountered issues with the OutOfMemory and Tomcat using too much memory even with such a small dataset.

到目前为止,我确定的解决方案或事物/配置看起来很合适,如下所示:

Solution Or things/configuration I have set so far that seem to hold well are as follows:

  1. 禁用除QueryResultCache之外的所有缓存
  2. 查询中不包括文本/内容字段,仅包含ID
  3. 请勿使用大于10的行,并且不包括突出显示.
  4. 如果您正在使用突出显示(这是最大的罪魁祸首),请先从查询中获取文档标识符,然后再次使用突出显示和包含ID字段的搜索词进行查询.

最后是内存问题.我不得不勉强地实现一种非正统的方法来解决tomcat/java内存占用问题(因为Java从未将内存返还给操作系统).

Finally for the memory problem. I had to grudgingly implement an unorthodox approach to solve the tomcat/java memory hogging issue (as java never gives back memory to the OS).

我创建了一个内存调试器服务,该服务以调试特权运行,并调用Windows API来强制tomcat进程释放内存.我还拥有一个全局互斥锁,以防止在通话时发生这种情况时访问tomcat.

I created a memory governor service that runs with debug privilege and calls windows API to force tomcat process to release memory. I also have a global mutex to prevent access to tomcat while this happens when a call comes in.

令人惊讶的是,如果您没有选择权来控制对Tomcat的访问,则这种方法行之有效,但并非没有风险.

Surprisingly this approach is working out well but not without its own perils if you do not have the option to control access to Tomcat.

如果您找到更好的解决方案/配置更改,请告诉我们.

If you find a better solution/configuration changes please let us know.

这篇关于Solr在Tomcat上,Windows OS占用所有内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 06:57