You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Dondorp, Erwin" <er...@cgi.com> on 2021/06/07 20:39:22 UTC

text-message size when the message is in the Artemis broker memory

Hello,

A text message takes about twice the size when it is kept in the broker memory.
A warning for that is present in the documentation, see https://activemq.apache.org/components/artemis/documentation/latest/large-messages.html#configuring-the-core-client

But I could not find the exact reason for this. E.g. I found no explicit utf-16 / ucs-2 encoding logic.
I'm assuming that this is because java Strings are used, which use ucs-2 internally.
Is that correct? If not, what does cause the use of 2 bytes per character in Artemis?
If it is the internal string size, will java9+ then lower the memory use of Artemis, as it can detect Latin1/ISO-8859-1 and use byte-encoded strings when possible?

Is there any chance that this ratio becomes somehow configurable in the future?
(obviously, sending everything as a bytes-message does that automatically, by then I'm unleashing the character conversion problems into the clients)

Thx,
Erwin

Re: text-message size when the message is in the Artemis broker memory

Posted by Justin Bertram <jb...@apache.org>.
Checkout the SimpleString class [1]. Hopefully that will answer most of
your questions.


Justin

[1]
https://github.com/apache/activemq-artemis/blob/main/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java

On Mon, Jun 7, 2021 at 3:39 PM Dondorp, Erwin <er...@cgi.com> wrote:

> Hello,
>
> A text message takes about twice the size when it is kept in the broker
> memory.
> A warning for that is present in the documentation, see
> https://activemq.apache.org/components/artemis/documentation/latest/large-messages.html#configuring-the-core-client
>
> But I could not find the exact reason for this. E.g. I found no explicit
> utf-16 / ucs-2 encoding logic.
> I'm assuming that this is because java Strings are used, which use ucs-2
> internally.
> Is that correct? If not, what does cause the use of 2 bytes per character
> in Artemis?
> If it is the internal string size, will java9+ then lower the memory use
> of Artemis, as it can detect Latin1/ISO-8859-1 and use byte-encoded strings
> when possible?
>
> Is there any chance that this ratio becomes somehow configurable in the
> future?
> (obviously, sending everything as a bytes-message does that automatically,
> by then I'm unleashing the character conversion problems into the clients)
>
> Thx,
> Erwin
>