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 » Excessive creation of short lived objects using client Mode

Post new topic  Reply to topic
 Excessive creation of short lived objects using client Mode « View previous topic :: View next topic » 
Author Message
gcrooks
PostPosted: Tue Jan 30, 2007 3:46 am    Post subject: Excessive creation of short lived objects using client Mode Reply with quote

Newbie

Joined: 21 Jan 2007
Posts: 1

I have a Business Partner that has a java application that connections and uses the Java MQ API v6.0.
They are using this in client mode with the java client connecting using the MQ API to a remote queue on another server machine v6.0.
This is entire Linux environment.
They run their test application detailed below and then profile with netbeans they see a large number of objects being created by the MQAPI.
So much so that they see the GC being heavily utilised and impacts performance.

In Client Mode they are seeing 190 objects per message
In Binding mode they are seeing 30 objects per message

Can anybody tell me why this excessive creation of objects
Thanks

Below is info from the Business Partner
--Process -----------------------------------------------

1. Clear MQ message queue and run 'put_inbound_queue_1.sh'
2. Attach Netbeans 5.5 profiler to the simulator and take initial memory
snapshot (see attached screenshot)
3. Press enter to start putting messages (10,000)
4. Take final memory snapshot

Similar steps are followed for the profiling of 10,000 MQ GET operations

---Operation---
CLASSPATH=/export/opt/mqm/samp/java/base/bin:/opt/mqm/java/lib/com.ibm.mq.jar
MQM_HOST=app1.dev
MQM_CHANNEL=CHANNEL1
MQM_QMGR=distra.queue.manager
MQM_CONNECTIONS=1
MQM_QNAME=INBOUND.QUEUE.1
MSG_SIZE=20
MSG_COUNT=10000
MQM_COMMIT_BATCH=1
java -agentpath:/opt/netbeans-5.5/profiler1/lib/deployed/jdk15/linux/libprofilerinterface.so=/opt/netbeans-5.5/profiler1/lib,5140 -server -showversion -verbose:gc -Xloggc:gc.log -Xms1500m -Xmx1500m -XX:NewSize=100m -XX:MaxNewSize=100m -XX:SurvivorRatio=2 -XX:MaxTenuringThreshold=16 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:+DisableExplicitGC -XX:+PrintHeapAtGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:-OmitStackTraceInFastThrow -classpath $CLASSPATH OutboundSimNoReport $MQM_HOST $MQM_CHANNEL $MQM_QMGR $MQM_CONNECTIONS $MQM_QNAME $MSG_SIZE $MSG_COUNT $MQM_COMMIT_BATCH


import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQGetMessageOptions;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;

public class InboundSim implements Runnable {

public static final int SHOW_SUMMARY_EVERY_XXX_NO_OF_MSGS = 250;

private static volatile boolean stopRunning;

private String instance;
private String qMgrName;
private String qName;
private int commitEveryXNoOfMsg;

public InboundSim(String instance,
String qMgrName,
String qName,
int commitEveryXNoOfMsg) {
this.instance = instance;
this.qMgrName = qMgrName;
this.qName = qName;
this.commitEveryXNoOfMsg = commitEveryXNoOfMsg;
}

public void run() {
try {
System.out.println(instance+":: Connecting to queue manager: "+qMgrName);
MQQueueManager qMgr = new MQQueueManager(qMgrName);

System.out.println(instance+":: Accessing inbound queue: "+qName);
MQQueue inbound = qMgr.accessQueue(qName, MQC.MQOO_INPUT_AS_Q_DEF);

MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT;
gmo.waitInterval = 1000;

MQMessage msg = new MQMessage();
int i = 0;
int currentTotal = 0;
long start = System.currentTimeMillis();

System.out.println(instance+":: Committing every "+commitEveryXNoOfMsg+" msgs...");

while(!stopRunning) {
try {
msg.messageId = MQC.MQMI_NONE;
msg.correlationId = MQC.MQCI_NONE;
inbound.get(msg, gmo);
} catch (MQException ex) {
if (ex.reasonCode == MQException.MQRC_NO_MSG_AVAILABLE) {
continue;
} else {
throw ex;
}
}

if (i > 0 && (i % commitEveryXNoOfMsg) == 0) {
qMgr.commit();
}

i++;
currentTotal++;
if ((i % SHOW_SUMMARY_EVERY_XXX_NO_OF_MSGS) == 0) {
long end = System.currentTimeMillis();
long duration = end - start;
System.out.println(instance+":: ["+i+"]: current MPS: "+((int) (currentTotal/(duration/1000.0))));
start = end;
currentTotal = 0;
}
}

// Close the queue
System.out.println(instance+":: Closing the queue");
inbound.close();

// Disconnect from the QueueManager
System.out.println(instance+":: Disconnecting from the Queue Manager");
qMgr.disconnect();
System.out.println(instance+":: Done!");
} catch (MQException ex) {
System.out.println("A WebSphere MQ Error occured : Completion Code " +
ex.completionCode + " Reason Code " + ex.reasonCode);
}
}

public static void main(String args[]) throws Exception {
// Command line args
String hostname = args[0];
String channel = args[1];
String qMgrName = args[2];
final int noOfConnections = Integer.parseInt(args[3]);
String qName = args[4];
int commitEveryXNoOfMsg = Integer.parseInt(args[5]);

System.out.println("Press [Enter] to start.");
try {
System.in.read();
} catch (Exception ignore) {}


MQEnvironment.hostname = hostname;
MQEnvironment.port = -1;
MQEnvironment.channel = channel;
System.out.println("Connecting to host: "+hostname);
System.out.println("Connecting to channel: "+channel);

System.out.println("Start "+noOfConnections+" simultaneous connection(s)");

final Thread[] threads = new Thread[noOfConnections];

for (int i=0; i<noOfConnections; i++) {
InboundSim is = new InboundSim("Connection #"+(i+1),
qMgrName,
qName,
commitEveryXNoOfMsg);
threads[i] = new Thread(is);
threads[i].start();
}

Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
stopRunning = true;
for (int i=0; i<noOfConnections; i++) {
try {
threads[i].join();
} catch (Exception ignore) {}
}
}
});
}
}
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 30, 2007 4:47 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It seems perfectly reasonable to me.

The bindings connection uses JNI to bind into the MQ C code, and so it is almost unreasonable to expect that it would invoke the same number or more Java objects than the "100% Pure" Java Client connection.

As such, it hardly seems fair to call this creation of objects "excessive".

Rule #1 with MQ troubleshooting is Eliminate Application Problems FIRST. It's entirely possible that all of the GC thrashing is a result of their code misuing the MQ API.
_________________
I am *not* the model of the modern major general.
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 » Excessive creation of short lived objects using client Mode
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.