?
Solved

CPU Usage with vb6 app

Posted on 2003-10-30
4
Medium Priority
?
440 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 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