spring - Activemq degrade response time -
i`m using activemq 5.10 spring 4.1.1. find degrade problem response time of messages. after 4 days, response time starts grow 15ms 200ms , more. app works fine approximately 1000 messages per second , run slower.
here part of xml beans:
<amq:systemusage> <amq:memoryusage> <amq:memoryusage limit="512 mb"> </amq:memoryusage> </amq:memoryusage> <amq:storeusage> <amq:storeusage limit="50 mb"></amq:storeusage> </amq:storeusage> <amq:tempusage> <amq:tempusage limit="50 mb"></amq:tempusage> </amq:tempusage> </amq:systemusage> <amq:broker brokername="mybroker" id="broker" persistent="false" deleteallmessagesonstartup="true" enablestatistics="false" useloggingforshutdownerrors="true"> <amq:transportconnectors> <amq:transportconnector uri="nio://${ip}:${port}?jms.useasyncsend=true?jms.usecompression=true" disableasyncdispatch="false" /> </amq:transportconnectors> <amq:destinationpolicy> <amq:policymap> <amq:policyentries> <amq:policyentry queue=">" optimizeddispatch="true" /> </amq:policyentries> </amq:policymap> </amq:destinationpolicy> </amq:broker> <!-- jms connection factory activemq --> <bean id="connectionfactory" class="org.apache.activemq.activemqconnectionfactory" p:brokerurl="nio://${ip}:${port}" /> <bean id="pooledjmsconnectionfactory" class="org.apache.activemq.pool.pooledconnectionfactory" destroy-method="stop"> <property name="connectionfactory" ref="connectionfactory" /> <property name="maxconnections" value="10" /> </bean> <bean id="listener" class="xx.com.xxx.messagelistener" /> <jms:listener-container container-type="default" connection-factory="connectionfactory" acknowledge="auto"> <jms:listener destination="${queuename}" ref="sisbusmessagelistener" method="onmessage" /> </jms:listener-container>
and here java code:
public class messagelistener extends genericmessagelistener { public void onmessage(message request) { myexecutor mythread = new myexecutor(request, new datetime()); executor.execute(mythread ); } }
public class myexecutor {
public void init() { try { connectionfactory = applicationhelper.getbean("connectionfactory"); connectionfactory.setalwayssessionasync(false); connection = connectionfactory.createconnection(); connection.start(); session = connection.createsession(false, session.auto_acknowledge); } catch (jmsexception e) { logs... } } public void returnmessage(message request, object responsefromexternalsystem) throws jmsexception { mapmessage response = session.createmapmessage(); response.setjmscorrelationid(request.getjmscorrelationid()); //code set info on map message here replyproducer = session.createproducer(request.getjmsreplyto()); replyproducer.setdeliverymode(deliverymode.non_persistent); replyproducer.send(response); } }
the solution re-use connections , sessions creating 1 instanace , creating other instance in cases(errors, desconnections...)
Comments
Post a Comment