ARTEMIS-6009 Performance improvement when consuming large messages#6369
ARTEMIS-6009 Performance improvement when consuming large messages#6369jbertram merged 2 commits intoapache:mainfrom
Conversation
|
Looking at the implementation of I might be would be worth having a JMH test (see Aside from that, regression tests would probably suffice. |
f1faff6 to
4e12299
Compare
|
Thanks @jbertram, I've never worked with JMH previously so that might take some time to get in place... In the meantime, I have some additional figures from what I'm seeing when testing this change: In a "real world" scenario, i.e broker and client running on dedicated servers, communicating over a network: I've also set up and run a test locally, using a standalone broker (2.53.0), default configuration, with 300k messages preloaded like this: Messages are then consumed by a "cli consumer" using either broker release 2.53.0 or a version built on top of this PR.
This is the command used to consume messages: Results: I collected flame graphs from the local tests which I have added here: |
|
The change makes sense and maps to how this is normally handled in other areas of the broker code as well. You normally would override those built in stream methods as the default implementation simply calls the main writeByte method in a loop which is quite inefficient. |
|
Also, when I said: "I'm not quite sure how I go about writing a meaningful test for this, any feedback on that would be greatly appreciated." I meant that I'm not quite sure how to go about writing a regression test to validate the new behavior... at least not without relaxing access to the I'll keep trying but if anyone has an idea, It's probably better than what I'm currently piecing together. |
|
@AntonRoskvist those results are compelling! Nice work. Previously when I said, "...regression tests would probably suffice," I meant that existing tests would probably suffice for detecting regressions. Ultimately, if you provide a way for folks to independently verify the performance improvement and the existing test-suite is green then I think that's sufficient. |
|
I ran this through CI and all tests are passing. The commit message does not contain the related JIRA which needs to be fixed. |
4e12299 to
2afdc3c
Compare
2afdc3c to
e95232b
Compare
|
@jbertram @tabish121 thanks! I've been unable to make a decent JMH-test for this, so I instead added a very simple test under "soak-tests" in a secondary commit. I'm very open to exclude that unless you feel it adds some value. If nothing else it should serve as a simple way to try this out for yourselves. |
e95232b to
7c9aefa
Compare
|
@AntonRoskvist I used your test on |
|
@AntonRoskvist / @jbertram I'm replacing the soak test by a MockedTest This test was taking 3 minutes on my laptop, and 2 minutes on the CI. The MockedTest I wrote will validate the write([], int, int) was used. |
|
PR sent here to replace test: #6385 |
Current solution reads the message payload using Javas
OutputStreamdefault implementation which iterates over a given byte array and returns an int for each value.This change instead passes the byte array "as is" through the
ActiveMQOutputStreamassociated with the large message into itsActiveMQBuffer.I'm seeing a "real world" performance improvement of about 170% for a client handling exclusively large messages.
I'm not quite sure how I go about writing a meaningful test for this, any feedback on that would be greatly appreciated.