public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Relative CPU time limit
@ 2001-01-17 18:33 Xuan Baldauf
  2001-01-17 19:09 ` Padraig Brady
  2001-01-18  1:29 ` Rik van Riel
  0 siblings, 2 replies; 4+ messages in thread
From: Xuan Baldauf @ 2001-01-17 18:33 UTC (permalink / raw)
  To: linux-kernel

Hello, (maybe a FAQ, but could not find this question)

is it possible with linux2.4 to limit the relative CPU time
per process or per UID? I saw something like this about 5
years ago on solaris machines, but I have not access to
solaris machines anymore. I do not mean limiting the
absolute CPU time (e.g. "the process should run 20minutes at
maximum and shall be killed after that time), but the
relative CPU time (e.g. "apache should consume at most 80%
of my servers CPU time and shall be throttled if it was to
consume more").

Thanx,
Xuân. :-)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Relative CPU time limit
  2001-01-17 18:33 Relative CPU time limit Xuan Baldauf
@ 2001-01-17 19:09 ` Padraig Brady
  2001-01-17 20:39   ` Xuan Baldauf
  2001-01-18  1:29 ` Rik van Riel
  1 sibling, 1 reply; 4+ messages in thread
From: Padraig Brady @ 2001-01-17 19:09 UTC (permalink / raw)
  To: Xuan Baldauf, linux-kernel

man setrlimit (or ulimit)
This is per user though, and only related
to user accounting really as you can only
set a limit on the number of CPU seconds
used.

I would also really like the ability
to throttle any processes back to a certain
% of CPU, and extending this to throttling
users to certain CPU limits which would be
useful also.

Obviously you would set it up so that all
available CPU is used, for e.g. if you
had 2 CPU bound processes running and you
allocated 1 to 40% and the other 60%, when
either terminates the other should increase
to the available CPU (I can't see any reason
why you would forceably limit a process' CPU
usage if there was free CPU).

Could the current scheduling logic that uses
the nice value of a process, do this, and all
I would have to do is have a % specifying wrapper
around this?

Any other ideas or will I get hacking..

Padraig.

Xuan Baldauf wrote:

> Hello, (maybe a FAQ, but could not find this question)
> 
> is it possible with linux2.4 to limit the relative CPU time
> per process or per UID? I saw something like this about 5
> years ago on solaris machines, but I have not access to
> solaris machines anymore. I do not mean limiting the
> absolute CPU time (e.g. "the process should run 20minutes at
> maximum and shall be killed after that time), but the
> relative CPU time (e.g. "apache should consume at most 80%
> of my servers CPU time and shall be throttled if it was to
> consume more").
> 
> Thanx,
> Xuân. :-)
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Relative CPU time limit
  2001-01-17 19:09 ` Padraig Brady
@ 2001-01-17 20:39   ` Xuan Baldauf
  0 siblings, 0 replies; 4+ messages in thread
From: Xuan Baldauf @ 2001-01-17 20:39 UTC (permalink / raw)
  To: Padraig Brady; +Cc: linux-kernel



Padraig Brady wrote:

> man setrlimit (or ulimit)
> This is per user though, and only related
> to user accounting really as you can only
> set a limit on the number of CPU seconds
> used.

Yet this is _not_ what I want, especially not for server processes. :-)

>
>
> I would also really like the ability
> to throttle any processes back to a certain
> % of CPU, and extending this to throttling
> users to certain CPU limits which would be
> useful also.
>
> Obviously you would set it up so that all
> available CPU is used, for e.g. if you
> had 2 CPU bound processes running and you
> allocated 1 to 40% and the other 60%, when
> either terminates the other should increase
> to the available CPU (I can't see any reason
> why you would forceably limit a process' CPU
> usage if there was free CPU).
>
> Could the current scheduling logic that uses
> the nice value of a process, do this, and all
> I would have to do is have a % specifying wrapper
> around this?

The nice values have to be dynamic. I seem to happen to see the behaviour that
regardless of which nice value I assign to httpd, great user load kann make the
whole machine slow down to load ~200. (A horribly slow php script *sigh*) I want
to limit the sum of all apache processes (which happen to run with the same UID)
to eat no more than 80% of the available CPU time, at least if there are any
other processes requesting the CPU. The background is that I'm unable to log in
to the server when the load is at 200. Apache is already at nice 5 while sshd is
at nice 0.

Xuân.

>
>
> Any other ideas or will I get hacking..
>
> Padraig.
>
> Xuan Baldauf wrote:
>
> > Hello, (maybe a FAQ, but could not find this question)
> >
> > is it possible with linux2.4 to limit the relative CPU time
> > per process or per UID? I saw something like this about 5
> > years ago on solaris machines, but I have not access to
> > solaris machines anymore. I do not mean limiting the
> > absolute CPU time (e.g. "the process should run 20minutes at
> > maximum and shall be killed after that time), but the
> > relative CPU time (e.g. "apache should consume at most 80%
> > of my servers CPU time and shall be throttled if it was to
> > consume more").
> >
> > Thanx,
> > Xuân. :-)
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Relative CPU time limit
  2001-01-17 18:33 Relative CPU time limit Xuan Baldauf
  2001-01-17 19:09 ` Padraig Brady
@ 2001-01-18  1:29 ` Rik van Riel
  1 sibling, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2001-01-18  1:29 UTC (permalink / raw)
  To: Xuan Baldauf; +Cc: linux-kernel

On Wed, 17 Jan 2001, Xuan Baldauf wrote:

> is it possible with linux2.4 to limit the relative CPU time
> per process or per UID?

The (more complex) userbeans patches are IMHO something that
should wait for 2.5, but I will be "porting" my fair share
scheduler to 2.4 RSN.

The fair share scheduler I created some time ago doesn't have
a lot of configurability, isn't always fair to within the last
few percent and doesn't do some other funky things.

Instead, it changes the current Linux scheduler the minimum amount
possible and makes sure nobody can completely hog the CPU.

A version against 2.3.99 and 2.2.x is available from my home page:
	http://www.surriel.com/patches/

cheers,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-01-18  1:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-17 18:33 Relative CPU time limit Xuan Baldauf
2001-01-17 19:09 ` Padraig Brady
2001-01-17 20:39   ` Xuan Baldauf
2001-01-18  1:29 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox