You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Kuppe <ku...@360t.com> on 2006/07/26 07:35:08 UTC

On the wire size of messages

I am interested in reducing the total size of messages on the wire. Do you
have any suggestions as to how this can be best accomplished? Is compression
enabled by default and is there any way of tuning the compression? Is there
any way that you could suggest to measure the real size of messages being
sent over the broker?
-- 
View this message in context: http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5497938
Sent from the ActiveMQ - User forum at Nabble.com.


Re: On the wire size of messages

Posted by Kuppe <ku...@360t.com>.
Thanks Hiram. As i extend the TcpTransport already, would I be able to cast
the Command to an ActiveMQMessage and get the message size in the method
public void oneway(Command command) in the TcpTransport? If so, I assume
this would give me the uncompressed size. What about the compressed size?

Regards.
-- 
View this message in context: http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5504027
Sent from the ActiveMQ - User forum at Nabble.com.


Re: On the wire size of messages

Posted by James Strachan <ja...@gmail.com>.
That sounds like a bug - wanna try patch it and see if it fixes your issue?

On 7/27/06, Kuppe <ku...@360t.com> wrote:
>
> Actually it seems that the problem here is in the
> ActiveMQMessage.copy(ActiveMQMessage) which is called from the
> ActiveMQSession - it does not copy the connection! As the compression
> context is stored with the connection, the message then looses the context
> of whether it should be compressed on sending. Is there a explaination for
> this???
> --
> View this message in context: http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5514363
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: On the wire size of messages

Posted by Kuppe <ku...@360t.com>.
Actually it seems that the problem here is in the
ActiveMQMessage.copy(ActiveMQMessage) which is called from the
ActiveMQSession - it does not copy the connection! As the compression
context is stored with the connection, the message then looses the context
of whether it should be compressed on sending. Is there a explaination for
this???
-- 
View this message in context: http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5514363
Sent from the ActiveMQ - User forum at Nabble.com.


Re: On the wire size of messages

Posted by Kuppe <ku...@360t.com>.
I have looked further into the topic of compression and i find that i am
never seeing compression performed on the content of my messages. Perhaps
you can help?

I have debugged the sending of messages and found that from the
TcpTransport.oneway(Command) eventually MessageMarshaller.tightMarshal1 is
called and from here the ActiveMQTextMessage.beforeMarshall (WireFormat) is
called. It seems to be in this method that the output stream is wrapped by
the DeflaterOutputStream in the case that Compression is enabled for the
connection associated with the message. At this point my connection is
NULL!! Therefore compression is never performed...

I create connections with a connection factory that is configured with a
failover URI : 

failover:(vm://localhost:443)?initialReconnectDelay=100&maxReconnectDelay=30000&useExponentialBackOff=true&backOffMultiplier=2&maxReconnectAttempts=0

I then use the connection factory setUseCompression(true) to enable
compression for all connections created by this factory.

I would appreciate if you could point me in the right direction here.

Thanks.
-- 
View this message in context: http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5514248
Sent from the ActiveMQ - User forum at Nabble.com.


Re: On the wire size of messages

Posted by Kuppe <ku...@360t.com>.
Oh, and one other question. If i set the jms.useCompression=true on the
client side, will this enable compression for messages sent from the broker
to the client?

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5504064
Sent from the ActiveMQ - User forum at Nabble.com.


Re: On the wire size of messages

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Hi, compression is not currently enabled by default.  You can enable it by
adding a parameter to the connection URI.  For example:

tcp://localhost:61616?jms.useCompression=true

For more information see:
http://incubator.apache.org/activemq/connection-configuration-uri.html


To get the size of the message, cast the message to a ActiveMQMessage and
use the getSize() method AFTER the message has been sent by a message
producer.  If you just want to get the size of the payload of the message
use ActiveMQMessage.getContent().getLength()

Regards,
Hiram


On 7/26/06, Kuppe <ku...@360t.com> wrote:
>
> I am interested in reducing the total size of messages on the wire. Do you
> have any suggestions as to how this can be best accomplished? Is
compression
> enabled by default and is there any way of tuning the compression? Is
there
> any way that you could suggest to measure the real size of messages being
> sent over the broker?
> --
> View this message in context:
http://www.nabble.com/On-the-wire-size-of-messages-tf2002138.html#a5497938
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>



-- 
Regards,
Hiram

Blog: http://hiramchirino.com