?
Solved

CPU Usage with vb6 app

Posted on 2003-10-30
4
Medium Priority
?
442 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 800 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

839 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