Hi Ryan,
how are you setting copyMessageOnSend - and are the consumers using
vm://transport too ?
cheers,
Rob
http://open.iona.com/products/enterprise-activemq
http://rajdavies.blogspot.com/
On 23 May 2008, at 23:32, Ryan Stewart wrote:
I'm trying to use an embedded ActiveMQ instance for some lightweight
message
handling. According to the
http://activemq.apache.org/vm-transport-reference.html VM Transport
Reference and
http://activemq.apache.org/how-should-i-use-the-vm-transport.html
this FAQ ,
the VM transport should pass messages by reference, giving some
nice, lean
performance.
I'm using version 5.1.0 final. All in one VM, I create one producer
and then
x durable subscribers to a topic. They all use vm://default for the
connection URI, which, according to the docs, starts a single embedded
broker.
Using a profiler, I see that for every message to the topic, 2x
message
objects are created (ActiveMQTextMessage in this case). i.e. If I
have 10
subscribers and send 100 messages, I end up with 2001 messages in
memory if
none are consumed. That's 1 message cached in the producer for
sending and
2000 others that result from the sends. I've set copyMessageOnSend
to false
in both the producer and consumers, but 1) looking at the source of
ActiveMQConnection, this setting seems to not be used, and 2) if it
were
used, I suspect it should only need to be set on producers.
In addition to the number of messages being created, they are going
through
some sort of marshaling/unmarshaling process, which causes their
related
ActiveMQTopic object to also be replicated a number of times: once
for every
two messages that exist, in fact. I assume something like this is
happening:
1) producer puts message in topic
2) topic creates a copy of each message for each consumer and pushes
to
consumer via marshaling mechanism
3) consumer unmarshals message resulting in another message instance
plus a
topic instance
That would mean that step 2 creates one message per subscriber, and
step 3
creates one message and one topic per subscriber, which accounts for
the
numbers I'm seeing.
My main question is how to get the number of message objects down.
Ideally,
I'd like to see it at 1 since the producer is just sending the same
message
over and over right now. Any hints?
--
View this message in context:
http://www.nabble.com/VM-transport-not-using-pass-by-reference-tp17442075s2354p17442075.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.