Saturday, 5 November 2011

Scalable servers with async F#

We recently pitted a traditional server built using synchronous C# 4, ADO.NET and WCF with an equivalent solution built using asynchronous F#, ADO.NET and Google Protocol buffers over sockets. The characteristics of the two solutions really demonstrate the advantages of an asynchronous approach when using .NET. Specifically, our asynchronous solution was found to have the following advantages:

  • 2× lower CPU usage¹

  • 12× lower memory usage¹

  • 90× lower max latency

  • 10× higher max client connections

  • 4× less code!

¹ with a constant stream of queries.

The basic ideas behind this real-world asynchronous server have already been covered in the following F#.NET Journal articles:

Furthermore, the forthcoming .NET 4.5 will be the first to provide a fully asynchronous ADO.NET interface by adding a new ReadAsync method to read individual records from a database query asynchronously. This will make it possible to write fully asynchronous database code in .NET for the first time.

Drawing tree maps

The F#.NET Journal just published an article about visualization:

"A tree map is a simple way to visualize the relative sizes of a collection of objects in 2D. The idea is to recursively subdivide a rectangle into non-overlapping rectangles that have areas proportional to the weights they represent..."

To read this article and more, subscribe to The F#.NET Journal today!