|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQMessage.Put performance |
« View previous topic :: View next topic » |
Author |
Message
|
javanewby |
Posted: Tue Jan 31, 2012 12:05 pm Post subject: MQMessage.Put performance |
|
|
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 |
|
 |
Vitor |
Posted: Tue Jan 31, 2012 12:44 pm Post subject: Re: MQMessage.Put performance |
|
|
 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 |
|
 |
mqjeff |
Posted: Tue Jan 31, 2012 1:03 pm Post subject: Re: MQMessage.Put performance |
|
|
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 |
|
 |
Vitor |
Posted: Tue Jan 31, 2012 1:11 pm Post subject: Re: MQMessage.Put performance |
|
|
 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 |
|
 |
mqjeff |
Posted: Tue Jan 31, 2012 1:15 pm Post subject: Re: MQMessage.Put performance |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|