Re: Performance Issue

2006-12-19 Thread Hiram Chirino

Best bet is to run it with a profiler to figure out where the hot spot
is for linux.

On 12/18/06, garima015 [EMAIL PROTECTED] wrote:


I am facing a really bad performance of ActiveMq on linux box.
When running on windows 1000 transactions are taking 2 seconds and when
running on Linux same are taking 40 sec.
Please if anybody can tell me solution to performance issue.

Here is the code i am using to send and receive the message.

Thanks in advance

public class Requestor{
private Session session;
private Destination replyQueue;
private MessageProducer requestProducer;
private MessageConsumer replyConsumer;
Logger logger = null;

/**
 * Constructor
 */
protected Requestor() {
super();
logger = LoggerWrapper.getLogger(this.getClass().getName());
}

/**
 * This method will return the object of Requestor
 * @param connection, Connection
 * @param requestQueueName , String
 * @return  Requestor object
 * @throws JMSException
 * @throws NamingException
 */
public static Requestor newRequestor(Connection connection, String
requestQueueName)throws JMSException, NamingException {
Requestor requestor = new Requestor();
requestor.initialize(connection, requestQueueName);
return requestor;
}

/**
 * This method will initialize the Producer and Consumer on request
and reply queue
 * @param connection, Connection
 * @param requestQueueName , String
 * @throws NamingException
 * @throws JMSException
 */
protected void initialize(Connection connection, String
requestQueueName)throws NamingException, JMSException {
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination requestQueue =
session.createQueue(requestQueueName);

replyQueue = session.createTemporaryQueue();
requestProducer = session.createProducer(requestQueue);

requestProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
replyConsumer = session.createConsumer(replyQueue);
replyConsumer.receive(10);
}

/**
 * This method is used to send the message to queue
 * @param message
 * @throws JMSException
 */
public String send(String message) throws JMSException {
TextMessage requestMessage = (TextMessage)
session.createTextMessage();
requestMessage.setText(message);
requestMessage.setJMSReplyTo(replyQueue);
requestProducer.send(requestMessage);
return receiveSync();
}

/**
 * This method is used to receive the message from the queue
 * @return String
 * @throws JMSException
 */
private String receiveSync() throws JMSException {
TextMessage replyMessage = null;
Message msg =  replyConsumer.receive();

if (msg instanceof TextMessage){
replyMessage = (TextMessage) msg;
}
logger.debug(receive Sync:+ new Date().getTime());
return replyMessage.getText();
}
}

public class Replier implements MessageListener {

private Session session;
Logger logger = null;
Engine engineRef = null;
Transformer transformerRef = null;
MessageConsumer requestConsumer = null;
Destination replyDestination = null;
private static Map destinationMap = new HashMap();
/**
 * Constructor
 *
 */
protected Replier(){
super();
logger = LoggerWrapper.getLogger(this.getClass().getName());
}

/**
 * This will return the instance of replier
 * @param connection, Connection
 * @param requestQueueName
 * @return
 * @throws Exception
 */
public static Replier newReplier(Connection connection,String
requestQueueName ,Engine engine,Transformer transformer)throws Exception {
Replier replier = new Replier();
replier.initialize(connection,
requestQueueName,engine,transformer);
return replier;
}

/**
 * This method will initilize the consumer on request queue
 * @param connection
 * @param requestQueueName
 * @throws Exception
 */
protected void initialize(Connection connection, String
requestQueueName, Engine engine,Transformer transformer)throws Exception {
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);

// Create the destination (Topic or Queue)
//Destination requestQueue =
session.createQueue(requestQueueName+?consumer.retroactive=true

Re: Performance Issue

2006-12-19 Thread garima015

Thanks for the reply,but it is solved.


Hiram Chirino wrote:
 
 Best bet is to run it with a profiler to figure out where the hot spot
 is for linux.
 
 On 12/18/06, garima015 [EMAIL PROTECTED] wrote:

 I am facing a really bad performance of ActiveMq on linux box.
 When running on windows 1000 transactions are taking 2 seconds and when
 running on Linux same are taking 40 sec.
 Please if anybody can tell me solution to performance issue.

 Here is the code i am using to send and receive the message.

 Thanks in advance

 public class Requestor{
 private Session session;
 private Destination replyQueue;
 private MessageProducer requestProducer;
 private MessageConsumer replyConsumer;
 Logger logger = null;

 /**
  * Constructor
  */
 protected Requestor() {
 super();
 logger =
 LoggerWrapper.getLogger(this.getClass().getName());
 }

 /**
  * This method will return the object of Requestor
  * @param connection, Connection
  * @param requestQueueName , String
  * @return  Requestor object
  * @throws JMSException
  * @throws NamingException
  */
 public static Requestor newRequestor(Connection connection,
 String
 requestQueueName)throws JMSException, NamingException {
 Requestor requestor = new Requestor();
 requestor.initialize(connection, requestQueueName);
 return requestor;
 }

 /**
  * This method will initialize the Producer and Consumer on
 request
 and reply queue
  * @param connection, Connection
  * @param requestQueueName , String
  * @throws NamingException
  * @throws JMSException
  */
 protected void initialize(Connection connection, String
 requestQueueName)throws NamingException, JMSException {
 session = connection.createSession(false,
 Session.AUTO_ACKNOWLEDGE);
 Destination requestQueue =
 session.createQueue(requestQueueName);

 replyQueue = session.createTemporaryQueue();
 requestProducer = session.createProducer(requestQueue);

 requestProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
 replyConsumer = session.createConsumer(replyQueue);
 replyConsumer.receive(10);
 }

 /**
  * This method is used to send the message to queue
  * @param message
  * @throws JMSException
  */
 public String send(String message) throws JMSException {
 TextMessage requestMessage = (TextMessage)
 session.createTextMessage();
 requestMessage.setText(message);
 requestMessage.setJMSReplyTo(replyQueue);
 requestProducer.send(requestMessage);
 return receiveSync();
 }

 /**
  * This method is used to receive the message from the queue
  * @return String
  * @throws JMSException
  */
 private String receiveSync() throws JMSException {
 TextMessage replyMessage = null;
 Message msg =  replyConsumer.receive();

 if (msg instanceof TextMessage){
 replyMessage = (TextMessage) msg;
 }
 logger.debug(receive Sync:+ new Date().getTime());
 return replyMessage.getText();
 }
 }

 public class Replier implements MessageListener {

 private Session session;
 Logger logger = null;
 Engine engineRef = null;
 Transformer transformerRef = null;
 MessageConsumer requestConsumer = null;
 Destination replyDestination = null;
 private static Map destinationMap = new HashMap();
 /**
  * Constructor
  *
  */
 protected Replier(){
 super();
 logger =
 LoggerWrapper.getLogger(this.getClass().getName());
 }

 /**
  * This will return the instance of replier
  * @param connection, Connection
  * @param requestQueueName
  * @return
  * @throws Exception
  */
 public static Replier newReplier(Connection connection,String
 requestQueueName ,Engine engine,Transformer transformer)throws Exception
 {
 Replier replier = new Replier();
 replier.initialize(connection,
 requestQueueName,engine,transformer);
 return replier;
 }

 /**
  * This method will initilize the consumer on request queue
  * @param connection
  * @param requestQueueName
  * @throws Exception
  */
 protected void initialize(Connection connection, String
 requestQueueName, Engine engine,Transformer transformer)throws Exception
 {
 session = connection.createSession(false

Re: Performance Issue

2006-12-19 Thread James Strachan

On 12/19/06, garima015 [EMAIL PROTECTED] wrote:


Thanks for the reply,but it is solved.


How did you solve it?

--

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


Re: Performance Issue

2006-12-19 Thread garima015

Changing the delivery mode to NONpersisitent and creating the session using
Session.DUPS_OK_ACKNOWLEDGE is effectively increasing the performance..now
it is processing 1000 transactions in less than 2 sec

James.Strachan wrote:
 
 On 12/19/06, garima015 [EMAIL PROTECTED] wrote:

 Thanks for the reply,but it is solved.
 
 How did you solve it?
 
 -- 
 
 James
 ---
 http://radio.weblogs.com/0112098/
 
 

-- 
View this message in context: 
http://www.nabble.com/Performance-Issue-tf2841698.html#a7952578
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.



Performance Issue

2006-12-18 Thread garima015

I am facing a really bad performance of ActiveMq on linux box. 
When running on windows 1000 transactions are taking 2 seconds and when
running on Linux same are taking 40 sec. 
Please if anybody can tell me solution to performance issue. 

Here is the code i am using to send and receive the message. 

Thanks in advance 

public class Requestor{ 
private Session session; 
private Destination replyQueue; 
private MessageProducer requestProducer; 
private MessageConsumer replyConsumer; 
Logger logger = null; 

/** 
 * Constructor 
 */ 
protected Requestor() { 
super(); 
logger = LoggerWrapper.getLogger(this.getClass().getName()); 
} 

/** 
 * This method will return the object of Requestor 
 * @param connection, Connection 
 * @param requestQueueName , String 
 * @return  Requestor object 
 * @throws JMSException 
 * @throws NamingException 
 */ 
public static Requestor newRequestor(Connection connection, String
requestQueueName)throws JMSException, NamingException { 
Requestor requestor = new Requestor(); 
requestor.initialize(connection, requestQueueName); 
return requestor; 
} 

/** 
 * This method will initialize the Producer and Consumer on request
and reply queue 
 * @param connection, Connection 
 * @param requestQueueName , String 
 * @throws NamingException 
 * @throws JMSException 
 */ 
protected void initialize(Connection connection, String
requestQueueName)throws NamingException, JMSException { 
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE); 
Destination requestQueue =
session.createQueue(requestQueueName); 

replyQueue = session.createTemporaryQueue(); 
requestProducer = session.createProducer(requestQueue); 
   
requestProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); 
replyConsumer = session.createConsumer(replyQueue); 
replyConsumer.receive(10); 
} 

/** 
 * This method is used to send the message to queue 
 * @param message 
 * @throws JMSException 
 */ 
public String send(String message) throws JMSException { 
TextMessage requestMessage = (TextMessage)
session.createTextMessage(); 
requestMessage.setText(message); 
requestMessage.setJMSReplyTo(replyQueue); 
requestProducer.send(requestMessage); 
return receiveSync(); 
} 

/** 
 * This method is used to receive the message from the queue 
 * @return String 
 * @throws JMSException 
 */ 
private String receiveSync() throws JMSException { 
TextMessage replyMessage = null; 
Message msg =  replyConsumer.receive(); 

if (msg instanceof TextMessage){ 
replyMessage = (TextMessage) msg; 
} 
logger.debug(receive Sync:+ new Date().getTime()); 
return replyMessage.getText(); 
} 
} 

public class Replier implements MessageListener { 

private Session session; 
Logger logger = null; 
Engine engineRef = null; 
Transformer transformerRef = null; 
MessageConsumer requestConsumer = null; 
Destination replyDestination = null; 
private static Map destinationMap = new HashMap(); 
/** 
 * Constructor 
 * 
 */ 
protected Replier(){ 
super(); 
logger = LoggerWrapper.getLogger(this.getClass().getName()); 
} 

/** 
 * This will return the instance of replier 
 * @param connection, Connection 
 * @param requestQueueName 
 * @return 
 * @throws Exception 
 */ 
public static Replier newReplier(Connection connection,String
requestQueueName ,Engine engine,Transformer transformer)throws Exception { 
Replier replier = new Replier(); 
replier.initialize(connection,
requestQueueName,engine,transformer); 
return replier; 
} 

/** 
 * This method will initilize the consumer on request queue 
 * @param connection 
 * @param requestQueueName 
 * @throws Exception 
 */ 
protected void initialize(Connection connection, String
requestQueueName, Engine engine,Transformer transformer)throws Exception { 
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE); 

// Create the destination (Topic or Queue) 
//Destination requestQueue