k, <br><br>So i think you are agreeing with me that when I call ... new ConnectionFactory().CreateConnection(&quot;localhost:5672&quot;)...<br><br>that I am using the same socket over and over again, but creating new connections to it...<br>
<br>The following... &quot;Error: RabbitMQ.Client.ConnectionFactory.cs - &quot;Only one usage of each socket address (protocol/network address/port) is normally permitted&quot;...<br><br>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 &amp; wireshark (packetsniffer)...<br>
<br>Additionally, this only occurs after thousands of consecutive calls to the PublishMessage method i posted at the beginning of this thread...<br><br>So...<br><br>Taking your suggestion to make IModel and IConnection module level, my threaded PublishMessage method now looks like the following... <br>
<br> public void PublishMessage(string pstrExchangeName, string pstrReturnKey, string pstrXml)<br>        {<br>            try<br>            {<br>                if (null == m_Conn)<br>                {<br>                    m_Conn = new ConnectionFactory().CreateConnection(m_strRabbitMqHost);<br>
                }<br><br>                if (null == m_Channel)<br>                {<br>                    m_Channel = m_Conn.CreateModel();<br>                }<br><br>                IBasicProperties props = m_Channel.CreateBasicProperties();<br>
                IStreamMessageBuilder b = new StreamMessageBuilder(m_Channel);<br>                byte[] bytes = Encoding.UTF8.GetBytes(pstrXml);<br>                b.WriteBytes(bytes);<br>                m_Channel.BasicPublish(pstrExchangeName, pstrReturnKey, null, bytes);<br>
            }<br><br>          catch(Exception ex)<br>          {<br>                 throw ex;<br>          }<br><br>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:<br>
<a href="http://www.rabbitmq.com/faq.html">http://www.rabbitmq.com/faq.html</a><br><br>Q. How fast is RabbitMQ in persistent mode?<br><br>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. <br>
<br>so what kind of tcp configuration tweaks or otherwise did you guys have to make to accomplish this?<br><br>I am getting about 10% of that advertised 4000 per second capability...<br><br>thanks in advance.<br><br>