Este contenido no está disponible en el idioma seleccionado.

Chapter 4. Producer Performance


4.1. Async Sends

Overview

ActiveMQ supports sending messages to a broker in either synchronous or asynchronous mode. The selected mode has a large impact on the latency of the send call: synchronous mode increases latency and can lead to a reduction in the producer's throughput; asynchronous mode generally improves throughput, but it also affects reliability.
Red Hat JBoss A-MQ sends messages in asynchronous mode by default in several cases. It is only in those cases where the JMS specification requires the use of synchronous mode that the producer defaults to synchronous sending. In particular, JMS requires synchronous sends when persistent messages are being sent outside of a transaction.
If you are not using transactions and are sending persistent messages, each send is synchronous and blocks until the broker has sent an acknowledgement back to the producer to confirm that the message is safely persisted to disk. This acknowledgment guarantees that the message will not be lost, but it also has a large latency cost.
Many high performance applications are designed to tolerate a small amount of message loss in failure scenarios. If your application is designed in this fashion, you can enable the use of async sends to increase throughput, even when using persistent messages.

Configuring on a transport URI

To enable async sends at the granularity level of a single producer, set the jms.useAsyncSend option to true on the transport URI that you use to connect to the broker. For example:
tcp://locahost:61616?jms.useAsyncSend=true

Configuring on a connection factory

To enable async sends at the granularity level of a connection factory, set the useAsyncSend property to true directly on the ActiveMQConnectionFactory instance. For example:
// Java
((ActiveMQConnectionFactory)connectionFactory).setUseAsyncSend(true);

Configuring on a connection

To enable async sends at the granularity level of a JMS connection, set the useAsyncSend property to true directly on the ActiveMQConnection instance. For example:
// Java
((ActiveMQConnection)connection).setUseAsyncSend(true);
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.