[rabbitmq-discuss] .NET Client ConnectionFactory threading issues

Chris Haines cjbhaines at gmail.com
Mon Apr 22 17:07:57 BST 2013


Hi Michal,

I tried running this against 2 different machines as well. Against a server 
2.8.7 hosted on linux and a server 3.0.4 hosted on server 2008. 

The reason we want to do this is because we have a highly concurrent 
application serving around 300-600 threads each with its own consumer and a 
set of publishers. We were seeing poor throughput over one connection and I 
did some tests which show higher data throughput when using a larger number 
of connections. The only problem we seem to have with it is with the 
concurrent usage of the ConnectionFactory. I have gotten around this for 
now by creating all of the connections on the startup thread and after that 
the connections are shared between all of the threads and we see better 
performance. The broker seems to cope fine with about 1250 connections 
(running several instances of our server application).

I have asked my colleagues to run this as well and they are seeing the same 
symptoms. We are all running Win7 64 as well.

Cheers,
Chris 

On Saturday, 20 April 2013 05:20:04 UTC+1, Michal Levý wrote:
>
> Hey
>
> All your tests run just fine on my machine (Win7 64)
> CanCreateConnectionsMultiThreaded: Elapsed seconds: 2,9939693
> CanCreateConnectionsMultiThreadedWithLock: Elapsed seconds: 4,3135879
>
> Two difference here:
> - im connecting to remote RabbitMQ running on Debian (not localhost)
> - my client\server version is 3.0.2
>
> Here are few things to consider.
> 1) You are connecting to localhost. Each Rabbit connection opens 3 sockets 
> (2 for heartbeats). With 100 connections, its minimum 300 + 300 sockets 
> trying to open at the same time. Maybe your Win host cant handle it ?
> 2) Why are you trying to open 100 connection from one machine anyway ? Its 
> real wasting of resources. Do you know, you can run multiple independent 
> Rabbit channels on single connection ?
>
> Michal
>
> On Thursday, April 18, 2013 1:37:40 PM UTC+2, Chris Haines wrote:
>>
>> Hi All,
>>
>> I have attached a .cs Nunit test fixture to demonstrate a problem I am 
>> having with the ConnectionFactory. If I create 100 connections in a for 
>> loop single threaded then I can create them all in about 2 seconds. If I 
>> create them via a number of threads, in my test I am using 100 threads to 
>> create a connection on each, then I get a lot of timeout exceptions (my 
>> test bails out after 60 seconds). I have tried sharing an instance of the 
>> ConnectionFactory between all threads and also giving each thread its own 
>> instance but they both have the same result. I have also tried locking 
>> around the call to CreateConnection but that also didn't help. 
>>
>> I find this behavior to be very strange. Has anyone else had similar 
>> problems?
>>
>> Cheers,
>> Chris
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130422/bbc66d36/attachment.htm>


More information about the rabbitmq-discuss mailing list