最近在研究
ActiveMq
,期间也遇到过很多问题,做了一些总结。
连接数配置
修改
activemq.xml
文件中maximumConnections
参数值,默认最大连接为1000
。
1 |
|
如果超出最大连接限制,会提示以下错误!
1 | org.apache.activemq.transport.tcp.ExceededMaximumConnectionsException: Exceeded the maximum number of allowed client connections. See the 'maximumConnections' property on the TCP transport configuration URI in the ActiveMQ configuration file (e.g., activemq.xml) |
JVM虚拟机参数配置
当连接比较大,超过1万个长连接以上,很容易出现内存故障,导致
MQ
不可用,可以通过指定JVM参数
解决。
修改bin目录配置文件env
1 | ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G" |
大并发会出现以下异常,可以通过以上解决:
1 | java.lang.OutOfMemoryError: GC overhead limit exceeded |