Since I couldn't look at your code because of the license grant issue, I looked in to what you had mentioned about the NoDelay option. I took a stab at adding support for turning this (and several other socket transport options) on and off from the connection URI. Once you fix the license grant, I can look at your patch and integrate it in with my changes.
The solution I am playing with would look like this: activemq:tcp://localhost:61616?connection.NoDelay=true This would turn off the Nagle algorithm on the socket connection. Thanks! -Jim On 8/27/08, Jim Gomes <[EMAIL PROTECTED]> wrote: > Hi Stefan, > > Thanks for creating Jira AMQNET-109 and attaching the patch. However, > the Grant ASF License option was not checked. Would you re-attach the > patch and check that option? I can then look at integrating it into > the codebase. > > Thanks! > -Jim > > > > On 8/26/08, Stefan Gmeiner <[EMAIL PROTECTED]> wrote: >> We are evaluating the NMS-API to connect a C# app to our ActiveMQ >> broker. For this we wrote a simple client which sends a request and >> waits for a reply (Client --> Broker --> Server --> Broker --> Client). >> The client/server C#-app runs in a single process with two different >> connections to the broker which resides on a different pc on the network. >> >> This scenario takes about 200ms for each message transfered by the >> C#-API and less than 20ms by the Java-API although both do the same thing. >> >> Does anybody have an idea what is going wrong or why there is such a big >> time differences? >> >> Thank you for helping >> Stefan >> >> >> Code for the C# test app follows: >> ========================================== >> using System; >> using Apache.NMS; >> >> namespace Test >> { >> class SimpleTest >> { >> private static readonly String URI = "tcp://broker:61616"; >> private static readonly String REQUEST_QUEUE = "test.request"; >> >> private static DateTime startOffset; >> >> public static void Main() >> { >> IConnectionFactory factory = new >> NMSConnectionFactory(URI); >> >> SetUpReceiver(factory); >> SetUpSender(factory); >> >> Console.WriteLine("Press any key to quit."); >> Console.ReadKey(); >> } >> >> >> private static void SetUpReceiver(IConnectionFactory factory) >> { >> // set up receiver >> IConnection rConnection = factory.CreateConnection(); >> ISession rSession = rConnection.CreateSession(); >> IMessageConsumer rConsumer = >> rSession.CreateConsumer(rSession.GetQueue(REQUEST_QUEUE)); >> IMessageProducer rProducer = rSession.CreateProducer(); >> rConsumer.Listener += delegate(IMessage message) >> { >> OnMessage(rSession, rProducer, message); >> }; >> rConnection.Start(); >> } >> >> private static void SetUpSender(IConnectionFactory factory) >> { >> IConnection sConnection = factory.CreateConnection(); >> ISession sSession = sConnection.CreateSession(); >> IMessageProducer sProducer = >> sSession.CreateProducer(sSession.GetQueue(REQUEST_QUEUE)); >> IDestination replyDestination = >> sSession.CreateTemporaryQueue(); >> IMessageConsumer sConsumer = >> sSession.CreateConsumer(replyDestination); >> sConnection.Start(); >> >> for (int i = 0; i < 5; i++) >> { >> Console.WriteLine("Test " + i); >> >> // send message and wait for reply >> IMessage requestMsg = >> sSession.CreateTextMessage("Request" + i); >> requestMsg.NMSReplyTo = replyDestination; >> >> startOffset = DateTime.Now; >> >> sProducer.Send(requestMsg, false, >> NMSConstants.defaultPriority, >> NMSConstants.defaultTimeToLive); >> >> WriteTimedMessage("Request message sent"); >> >> IMessage replyMsg = sConsumer.Receive(); >> >> WriteTimedMessage("Reply message received"); >> } >> } >> >> private static void OnMessage(ISession session, IMessageProducer >> producer, IMessage message) >> { >> WriteTimedMessage("Request message received"); >> >> IMessage replyMsg = session.CreateTextMessage("Reply"); >> producer.Send(message.NMSReplyTo, replyMsg, false, >> NMSConstants.defaultPriority, NMSConstants.defaultTimeToLive); >> >> WriteTimedMessage("Reply message sent"); >> } >> >> >> private static void WriteTimedMessage(String message) >> { >> lock (typeof(SimpleTest)) >> { >> TimeSpan diff = DateTime.Now - startOffset; >> Console.WriteLine("{0} ms: {1}", >> diff.TotalMilliseconds, message); >> } >> } >> } >> } >> >> >> >> >