首页 > 其他 > 详细

activemq设置使用内存数和配置自动删除无法消费的消息以及过期的消息

时间:2018-12-24 23:16:30      阅读:344      评论:0      收藏:0      [点我收藏+]

使用的activemq的版本为 apache-activemq-5.15.6

1、修改使用的内存

  actviemq消息量大之后可能会越来越慢,这可能是两个问题,一是服务器分配内存太小,导致服务器处理消息慢,内存使用可以修改activemq小的bin文件夹内的env文件第

 35 行,ACTIVEMQ_OPTS_MEMORY="-Xms2G -Xmx4G" 这样就可以增加内存了。

二是服务器如果使用kahadb那么文件可能会有过大的问题,需要调整配置文件。修改activemq下的config问价夹中的activemq.xml中的

122 <storeUsage>
123 <storeUsage limit="20 gb"/>
124 </storeUsage>

2、设置服务器自动删除过期消息,死消息队列中的消息

<destinationPolicy>
44 <policyMap>
45 <policyEntries>
46 <policyEntry topic=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC ="30000">
47 <pendingMessageLimitStrategy>
48 <constantPendingMessageLimitStrategy limit="1000"/>
49 </pendingMessageLimitStrategy>
50 <deadLetterStrategy>
51 <sharedDeadLetterStrategy processExpired="false"/>
52 </deadLetterStrategy>
53 </policyEntry>
54 <policyEntry queue=">" optimizedDispatch="true" reduceMemoryFootprint="true">
55 <deadLetterStrategy>
56 <sharedDeadLetterStrategy processExpired="false"/>
57 </deadLetterStrategy>
58 </policyEntry>
59 </policyEntries>
60 </policyMap>
61 </destinationPolicy>

运行一段时间后在日志后可能会出现:

 Total of 8000 messages were discarded, since their destination was the dead letter queue ,这就表明这个配置已经起效。

 

另外activemq的日志文件为activemq/data/activemq.log。

activemq设置使用内存数和配置自动删除无法消费的消息以及过期的消息

原文:https://www.cnblogs.com/wolf-zt/p/10171452.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!