Setting 'nice' level for specific binary

Chris redhat-list at dotcomdesigners.com
Wed Aug 24 06:05:11 UTC 2005


----- Original Message ----- 
From: "Karl Latiss" <karl.latiss at atvert.com.au>
Sent: Tuesday, August 23, 2005 9:24 PM
Subject: Re: Setting 'nice' level for specific binary


> On Tue, 2005-08-23 at 19:58 -0700, Chris wrote:
>> Is there a way to globally force a lower priority ('nice' level) on a
>> specific binary executable, that technically can be called from any 
>> cgi-bin
>> directory on a single server, where each copy is owned by a different
>> hosting user?  The filename is unique so we can assume any requests to 
>> this
>> same filename are for the same binary file.  I'd like to experiment with
>> re-nicing a particular hosted application that at times creates such
>> incredibly high CPU loads that everything else stops responding (httpd,
>> sshd, etc) and you can't even log on to kill these processes.  This
>> typically requires a hard reboot to get things working again.  Because of
>> that I implemented scripts that monitor server load and when things get
>> hairy (server loads exceeding 100+) they stop certain services to give 
>> this
>> particular app a chance to exit gracefully, which works for the most 
>> part.
>> But it can still take 60-120+ seconds at this type of loads to do 
>> anything.
>> Would be nice to run this particular app, many copies of it that is, at
>> lower nice level so we can at least SSH to the server when the load gets
>> this high.  I'd rather have my scripts send me an SMS message when things
>> get hairy but be able to log on via SSH and at least manually control 
>> this
>> app at that point, rather than mucking with other services to free up
>> resources.
>
> How about renaming the binary to something else and putting in place a
> wrapper script calling nice and the re-named binary?
>
> This way it always runs at some nice value.

That's one way to do it, I suppose (haven't tried!), but what I'm looking 
more for is to define this globally.  This is for a web hosting environment 
where multiple sites could be running this application on the same server - 
all from their own cgi-bin directories.  Instead of setting this up 
individually for every site, I was hoping for a way for the system to 
globally detect that if application/binary XYZ is executed, from any of the 
sites' own cgi-bin directories, to re-nice the instance of that binary on 
the fly.

In other words - if binary XYZ is in memory/being executed, no matter where 
it was launched from (ie: no manually created wrappers), re-nice the app.

Possible?  Doable?  How?

Chris





More information about the redhat-list mailing list