RE: Setting 'nice' level for specific binary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
> bounces@xxxxxxxxxx] On Behalf Of Chris
> Sent: Wednesday, August 24, 2005 10:05 AM
> To: General Red Hat Linux discussion list
> Subject: Re: Setting 'nice' level for specific binary
> 
> ----- Original Message -----
> From: "Karl Latiss" <karl.latiss@xxxxxxxxxxxxx>
> 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
> 

When you want to change the priority of a process which is being
executed you should use the 'renice' command. Usually the process to
renice is specified by its PID gives in the command options.

If you need to do this without need to look to process list and issue
'renice' yourself when needed, you can use the automatic tool like 'and'
(auto nice daemon, http://and.sourceforge.net/) which could be
configured to search for processes according to criteria given in its
config file and renice the processes.

Alexey Fadyushin.
Brainbench MVP for Linux.
http://www.brainbench.com

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux