代码之家  ›  专栏  ›  技术社区  ›  Alexandre L Telles

大期刊初创时hornetq内存不足

  •  3
  • Alexandre L Telles  · 技术社区  · 15 年前

    使用:Hornetq 2.0.0.cr2 独立/非群集服务器的默认配置。

    当我尝试用大日志(>1GB)启动服务器时,出现内存不足异常:

    [main] 12:59:43,505 INFO [org.hornetq.integration.bootstrap.HornetQBootstrapServer]  Starting HornetQ Server
    [main] 12:59:44,526 INFO [org.hornetq.core.server.impl.HornetQServerImpl]  live server is starting..
    [main] 12:59:44,532 WARNING [org.hornetq.core.server.management.impl.ManagementServiceImpl]  It has been detected that the cluster admin user and password which are used to replicate management operation from one node to the other have not been changed from the installation default. Please see the HornetQ user guide for instructions on how to do this.
    [main] 12:59:44,564 WARNING [org.hornetq.core.persistence.impl.journal.JournalStorageManager]  AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal
    [main] 12:59:44,565 INFO [org.hornetq.core.persistence.impl.journal.JournalStorageManager]  Using NIO Journal
    Exception in thread "hornetq-expiry-reaper-thread" java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.concurrent.ConcurrentHashMap.values(ConcurrentHashMap.java:1011)
    at org.hornetq.core.postoffice.impl.PostOfficeImpl$Reaper.run(PostOfficeImpl.java:1083)
    at java.lang.Thread.run(Thread.java:637)
    [main] 13:00:17,135 SEVERE [org.hornetq.integration.bootstrap.HornetQBootstrapServer]  Failed to start server
    java.lang.IllegalStateException: Incompletely deployed:
    
    DEPLOYMENTS IN ERROR:
      Deployment "JMSServerManager" is in error due to: java.lang.OutOfMemoryError: GC overhead limit exceeded
    
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:159)
    at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:117)
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)
    Exception in thread "main" java.lang.IllegalStateException: Incompletely deployed:
    
    DEPLOYMENTS IN ERROR:
      Deployment "JMSServerManager" is in error due to: java.lang.OutOfMemoryError: GC overhead limit exceeded
    
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:159)
    at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:117)
    at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)
    

    这可能发生在现实生活中,当消费者停止处理消息,我需要重新启动服务器时。

    有什么解决办法吗?或者我应该尝试修改哪些配置?

    3 回复  |  直到 11 年前
        1
  •  5
  •   Alexandre L Telles    15 年前

    结果证明完全避免这个问题很简单。

    这个 Paging 它在默认配置中未启用!

    在hornetq-configuration.xml上添加这两行应该可以做到:

       <address-settings>
          <!--default for catch all-->
          <address-setting match="#">
             <dead-letter-address>jms.queue.DLQ</dead-letter-address>
             <expiry-address>jms.queue.ExpiryQueue</expiry-address>
             <redelivery-delay>0</redelivery-delay>
             <page-size-bytes>10485760</page-size-bytes>
             <message-counter-history-day-limit>10</message-counter-history-day-limit>
    
             <!-- Add these 2 lines -->
             <max-size-bytes>104857600</max-size-bytes>
             <address-full-policy>PAGE</address-full-policy>
    
          </address-setting>
       </address-settings>
    

    现在有可能有大量的队列等待处理。

        2
  •  0
  •   Brian Agnew    15 年前

    here 看来你的堆太小了。

    并行收集器将 内存不足或时间过长 用于垃圾收集:如果 总时间的98%以上是 在垃圾收集方面花费较少 恢复的堆超过2%,则 将引发OutOfMemoryError。这个 功能旨在防止 应用程序运行 制造时延长的时间 很少或没有进展,因为堆 太小了。如果需要,这个 可以通过添加 选项-xx:-使用gcoverheadlimit到 命令行。

    您是否尝试过修改您的JVM内存选项,以及 -Xmx (最大可分配内存)特别是?我怀疑您需要增加您的JVM最大内存,以便给它足够的空间来处理您的消息。

        3
  •  0
  •   simonox    11 年前

    如果它在开发人员那里,你可以通过删除你的hornetq工作目录(例如~/work/hornetq)来删除你的队列。