ActiveMQ Artemis Producer性能问题,地址/队列为30k

时间:2019-10-07 21:01:08

标签: activemq-artemis

我有一个需要将消息发送到约30k地址的应用程序。我曾经以OpenMQ作为经纪人并使用JMS。我拥有的JMS客户端代码能够在几秒钟内向代理发送约3万条消息。然后我切换到Artemis,发送性能急剧下降。现在,将所有消息发送到Artemis经纪人最多需要10分钟。

我在服务器(broker.xml)上以及通过连接URL都使用了不同的配置设置。

broker.xml上的地址设置

<address-setting match="#">
   <!-- <dead-letter-address>DLQ</dead-letter-address> -->
   <!-- <expiry-address>ExpiryQueue</expiry-address> -->
   <redelivery-delay>0</redelivery-delay>
   <!-- with -1 only the global-max-size is in use for limiting -->
   <max-size-bytes>-1</max-size-bytes>
   <message-counter-history-day-limit>10</message-counter-history-day-limit>
   <address-full-policy>DROP</address-full-policy>
   <auto-create-queues>true</auto-create-queues>
   <auto-create-addresses>true</auto-create-addresses>
   <auto-create-jms-queues>true</auto-create-jms-queues>
   <auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>

发送

private static final String BROKER_URL = "tcp://localhost:61616?minLargeMessageSize=10485760;compressLargeMessages=true;producerWindowSize=-1";

ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(BROKER_URL);
factory.setDupsOKBatchSize(50 * 1024 * 1024);
factory.setProducerWindowSize(-1);
factory.setBlockOnDurableSend(false);
factory.setBlockOnNonDurableSend(false);
factory.setCacheDestinations(true);
System.out.println("Connection factory " + factory.toString());

Connection connection = factory.createConnection();
Session producerSession = connection.createSession(false, ActiveMQJMSConstants.PRE_ACKNOWLEDGE);
MessageProducer producer = producerSession.createProducer(null);
producer.setDisableMessageID(true);
producer.setDisableMessageTimestamp(true);

// Create a JMS message of type ByteMessage, and send

producer.send(destination, jmsMessage, DeliveryMode.NON_PERSISTENT, JMS_MESSAGE_PRIORITY, DEFAULT_TTL);

使用上面的代码(为简化可读性),我每秒只能收到20到40条消息。

我想念什么吗?还是JMS引入了从Artemis客户端库到Core转换的性能损失?

我可以采取什么措施来提高邮件率?

0 个答案:

没有答案