[rabbitmq-discuss] .NET Client ConnectionFactory threading issues
michal.liwoj at gmail.com
Sat Apr 20 05:20:04 BST 2013
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 ?
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss