OutOfMemoryError:启动solr时出现Java堆空间错误

时间:2010-04-08 13:01:12

标签: java jvm solr tomcat6 lucene

我开始使用solr索引数据库文章,但在添加了大约5800万篇文章(以及大约113 GB的磁盘大小)之后,我在tomcat日志错误中收到以下错误消息

注1:我已经将Init内存池设置为256MB,最大内存池:1400MB到tomcat服务器。
注2:我可以发布或搜索文章,但必须等待3分钟才能获得回复。

8-apr-2010 14:27:07 org.apache.solr.common.SolrException log
SEVERE: java.lang.OutOfMemoryError: Java heap space
    at org.apache.lucene.util.PriorityQueue.initialize(PriorityQueue.java:89)
    at org.apache.lucene.search.HitQueue.<init>(HitQueue.java:67)
    at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:113)
    at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:37)
    at org.apache.lucene.search.TopScoreDocCollector$InOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:42)
    at org.apache.lucene.search.TopScoreDocCollector$InOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:40)
    at org.apache.lucene.search.TopScoreDocCollector.create(TopScoreDocCollector.java:100)
    at org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:979)
    at org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:884)
    at org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:341)
    at org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:182)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:195)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)
    at java.lang.Thread.run(Unknown Source)

有什么问题?

有什么建议吗?

重要问题:为什么solr使用堆内存???

2 个答案:

答案 0 :(得分:4)

  1. 如果您还没有,请升级到最新的jdk 6。我在jdk 5上打了一个类似的OOME,然后用6开了。我怀疑是nio的事。

  2. 尝试降低solrconfig.xml中的maxPendingDeletes。

  3. 要找出solr的哪个组件耗尽所有内存,请按以下方式启动solr:

    java -XX:+ HeapDumpOnOutOfMemoryError -XX:HeapDumpPath = some_directory_of_your_choice -jar start.jar

  4. 然后使用来自http://www.eclipse.org/mat/的独立MAT解析堆转储,并降低占用所有内存的相应缓存。

答案 1 :(得分:0)

启用GC日志记录并绘制时间序列图表,这可以告诉您JVM内存分配的速度以及收集的数量(如果有的话),以便您可以接近高水位线。