ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » MQMessage.Put performance

Post new topic  Reply to topic
 MQMessage.Put performance « View previous topic :: View next topic » 
Author Message
javanewby
PostPosted: Tue Jan 31, 2012 12:05 pm    Post subject: MQMessage.Put performance Reply with quote

Newbie

Joined: 31 Jan 2012
Posts: 1

Using Java MQ class, Client connection, Server 7.0 version.

It takes 20mins to send 10K messages to MQ. Similar C++ code takes 3secs. Below is the code:

MQEnvironment.hostname = "some ip";
MQEnvironment.channel = "some channel";
MQEnvironment.port = 1417;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);

qMgr = new MQQueueManager(qManager);

int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING;
MQQueue mqQueue = qMgr.accessQueue("some queue", openOptions);

// the size of our message is around 700chars
String msg = "1234567890123456789012345678901234567890123456789012345678
9012345678901234567890123456789012345678901234567890123456789
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
2345678901234567890123456789012345678901234567890123456789012
34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
56789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
78901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
90123456789012345678901234567890";
MQMessage mqMessage = new MQMessage();
mqMessage.format = MQC.MQFMT_STRING;

MQPutMessageOptions pmo = new MQPutMessageOptions();

int i = 0;
long tm_ms_start;
long tm_ms_end;

tm_ms_start = System.currentTimeMillis();
while (i <= 10000) {
mqMessage.clearMessage();
mqMessage.writeString(msg);
mqQueue.put(mqMessage,pmo);
i = i+1;
}
tm_ms_end = (System.currentTimeMillis() - tm_ms_start);

System.out.println("writeToMQ =" + tm_ms_end);

mqQueue.close();
qMgr.disconnect();

The output for this is
writeToMQ =1190172 (19mins and 53seconds)

Am I doing something wrong here?
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 31, 2012 12:44 pm    Post subject: Re: MQMessage.Put performance Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

javanewby wrote:
It takes 20mins to send 10K messages to MQ. Similar C++ code takes 3secs.


If the C++ code is taking 3 seconds for a 10K message there's something wrong! I would theorise it's using the same wrong construction as here, connecting & disconnecting after each put, which could easily soak up 3 seconds. Any WMQ application should connect once, get or put as many times as it needs, then disconnect.

I'll leave better minds than mine to comment on the specifics of your Java code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jan 31, 2012 1:03 pm    Post subject: Re: MQMessage.Put performance Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
the same wrong construction as here, connecting & disconnecting after each put,

Apparenlty it's not just English you have difficulty reading?

Granted, the code should have been in [ c o d e ] tags.

The only thing I see fundamentally wrong with the code is the transport. That doesn't look like the right value.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 31, 2012 1:11 pm    Post subject: Re: MQMessage.Put performance Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqjeff wrote:
Apparenlty it's not just English you have difficulty reading?


It's going to be a long week.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jan 31, 2012 1:15 pm    Post subject: Re: MQMessage.Put performance Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
mqjeff wrote:
Apparenlty it's not just English you have difficulty reading?


It's going to be a long week.


I've been saying you need more Java for a while now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » MQMessage.Put performance
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.