ENet

Practical Testing: 23 - Another new approach: timer wheels

The most recent articles in the “Practical Testing” series have been discussing the performance of the timer queue that we have built. As I hinted when I first brought up the performance issues, the particular use case that I have which is causing problems might well be more efficiently dealt with using a different (more specialised and less general purpose) design. The timer queue has adequate performance for general purpose use and can handle timers set within a range of 0ms to 49.

Practical Testing: 21 - Looking at Performance and finding a leak

Back in 2004, I wrote a series of articles called “Practical Testing” where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to show how writing your tests before your code changes how you design your code. Since the original articles there have been several bug fixes and redesigns all of which have been supported by the original unit tests and many of which have led to the development of more tests.

Bugs

It’s been a bit of a week for bugs. First I had a bug report for the really rather old CodeProject socket server COM object. This allows people using VB to create a socket server that uses the free version of The Server Framework. It works well, for what it is, and has been the basis for several custom objects that various clients have needed over the years. The bug involves the ‘read string’ functionality and either the ATL headers (specifically the narrow to wide character conversion macros) have changed since the code was originally written in 2002 in VC 6.

.Net 4.0 Hosting

I’ve been playing with Visual Studio 2010 Beta 2 and .Net 4.0, building code, running tests, playing with the IDE, etc. The first issue that I’ve come across with my existing codebase is that the .Net 2.0 hosting APIs (such as CorBindToRuntimeEx)are now deprecated and there’s a whole new way of hosting the CLR. We’ve been quite successful in hosting the CLR from within our C++ servers, either to provide servers that support a mix of managed/unmanaged plugins as a pluggable high performance windows application server or to provide network protocol support in C++ (such as ENet) with ‘business logic’ being written in managed code.

Using Wireshark to debug UDP communication issues

A customer of mine has been having some problems with communication between a UDP server and their load test client. The UDP server implements the ENet protocol which provides for reliable data transfer over UDP. Their problem was manifesting as the client not getting some ENet level ACKs for some reliable data. The Wireshark log from the client machine showed the client resending the data when the ENet retransmission timeout expired and also showed that the ACKs for these packets never arrived.

Reliable UDP

I’ve been doing some work for a client on their reliable UDP implementation. It’s been interesting stuff. They had picked out a ‘best of breed’ open source, reliable UDP protocol implementation (ENet) which was in ‘C’ and integrated it into their server that was written in C++ with my framework. Unfortunately the ‘C’ API assumed a synchronous ‘pull’ model for the communications and The Server Framework gave them an asynchronous ‘push’ model.