Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
proton-j-0.25.0, proton-j-0.28.0
Description
Testing has highlighted that the encoding of Strings within messages isn't very efficient, due to the manner in which the output is written to the destination buffer. By expanding WritableBuffer to allow writing a String directly, and improving the String encoding implementation therein we can improve performance of String encoding. Leveraging PROTON-1913 we can also provide the previous impl as a default fallback to avoid breaking compatibility with existing WritableBuffer implementations that lack one.
================
Original description:
While digging into performance issues in the Eclipse Hono project I noticed a high consumption of CPU time when encoding AMQP messages using proton-j.
I made a small reproducer and threw the same profiler at it, here are the results:
As you can see in the attach screenshot (the first is the initial run with the current code) most of the time is consumed in EncoderImpl#writeRaw(String). This due to the fact that is call "put" for every byte it want to encode.
The following screenshots are from a patched version which uses a small thread local buffer to locally encode the raw data and then flush it to the buffer in bigger chunks.
Screenshot 3 and 4 show the improve performance, but also show that the memory consumption stays low.
Attachments
Attachments
Issue Links
- links to