From: Ben Johnson Date: 2006-07-16T06:25:35+09:00 Subject: Re: Displaying the load the server is under? --Apple-Mail-3-745345361 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed The sad thing is that I can't really say what my program is for, because it is confidential. On the other hand, the reason I want to do this is because I have a background process running that handles the core work of the program. What this background process does is create threads that contain while loops that could run forever depending on the parameters. What I want to make sure they don't do is create too many threads in this process that they are exceeding what the CPU can handle, because if this happens the programs performance will suffer and performance is the backbone of this software. Also if it gets to that point I'd like to inform them that their hardware is constraining the performance of the program. I wish there was a way to tell them "This program is not optimal because the hardware is constraining the performance of this application." Is there any possible way to do this? Running the "top" command tells me all kinds of information about the computer, could something similar to this be used in a ruby application? Thank You, Ben Johnson E: bjohnson@contuitive.com On Jul 15, 2006, at 3:41 PM, Jeremy Tregunna wrote: > > On 15-Jul-06, at 4:31 PM, Ben Johnson wrote: > >> On my program I want to display the load the server is currently >> under. The application I'm writing can get pretty intense and it >> based on a number of factors. I want the user to be able to tell >> when they are using the program beyond the server's limits. Is >> this possible? Maybe show the percent of the CPU being used, how >> much ram is being used, etc. > > Not really... If you limit CPU usage to a certain percentage, > percentage of CPU usage isn't going to be helpful. If you don't, > other factors could (and will) almost always taint that result. The > same caveat applies to testing memory usage. > > Also, the load displayed by the unix 'w' program (uptime is usually > a hard link to this) will display differently based on different > factors on different unix operating systems. FreeBSD for example > uses the total number of waiting processes to gauge system load, > which may not be the most accurate. Calculating load is a difficult > beast. If perhaps you could tell us what exactly your program does, > we may be able to offer you better solutions. > >> Ben Johnson > > -- > Jeremy Tregunna > jtregunna@blurgle.ca > > > "One serious obstacle to the adoption of good programming languages > is the notion that everything has to be sacrificed for speed. In > computer languages as in life, speed kills." -- Mike Vanier > > --Apple-Mail-3-745345361--