【问题标题】:GC over limit exceeded when using Spring integration executor channel使用 Spring 集成执行器通道时超出 GC 限制
【发布时间】:2017-06-07 23:05:16
【问题描述】:
   I have got the below exception , I suspect heap memory is full so GC exception was thrown . Kindly explain if any other perspective for the below application solution


  2017:06:07 21:18:36.275 [loginputtaskexecutor-7] ERROR o.s.i.handler.LoggingHandler - org.springframework.messaging.MessageHandlingException: nested exception is java.lang.IllegalStateException: Cannot process message
    at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:96)
    at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:89)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:53)
    at org.springframework.integration.dispatcher.UnicastingDispatcher$3.run(UnicastingDispatcher.java:129)
    at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Cannot process message
    at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:333)
    at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:155)
    at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:93)
    ... 11 more
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded


  **Application flow in detail :**

Spring集成应用程序构建以监听来自ActiveMQ的消息,在消费来自ActiveMQ的消息后,它将被移交给以订阅者为服务激活器的输入通道(执行器通道)。在 Service Activator 中,消息被转换为 json 然后存储到 Cassandra 。服务激活方法中提到了@transaction。

通过上面的解决方案,我想到了通过实现 executor channel 来打破 Message 的交易流程,消息消费完之后会被移交给 executor channel 并且交易结束。之后,执行器通道中的线程将负责对 cassandra 执行并行写入。

有没有更好的方法可以使用 java spring 集成尽可能快地将大量数据写入 casandra

【问题讨论】:

  • 这种设置通常需要 Hadoop 和 Cassandra 集成。这至少会将您的文件拆分到不同的机器上。

标签: java spring cassandra garbage-collection spring-integration


【解决方案1】:

如果数据接收器跟不上,请在 TaskExecutor 中添加队列大小限制,并在队列已满时使用 CallerRunsPolicyCallerBlocksPolicy

这自然会以接收器可以处理的速度限制工作负载。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-13
    • 2017-07-04
    • 2012-03-17
    • 2016-08-07
    • 1970-01-01
    • 2011-05-21
    • 2017-12-27
    • 2013-07-13
    相关资源
    最近更新 更多