Solved

CPU Usage with vb6 app

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

820 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