Solved

CPU Usage with vb6 app

Posted on 2003-10-30
4
433 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 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

18 Experts available now in Live!

Get 1:1 Help Now