Jun 15, 2011 at 8:14 PM

I decided to do a quick benchmark of C# Webserver using ApacheBench. The 'WebserverExample' folder contains an index.htm which was used as output data, and 'HttpServerExample' was used as the server. The competitors are the .Net 4 HttpListener class and the Mono implementation of that same class.

1 concurrent connection, no keep-alives, 1000 requests:

C# Webserver: 43 req/sec

.Net HttpListener: 1968 req/sec

Mono HttpListener: 1712 req/sec

1 concurrent connection, keep-alive, 1000 requests:

C# Webserver: 87 req/sec

.Net HttpListener: 3194 req/sec

Mono HttpListener: 3007 req/sec

10 concurrent connections, 100.000 requests:

C# Webserver: 28 req/sec

.Net HttpListener: 4573 req/sec

Mono HttpListener: 6032 req/sec


The Mono code does exactly the same as C# Webserver (open socket, wait, etc.), so how can there be so much difference? The .Net class uses http.sys in kernelmode under the hood, so the comparison is not fair, but the Mono code is very similar? 

Jun 16, 2011 at 5:46 AM

It's because I've never even thought about performance when I made the HttpListener. I just needed a simple http server that I could embed in my application.

I'm currently building a highperformance socket framework using the new async framework. It's inspired by the netty framework for java. The first protocol implementation that I'll make is a HTTP listener. It should be done in a couple of weeks. 

Nov 15, 2012 at 11:30 AM

Look at the demo server for my new library. I just commited a new version