activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Tully (JIRA)" <>
Subject [jira] [Commented] (AMQ-5748) Add the ability to get Message Size from a Message Store
Date Tue, 28 Apr 2015 12:38:06 GMT


Gary Tully commented on AMQ-5748:

Hi Christopher, this is a substantial contrib and it looks good :-)

My first thought was how different would the be from mKahaDB with a store per destination
and the existing store size metric. I guess that would be more coarse, but it would be per
destination. I think that would need a tweak on mKahaDb to isolate the store size but that
would be trivial in comparison. How would that map with your use case?

On the change to messageStore, if the intent is some metric that is accessed frequently, maybe
introduce a destinationStatistic that is backed and initialised by the index. It would mean
that the calculation is always up to date and there will be not store block on the index iterations.

Am I correct in thinking this is a precursor to doing flow control based on total message
size, if that is the case it extending the destination statistic to encompass this would make
sense. That is the pattern for messageCount.

> Add the ability to get Message Size from a Message Store
> --------------------------------------------------------
>                 Key: AMQ-5748
>                 URL:
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.11.1
>            Reporter: Christopher L. Shannon
>            Priority: Minor
> Currently, the {{MessageStore}} interface supports getting a count for messages ready
to deliver using the {{getMessageCount}} method.  It would also be very useful to be able
to retrieve the message sizes for those counts as well for keeping track of metrics.
> I've created a pull request to address this that adds a {{getMessageSize}} method that
focuses specifically on KahaDB and the Memory store.  The KahaDB store uses the same strategy
as the existing {{getMessageCount}} method, which is to iterate over the index and total up
the size of the messages.  There are unit tests to show the size calculation and a unit test
that shows a store based on version 5 working with the new version (the index is rebuilt)
> One extra issue is that the size was not being serialized to the index (it was not included
in the marshaller) so that required making a slight change and adding a new marshaller for
{{Location}} to store the size in the location index of the store.  Without this change, the
size computation would not work when the broker was restarted since the size was not serialized.
> Note that I wasn't sure the best way to handle the new marshaller and version compatibilities
so I incremented the KahaDB version from 5 to 6. If an old version of the index is loaded,
the index should be detected as corrupted and be rebuilt with the new format.  If there is
a better way to handle this upgrade let me know and the patch can certainly be updated.

This message was sent by Atlassian JIRA

View raw message