[rabbitmq-discuss] Error: RabbitMQ.Client.ConnectionFactory.cs - "Only one usage of each socket address (protocol/network address/port) is normally permitted"

Patrick Kenney pekenney at gmail.com
Wed Sep 2 20:24:37 BST 2009


k,

So i think you are agreeing with me that when I call ... new
ConnectionFactory().CreateConnection("localhost:5672")...

that I am using the same socket over and over again, but creating new
connections to it...

The following... "Error: RabbitMQ.Client.ConnectionFactory.cs - "Only one
usage of each socket address (protocol/network address/port) is normally
permitted"...

Is not a result of exhausting all available sockets on the system, its a
result of TCP being unable to dispose fast enough... so even though I have
already closed the socket explicitly the system has not disposed of it yet,
so it thinks I am trying to reuse the same socket... (This is confirmed
using the debugger & wireshark (packetsniffer)...

Additionally, this only occurs after thousands of consecutive calls to the
PublishMessage method i posted at the beginning of this thread...

So...

Taking your suggestion to make IModel and IConnection module level, my
threaded PublishMessage method now looks like the following...

public void PublishMessage(string pstrExchangeName, string pstrReturnKey,
string pstrXml)
        {
            try
            {
                if (null == m_Conn)
                {
                    m_Conn = new
ConnectionFactory().CreateConnection(m_strRabbitMqHost);
                }

                if (null == m_Channel)
                {
                    m_Channel = m_Conn.CreateModel();
                }

                IBasicProperties props = m_Channel.CreateBasicProperties();
                IStreamMessageBuilder b = new
StreamMessageBuilder(m_Channel);
                byte[] bytes = Encoding.UTF8.GetBytes(pstrXml);
                b.WriteBytes(bytes);
                m_Channel.BasicPublish(pstrExchangeName, pstrReturnKey,
null, bytes);
            }

          catch(Exception ex)
          {
                 throw ex;
          }

so the error is fixed, but... I still cannot even come close to the 4000
messages per second capability (with better then twice the hardware)
described at:
http://www.rabbitmq.com/faq.html

Q. How fast is RabbitMQ in persistent mode?

A. From our testing, we expect easily-achievable throughputs of 4000
persistent, non-transacted one-kilobyte messages per second (Intel Pentium
D, 2.8GHz, dual core, gigabit ethernet) from a single RabbitMQ broker node
writing to a single spindle.

so what kind of tcp configuration tweaks or otherwise did you guys have to
make to accomplish this?

I am getting about 10% of that advertised 4000 per second capability...

thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090902/e8122674/attachment.htm 


More information about the rabbitmq-discuss mailing list