#Optimize #Jboss EAP 7.x embedded #Artemis messaging server for high volumes

By | February 23, 2022

There are several configurations that will prepare the embedded Jboss EAP 7.x Artemis messaging server for a production environment with high volumes. The following is a non exhaustive list of optimizations I discovered during several performance tests. Most of the settings is assumed that are done from jboss-cli.

Disable client pre-fetch of messages:

This will make sure that we do not have any pre-fetch buffer for clients. This will eliminate resource overrun and will also accommodate slow clients. Set this for both the internal and remote connection factory.

/subsystem=messaging-activemq/server=default/connection-factory=InVmConnectionFactory:write-attribute(name=consumer-window-size,value=0)
/subsystem=messaging-activemq/server=default/connection-factory=RemoteConnectionFactory:write-attribute(name=consumer-window-size,value=0)

Increase Producer pre-fetch window size

Limiting the window size sets a limit on the number of bytes that the producer can have “in-flight” at any one time, which can prevent the remote connection from becoming overloaded.

The default value for this pre-fetch buffer is very small. When this buffer was to small I frequently got the “AMQ212054 Destination address={0} is blocked …” error caused by the flow control that blocks a queue when a producer puts messages to fast in a short time. Again do this on both internal and remote connection factories.

/subsystem=messaging-activemq/server=default/connection-factory=InVmConnectionFactory:write-attribute(name=producer-window-size,value=1048576)
/subsystem=messaging-activemq/server=default/connection-factory=RemoteConnectionFactory:write-attribute(name=producer-window-size,value=1048576)

Configuring Artemis Messaging Journal JDBC Persistence Store

The default Artemis message journal is on disk. In case the journal is not on some dedicated SSD it can be very slow. Even worse if the journal is on some remote storage shared data directory the performance can be horrible.

Luckily if we use a newer database, in case of Oracle at least 12c, we can move the journal to the database.

To put the journal in the database simply add the following and indicate the data source:

/subsystem=messaging-activemq/server=default:write-attribute(name=journal-datasource,value="MyDS")

To make sure tables are correctly created in all databases (some have restrictions for table names that not always are respected by the automatic names given by Jboss) do the following.

/subsystem=messaging-activemq/server=default:write-attribute(name=journal-bindings-table,value="ARTEMIS_B")
/subsystem=messaging-activemq/server=default:write-attribute(name=journal-jms-bindings-table,value="ARTEMIS_JB")
/subsystem=messaging-activemq/server=default:write-attribute(name=journal-messages-table,value="ARTEMIS_M")
/subsystem=messaging-activemq/server=default:write-attribute(name=journal-large-messages-table,value="ARTEMIS_LM")
/subsystem=messaging-activemq/server=default:write-attribute(name=journal-page-store-table,value="ARTEMIS_PS")

When creating the default address setting (# wildcard matches all addresses, so the defined resource limits and policies are applied to all messages) and the journal is in database make sure to do the following:

  • set a high value for “max-size-bytes” (100MB in my case). This sets the memory limit for the address at a high enough value. The default is -1 (no limit).
/subsystem=messaging-activemq/server=default/address-setting=#:write-attribute(name=max-size-bytes,value=104857600)
  • change “address-full-policy” to BLOCK from the default PAGING.
/subsystem=messaging-activemq/server=default/address-setting=#:write-attribute(name=address-full-policy,value="BLOCK")
  • Note that PAGING is incompatible with the journal in the database so must be disabled. Also remove any paging related parameter like “page-size-bytes”
/subsystem=messaging-activemq/server=default/address-setting=#:undefine-attribute(name=page-size-bytes)
  • Note that “max-size-bytes” in this case is the size at which the producer will be throttled, when "address-full-policy" is set to BLOCK.

All the above can be done also when creating the default address as:

/subsystem=messaging-activemq/server=default/address-setting=#:add(dead-letter-address=jms.queue.mq.sys.dmq,expiry-address=jms.queue.ExpiryQueue,address-full-policy=BLOCK,max-size-bytes=104857600,message-counter-history-day-limit=10,auto-create-queues=true,auto-create-addresses=true)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.