В настоящее время моя система использует Spring-jms 4.1.6 и ActiveMQ 5.2.0
Мы сталкиваемся с проблемой, когда у нас есть стрессовые запросы ( 50000 непрерывность запросы, такие как DDOS) сервер умирает.
Я думаю, что есть некоторые проблемы с моим конфигом на стороне потребителя;
Конфигурация ниже - это оригинальная конфигурация
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jms="http://www.springframework.org/schema/jms" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd "> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> </bean> <!-- Administrated objects --> <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory" destroy-method="destroy"> <property name="targetConnectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="failover:(tcp://localhost:${JMS_PORT})"/> </bean> </property> <property name="reconnectOnException" value="false"/> </bean> <bean id="queue" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg value="test.service" /> </bean> <!-- Message listener container for services --> <bean id="errorHandler" class="com.myconsumer.test.LogErrorHandler"/> <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="connectionFactory" /> <property name="destination" ref="queue" /> <property name="concurrentConsumers" value="10" /> <property name="maxConcurrentConsumers" value="20" /> <property name="messageListener" ref="serviceExporterDispatcher" /> <property name="errorHandler" ref="errorHandler" /> </bean> <bean id="securityTokenVerificator" class="com.myconsumer.test.SecurityTokenVerificator"> <property name="authenticationService" ref="authenticationService" /> </bean> <bean id="businessServiceInterceptor" class="com.myconsumer.test.RemoteInvocationBusinessServiceInterceptor"> <property name="securityTokenVerificator" ref="securityTokenVerificator" /> </bean> <bean id="requestContextHandler" class="com.myconsumer.test.RequestContextHandler"/> <bean id="remoteInvocationErrorHandler" class="com.myconsumer.test.RemoteInvocationErrorHandler" /> <bean id="serviceExporterDispatcher" class="com.myconsumer.test.ServiceExporterDispatcher"> <property name="businessServiceInterceptor" ref="businessServiceInterceptor" /> <property name="requestContextHandler" ref="requestContextHandler" /> <property name="remoteInvocationErrorHandler" ref="remoteInvocationErrorHandler" /> </bean> </beans>
Я пытался с подключением к пулу, но ничего не улучшилось
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jms="http://www.springframework.org/schema/jms" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd "> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> </bean> <!-- Administrated objects --> <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop"> <property name="connectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="failover:(tcp://localhost:${JMS_PORT})"/> </bean> </property> <!-- <property name="reconnectOnException" value="false"/> <property name="sessionCacheSize" value="3"/> --> </bean> <bean id="queue" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg value="test.service" /> </bean> <!-- Message listener container for services --> <bean id="errorHandler" class="com.myconsumer.test.LogErrorHandler"/> <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="pooledConnectionFactory" /> <property name="destination" ref="queue" /> <property name="concurrentConsumers" value="10" /> <property name="maxConcurrentConsumers" value="20" /> <property name="messageListener" ref="serviceExporterDispatcher" /> <property name="errorHandler" ref="errorHandler" /> </bean> <bean class="org.springframework.jms.config.DefaultJmsListenerContainerFactory"> <property name="concurrency" value="3-10"/> </bean> <bean id="securityTokenVerificator" class="com.myconsumer.test.SecurityTokenVerificator"> <property name="authenticationService" ref="authenticationService" /> </bean> <bean id="businessServiceInterceptor" class="com.myconsumer.test.RemoteInvocationBusinessServiceInterceptor"> <property name="securityTokenVerificator" ref="securityTokenVerificator" /> </bean> <bean id="requestContextHandler" class="com.myconsumer.test.RequestContextHandler"/> <bean id="remoteInvocationErrorHandler" class="com.myconsumer.test.RemoteInvocationErrorHandler" /> <bean id="serviceExporterDispatcher" class="com.myconsumer.test.ServiceExporterDispatcher"> <property name="businessServiceInterceptor" ref="businessServiceInterceptor" /> <property name="requestContextHandler" ref="requestContextHandler" /> <property name="remoteInvocationErrorHandler" ref="remoteInvocationErrorHandler" /> </bean> </beans>
Обновление конфигурации для источника
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:jms="http://www.springframework.org/schema/jms" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:sec="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <!-- Initialize service invoker properties --> <bean id="propertyPlaceHolder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="properties"> <bean factory-bean="resourceUtils" factory-method="getProperties"> <constructor-arg> <bean factory-bean="resourceLoader" factory-method="getResource"> <constructor-arg> <value>service-invoker/service-invoker.properties</value> </constructor-arg> </bean> </constructor-arg> </bean> </property> </bean> <!-- Administrated objects --> <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory" destroy-method="destroy"> <property name="targetConnectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="${broker.url}"/> </bean> </property> </bean> <bean id="queue" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg value="${service.queue}" /> </bean> <!-- Service Locator --> <bean id="serviceLocator" class="com.myproducer.test.service.impl.ApplicationServiceLocatorImpl"> <property name="authenticationService" ref="authenticationService"/> </bean> <!-- Services --> <bean id="authenticationService" class="com.myproducer.test.service.impl.ClientJmsInvokerProxyFactoryBean"> <property name="serviceInterface" value="com.myservicer.test.authentication.v1.AuthenticationService" /> <property name="connectionFactory" ref="connectionFactory" /> <property name="queue" ref="queue" /> <property name="receiveTimeout" value="${receiveTimeout}" /> </bean> </beans>
Важно Мой запрос 50000 часто отправляется, я использую nodejs для отправки и отправки запросов, не дожидаясь ответа для проверки сервера.