My Program Performance
Posted on 2014-02-17
I'm looking for some suggestions to help me fix my problem.
I'm using Visual Studio 2010 SP1, C++ MFC code.
I have a program that makes hundreds of TCP/IP connections per second. The connections stay active for 1-4 seconds each and then are disconnected. On Windows Server 2003 the program can successfully handle around 300 connections/second.
I then tried to run the same program on a newer server (more CPUs, more memory, more horsepower) running Windows Server 2008. The program runs, but the main window (which displays the statistics for each connection) no longer updates. If I slow the rate down to under 50 connections/second then the display will update.
A little about the program design for the statistics display... Internally there is a std::map "qDA" that keeps track of everything going on with each connection. It is preloaded to 10,000 entries. Every second a timer hits that cycles through all 10,000 entries and counts up the statistics. It then updates screen values and finally does an UpdateData(FALSE) to show them on the main window.
I know that doesn't sound efficient, and I agree. Once I started getting display issues, I changed the design and took out the part where all 10,000 connections are cycled through and went to a PostMessage() design where only the connections that have changed state will be counted. Essentially this means that instead of 10,000 connections being cycled through each second, only 300 are (when running at 300 connections/second). Unfortunately, this didn't fix the problem.
What I'm looking for are ways that I can determine where my bottleneck is. I'm also interested in ideas on why my program runs fine on Windows Server 2003 but not on Windows Server 2008 (or Windows Server 2012, I tried that too).