Solved

My Program Performance

Posted on 2014-02-17
2
280 Views
Last Modified: 2014-02-20
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).
0
Comment
Question by:goondoo27
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 39865308
>>What I'm looking for are ways that I can determine where my bottleneck is.

First of all: Have you tried running your code under the VS Profiler? This will usually give you a good indication where to look first.
0
 

Author Closing Comment

by:goondoo27
ID: 39873668
I had to upgrade to Visual Studio 2010 Premium and SP1. That was much more painful than it should have been. But it's now upgraded and I've run the VS Profiler. It pointed to a section of code that wasn't actually the problem. In the meantime, I did some theorizing and realized that I was doing a PostMessage() to the display thread when I didn't have to. It was happening two times the rate that I was running the program at. I changed the design and now it's working much much better.

Thank you for replying to me. Though the VS Profiler didn't fix my issue this time, I now have another tool to help me through these types of problems.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now