[Mono-list] Mono and IO Performance

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Mon Mar 28 23:52:24 EDT 2011


On Mon, 2011-03-28 at 09:54 -0700, Julien wrote:
> I’m comparing.Net and mono runtimes for server applications that are socket
> bound. The performance penalty for mono is significant and I would like some
> advice from more experienced users.
> 
> My scenario is the following : 
> I’m trying to dequeue messages from a socket and dispatch them locally. On
> windows/.net, I can handle between 8k and 9k msg/second in release mode. The
> same application under windows/mono (with—gc=sgen) handles between 1.5k and
> 3.5K msg/second. Under ubuntu/mono, it handles between 2K and 4k msg/second. 
> 
> In order to find the bottleneck, I did a profiling under linux. Here are the
> GC Summary : 
> 	GC resizes: 0
> 	Max heap size: 0
> 	Object moves: 108499
> 	Gen0 collections: 134, max time: 10185us, total time: 257995us, average:
> 1925us
> 	Gen1 collections: 4, max time: 8366us, total time: 27318us, average: 6829us
> 	GC handles weak: created: 35, destroyed: 0, max: 35
> 	GC handles normal: created: 2, destroyed: 0, max: 2
> 
> And the first few lines of the method call summary, sorted by self :
> 414671   414671      99881 (wrapper managed-to-native)
> System.Threading.Monitor:Monitor_wait (object,int)
>   397184   396993      76558 (wrapper managed-to-native)
> System.IO.InotifyWatcher:ReadFromFD (intptr,byte[],intptr)
>   275720   275720         11 (wrapper managed-to-native)

The above line means that you are using FileSystemWatcher in your tests.
This is not pure socket IO. Anyway, I'll take a look at that
ReadFromFD() and see if we can reduce memory use or do something to make
it faster.


> System.Net.Sockets.Socket:Receive_internal
> (intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)
>   114162   114162         26 (wrapper managed-to-native)

Why are you not using SocketAsyncEventArgs+ReceiveAsync()? Or at least
socket.BeginReceive...

-Gonzalo




More information about the Mono-list mailing list