Я использовал верблюда с activemqsslconnectionfactory для обработки моих сообщений cxf. моя скорость записи в очередь составляет почти 30 запросов / с. но читать по ней медленно, поэтому моя очередь не пуста никогда.
также я использовал медленную потребительскую стратегию, но она не отличается (я не уверен, что установил ее на истинное значение), и я увеличиваю количество параллельных потребителей, а также masActivesessionpercon и maxconnection, но они не так уж отличаются, и мы также использовали коэффициент подключения к сети.
Это сервер activemq.xml:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<!-- Allows accessing the server log -->
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" persistent="false">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:
http://activemq.apache.org/slow-consumer-handling.html
-->
<deadLetterStrategy>
<sharedDeadLetterStrategy processExpired="false" />
</deadLetterStrategy>
</policyEntry>
<policyEntry queue=">" >
<messageEvictionStrategy>
<!-- <oldestMessageEvictionStrategy/>-->
<oldestMessageWithLowestPriorityEvictionStrategy/>
</messageEvictionStrategy>
</policyEntry>
<policyEntry queue=">">
<!-- Force pending messages to be discarded for slow consumers -->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="5"/>
</pendingMessageLimitStrategy>
<!-- 10 seconds worth -->
<subscriptionRecoveryPolicy>
<timedSubscriptionRecoveryPolicy recoverDuration="10000"/>
</subscriptionRecoveryPolicy>
<!--<messageEvictionStrategy>
<oldestMessageWithLowestPriorityEvictionStrategy/>
<messageEvictionStrategy/>-->
</policyEntry>
<policyEntry topic=">" >
<messageEvictionStrategy>
<!-- <oldestMessageEvictionStrategy/>-->
<oldestMessageWithLowestPriorityEvictionStrategy/>
</messageEvictionStrategy>
</policyEntry>
<policyEntry topic=">">
<!-- Force pending messages to be discarded for slow consumers -->
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="5"/>
</pendingMessageLimitStrategy>
<!-- 10 seconds worth -->
<subscriptionRecoveryPolicy>
<timedSubscriptionRecoveryPolicy recoverDuration="10000"/>
</subscriptionRecoveryPolicy>
<!--<messageEvictionStrategy>
<oldestMessageWithLowestPriorityEvictionStrategy/>
<messageEvictionStrategy/>-->
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:
http://activemq.apache.org/jmx.html
-->
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:
http://activemq.apache.org/persistence.html
-->
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"/>
</persistenceAdapter>
<!--
The systemUsage controls the maximum amount of space the broker will
use before disabling caching and/or slowing down producers. For more information, see:
http://activemq.apache.org/producer-flow-control.html
-->
<systemUsage>
<systemUsage sendFailIfNoSpace="true">
<memoryUsage >
<memoryUsage limit="1 gb" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:
http://activemq.apache.org/configuring-transports.html
-->
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<!-- <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>-->
<transportConnector name="ssl" uri="ssl://0.0.0.0:8081?trace=true&needClientAuth=true&maximumConnections=10000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<sslContext>
<sslContext keyStore="/home/ut/keys/key.jks"
keyStorePassword="!QAZ2wsx"
trustStore="/home/ut/keys/trust.jks"
trustStorePassword="password" />
</sslContext>
<!-- destroy the spring context on shutdown to stop jetty -->
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file
Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->
<import resource="jetty.xml"/>
</beans>
и это верблюжья сторона (почти):
ActiveMQSslConnectionFactory activeMQConnectionFactory = new ActiveMQSslConnectionFactory();
String activeMQHost = activeMQConfig.getBrokerURL();
String activeMQIp = HostPropertiesManager.getInstance().getIP(activeMQHost);
if (activeMQIp.contains("127.0.0.1")) {
activeMQConnectionFactory.setBrokerURL("tcp://" + activeMQIp + ":61617");
} else {
activeMQConnectionFactory.setBrokerURL("ssl://" + activeMQIp + ":8081");
}
activeMQConnectionFactory.setTrustAllPackages(activeMQConfig.isTrustAllPackages());
activeMQConnectionFactory.setKeyStore("queueKeys/key.jks");
activeMQConnectionFactory.setKeyStorePassword(activeMQConfig.getKeyStorePassword());
activeMQConnectionFactory.setTrustStore("queueKeys/trust.jks");
activeMQConnectionFactory.setTrustStorePassword(activeMQConfig.getTrustStorePassword());
activeMQConnectionFactory.setDispatchAsync(true);
activeMQConnectionFactory.setAlwaysSyncSend(true);
activeMQConnectionFactory.setAlwaysSessionAsync(true);
activeMQConnectionFactory.setUseAsyncSend(true);
PooledConnectionFactory connectionFactory = new PooledConnectionFactory(activeMQConnectionFactory);
connectionFactory.setMaxConnections(50000);
connectionFactory.setMaximumActiveSessionPerConnection(3000000);
JmsConfiguration configuration = new JmsConfiguration(connectionFactory);
configuration.setTimeToLive(20000);
configuration.setConcurrentConsumers(500);
configuration.setLazyCreateTransactionManager(false);
configuration.setReceiveTimeout(40000);
configuration.setRequestTimeout(40000);
configuration.setTransferException(true);
configuration.setMaxConcurrentConsumers(600);
configuration.setAcceptMessagesWhileStopping(true);
ActiveMQComponent activeMQComponent = new ActiveMQComponent();
activeMQComponent.setConfiguration(configuration);
getContext().addComponent("activemq" + serviceName, activeMQComponent);
есть ли надежда?