How to control the no of activemq-data-xxx.amq files in Redhat AMQ Broker ??

In this post we will see How to control the no of activemq-data-xxx.amq files in AMQ Broker ?? this post runs through couple of interesting questions and answers between REQUESTER and EXPERT REPLY. At the end we will be able to get more than what we intended for . Let see

REQUESTER

We are using Redhat AMQ Broker and i could see many files are generated in the below /var/opt/amq-broker/mybroker/journal/ with some number xxx . 

/var/opt/amq-broker/mybroker/journal/activemq-data-xxx.amq 

Currently may files are getting generated and getting /var file system full . So if the no of files can be controlled  please let us know ?
broker.xml configuration related to journal log

<journal-type>ASYNCIO</journal-type>
<paging-directory>data/paging</paging-directory>
<bindings-directory>data/bindings</bindings-directory>
<journal-directory>data/journal</journal-directory>
<large-messages-directory>data/large-messages</large-messages-directory>
<journal-datasync>true</journal-datasync>
<journal-min-files>2</journal-min-files>
<journal-pool-files>10</journal-pool-files>
<journal-file-size>10M</journal-file-size>

<disk-scan-period>5000</disk-scan-period>
<!--  once the disk hits this limit the system will block, or close the connection in certain protocols
           that won't support flow control.  -->
<max-disk-usage>90</max-disk-usage>

EXPERT REPLY

These files contain copies of all of the so far un-consumed messages held by the broker [1], to reduce the number of file created the simplest solution would be to make sure that incoming messages are read by a consumer as soon as possible.

If your messages have a natural expiry (a time after which they would no longer be of interest) you can set a time to live on the messages [2] if there is a default expiry-address for the destination the expired messages will be sent there, if not they will be dropped.


[1] https://access.redhat.com/documentation/en-us/red_hat_amq/7.2/html/configuring_amq_broker/persistence#configuring_bindings_journal

[2] https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/configuring_messaging/set_message_expiry

REQUESTER

As per our configuration what is the expected behavior ? our message dont have expiry .

On one server i can see only today dated files and on some server i could see multiple days files .

With the current configuration what is the limit of the files and size of each file and flush interval ? Can help to let us know these details .

if we of <persistence-enabled>true</persistence-enabled> to false what happens to the messages that are not consumed by consumer ? where will that message store ?

If /var is 100% during that time if i remove activemq-data-xxx.amq will there be any impact ? apart from messages does it has any other data ?


EXPERT REPLY

> As per our configuration what is the expected behavior ? our message dont have expiry .

What you are seeing is the expected behaviour, if messages are being received by the broker but not consumed.

> On one server i can see only today dated files and on some server i could see multiple days files .

How many files you see will depend on how many messages are sent to each broker and whether or not they are being read by consumers.

> With the current configuration what is the limit of the files and size of each file and flush interval ?  Can help to let us know these details .

With your current configuration the broker will start with at least two journal files (the number of files will increase as more messages arrive):

      <journal-min-files>2</journal-min-files>

it will keep at least 10 files in a pool to be reused even when all messages have been consumed:

      <journal-pool-files>10</journal-pool-files>

each journal file will be 10M in size:

      <journal-file-size>10M</journal-file-size>

it will keep creating files (assuming more messages arrive and they are not consumed) until it has used 90% of the available disk space:

 <max-disk-usage>90</max-disk-usage>


> if we of    <persistence-enabled>true</persistence-enabled> to false what happens to the messages that are not consumed by consumer ? where will that message store ?

Messages are stored in memory and on disk, if you set persistence to "false" I believe that messages are still sent to page files when the in-memory space is full:

            <address-full-policy>PAGE</address-full-policy>

but the messages will not survive a broker re-start as this relies on messages being stored in the journal.

> If /var is 100% during that time if i remove activemq-data-xxx.amq  will there be any impact ? apart from messages does it has any other data ?

You can not safely remove a single journal file, it would leave the system with a corrupt set of data. You could stop the broker and remove the:

data/paging
data/bindings
data/journal
data/large-messages

directories but all of your messages would be gone when the broker restats, what you need to do is find out why messages are not getting consumed.


REQUESTOR
it will keep creating files (assuming more messages arrive and they are not consumed) until it has used 90% of the available disk space:

 <max-disk-usage>90</max-disk-usage>

As you mentioned broker will keep writing unitll disk space reached 90% right . once it reaches 90% then broker will stop getting messages in Then how come the file system /var goes to 100% ?

EXPERT REPLY
> As you mentioned broker will keep writing unitll disk space reached 90% right . once it reaches 90% then broker will stop getting messages in Then how come the file system /var goes to 100% ?

I am not sure, is there anything else that writes to this file system?

I would expect you to see a warning like:

WARN [org.apache.activemq.artemis.core.server] AMQ222210: Storage usage is beyond max-disk-usage. System will start blocking producers. 

When the limit is reached, do you see this in your ../log/artemis.log file?

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *