[Mono-dev] TcpServerChannel loosing connections under heavy load

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Mon Jul 13 13:31:30 EDT 2009

On Sun, 2009-07-12 at 00:11 +0200, pablosantosluac at terra.es wrote:
> Hi,
> I'm having issues with Mono remoting under high performance networking
> scenarios. Some clients are rejected since the server is not able to
> handle connections.
> Look at the following code inside TcpServerChannel
> (http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs?revision=110042&view=markup)
> When a high number of threads is managed (about 130 concurrent clients),
> it makes the channel reject remote requests.
> Inside the "threadPool" the following code:
>  threadDone.WaitOne(PoolGrowDelay, false);
> Makes thread creation wait 500ms (I guess just forcing the CPU to switch
> to another one) each time a new thread is created (when the pool is
> growing).
> If you remove it, connection problems go away, but I guess it's not the
> right way to implement it.

That should be modified to make use of the .NET ThreadPool and use
asynchronous operations for accept, read and write (this last one is not
"mandatory"). There's code in xsp that illustrates the way it should be

> Since NoDelay was set by Robert Jordan to the TcpConnectionPool.
> Question: I see it applies to the client but, wouldn't it be useful for
> the server too?

It depends, but probably yes.


More information about the Mono-devel-list mailing list