[Mono-dev] Remoting and thread pool limits

pablosantosluac pablosantosluac at terra.es
Sat Dec 15 05:49:34 EST 2007


I've found the following difference working with .NET and Mono remoting. In 
.NET when the remoting ThreadPool reaches the pool's maximum (25 threads per 
process), it is able to continue creating new threads. In fact, you can end 
up having a remoting server with hundreds of threads.

In mono the behaviour is different. Once the limit is reached it starts 
refusing connections.

The other drawback of the standard (1.1) remoting (.NET) is that once the 
thread pool limit is reached, each new thread takes a loooong time. In fact, 
replacing the standard TCP channel by, for instance, the GenuineChannels 
one, performance gets increased under heavy load.

The attached code creates a remoting server which implements one method. The 
method is really simple:
    public string GetVal()
        Console.WriteLine("GetVal() - ThId:{0}", 
        return "Hi There";

Well, if you have a client launching 200 threads at the same time and 
calling the server, it should take about 1 second to complete. Here are my 
results using .NET (it doesn't finish with mono)

1 - Time 1102 ms
5 - Time 1011 ms
10 - Time 1002 ms
20 - Time 1011 ms
40 - Time 2003 ms
50 - Time 2013 ms
200 - Time 6019 ms

Using GenuineChannels (the difference here is how they implement the 
threadpool), all get about 1 sec to finish.

Please find the sample code at 



More information about the Mono-devel-list mailing list