Solved

My Program Performance

Posted on 2014-02-17
2
284 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 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