[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

My Program Performance

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
goondoo27
Asked:
goondoo27
1 Solution
 
jkrCommented:
>>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
 
goondoo27Author Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now