Solved

CPU Usage with vb6 app

Posted on 2003-10-30
4
435 Views
Last Modified: 2012-06-21
I have a vb6 app which processes xml files.  The basic functionality is:

it loads an xml file into a DOMDocument, moves through the nodes and inserts certain bits of data into a database, when it has finished it closes the DOM down.

It is a client server application with a form and a dll which contains the main functionality.

The actual functionality works fine.

----------------------------------------

But When i run this on my local machine and i check the task manager i see that when it is running the CPU usage is at 100%.  

The problem is: the dll component is going to be deployed on a server machine (which runs lots of other applications).  Now i am worried that the CPU usage will be 100% on the server when the app is running which will cause problems.

My question is:
-Why does the application use 100% of CPU,
-Is it likely to do the same on a powerful server machine
-Is it possible to design applications which dont go and grab all of the CPU power - but limit themselves to a portion of it.  - Or will the server machine manage this anyway?

thanks very much









0
Comment
Question by:MrKevorkian
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Clothahump
ID: 9650893
Sprinkle DoEvents statements throughout your application.  This will ensure that the app doesn't hog the CPU.
0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 9656342
Clothahump

Would doevents be suitable for code executing on a server which does not have any Mouse or Keyboard events.  As i understood it the DoEvents statement flushes the Windows Message Que, releasing any delayed mouse or keyboard events.  

The events on the server will not be keyboard or mouse events - but they are more likely to be SQL server events from our SQL server DB that is also housed on this server?

any ideas?

thanks
0
 
LVL 4

Accepted Solution

by:
Clothahump earned 200 total points
ID: 9657780
DoEvents will allow any event to be processed.  It's not limited just to Mouse/Keyboard.  Quoting from the Help on DoEvents:

DoEvents passes control to the operating system. Control is returned after the operating system has finished processing the events in its queue and all keys in the SendKeys queue have been sent.

A word of caution - you said that this is your SQL server machine.  I would not run applications on the SQL server.  Let the machine be dedicated to SQL server and nothing else.  Otherwise, you're going to have poor response from SQL.   I learned that the hard way.  Suggestion - set up another machine as an application server and run your app(s) on that.  You'll get much, much better response.
0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 9657971
sorry i didnt fully understand doevents.

thats very interesting about the SQL Server warning.  I think i may have change my plan.

thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

13 Experts available now in Live!

Get 1:1 Help Now