You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by rousseau <st...@excite.com> on 2006/12/06 04:54:24 UTC
NMS and ActiveMQ latency
Just started looking at using C#NMS implementation and ActiveMQ 4.0.2, and am
having latency issues when the broker is on a different machine.
The C# code (more or less the same as the example) is given below. When I
run ./activemq on the same machine I get almost 0 latency reported, but when
I run ./activemq on a different machine (or different VM on the same box) I
get latency figures around 200ms. Am I doing something wrong?
thanks for your help
/Steve
Code:
public partial class Form1 : Form
{
HiPerfTimer timer;
IConnectionFactory factory;
IConnection connection;
ISession session;
IDestination destination;
IMessageConsumer consumer;
IMessageProducer producer;
public Form1()
{
InitializeComponent();
//Initialise MQ adapter
factory = new ConnectionFactory(new
Uri("tcp://stevefedora:61616"));
connection = factory.CreateConnection();
session = connection.CreateSession();
destination = session.GetQueue("Dog");
consumer = session.CreateConsumer(destination);
producer = session.CreateProducer(destination);
producer.Persistent = false;
timer = new HiPerfTimer();
}
private void Form1_Load(object sender, EventArgs e)
{
ITextMessage request;
ActiveMQTextMessage message;
request = session.CreateTextMessage("Hello!");
request.NMSCorrelationID = "abc";
request.Properties["Title"] = "Hello World";
request.Properties["Text"] = "To be or not to be.";
for (int i = 0; i < 10; i++)
{
//Start timing
timer.Start();
//Create and send request
producer.Send(request);
//recieve request
message = (ActiveMQTextMessage)consumer.Receive();
//stop timing
timer.Stop();
//print result
this.listBox1.Items.Add("[" + timer.Duration + " ms] " +
"Summat:" + message.NMSMessageId + "/" + message.Text +
" " + message.Properties);
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs
e)
{
consumer.Close();
session.Close();
connection.Close();
}
}
--
View this message in context: http://www.nabble.com/NMS-and-ActiveMQ-latency-tf2765978.html#a7713166
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: NMS and ActiveMQ latency
Posted by rousseau <st...@excite.com>.
btw, this is the latest NMS from the SVN repo.
/Steve
--
View this message in context: http://www.nabble.com/NMS-and-ActiveMQ-latency-tf2765978.html#a7713366
Sent from the ActiveMQ - User mailing list archive at Nabble.com.