Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2015 15:16:44 +0100
From:      Julien Cigar <jcigar@ulb.ac.be>
To:        Polytropon <freebsd@edvax.de>
Cc:        opendaddy@hushmail.com, freebsd-questions@freebsd.org
Subject:   Re: Limiting CPU on some processes on web server
Message-ID:  <20150311141644.GS6600@mordor.lan>
In-Reply-To: <20150311151157.5baea8b7.freebsd@edvax.de>
References:  <20150311122656.96F2020341@smtp.hushmail.com> <20150311141347.1013d42d.freebsd@edvax.de> <20150311134232.838ABC0451@smtp.hushmail.com> <20150311144958.3ef9519d.freebsd@edvax.de> <20150311140420.1646CC044F@smtp.hushmail.com> <20150311151157.5baea8b7.freebsd@edvax.de>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Wed, Mar 11, 2015 at 03:11:57PM +0100, Polytropon wrote:
> On Wed, 11 Mar 2015 14:04:19 +0000, opendaddy@hushmail.com wrote:
> > On 11. mars 2015 at 1:41 PM, "Polytropon" <freebsd@edvax.de> wrote:
> > >
> > >The main differnce in functionality is that ulimit -t defines
> > >the limit as time, whereas cpulimit defines it as percentage
> > >of CPU resources used.
> > >
> > >Another difference is that ulimit comes with FreeBSD's default
> > >scripting shell, whereas cpulimit is a Linux program that has
> > >to be compiled from source, after porting it, of course. :-)
> > >
> > 
> > Sounds really tempting especially considering those other cpulimit
> > compile errors.
> 
> If you manually add "#include <libgen.h>" to src/cpulimit.c
> and remove "#ifdef __APPLE__" ... "#endif" from tests/process_iterator_test.c
> around the "#include <libgen.h>" line, you can run "gmake"
> (in src/ and /test, or at the top level), and it will successfully
> build.

there is sysutils/cpulimit too ..

> 
> Result:
> 
> $ ./cpulimit 
> Error: You must specify a cpu limit percentage
> Usage: cpulimit [OPTIONS...] TARGET
>    OPTIONS
>       -l, --limit=N          percentage of cpu allowed from 0 to 200 (required)
>       -v, --verbose          show control statistics
>       -z, --lazy             exit if there is no target process, or if it dies
>       -i, --include-children limit also the children processes
>       -h, --help             display this help and exit
>    TARGET must be exactly one of these:
>       -p, --pid=N            pid of the process (implies -z)
>       -e, --exe=FILE         name of the executable program file or path name
>       COMMAND [ARGS]         run this command and limit it (implies -z)
> 
> You can try that "quick & dirty" modification and check if
> the cputime program _works_ for you.
> 
> 
> 
> > Is there a CPU time limit equivalent to say 20% or have I totally misunderstood?
> 
> I'd say it's hard to calculate or estimate absolute CPU time
> from relative resource consumption (load). You will probably
> have to test this with the real application you want to limit.
> 
> 
> 
> -- 
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"

-- 
Julien Cigar
Belgian Biodiversity Platform (http://www.biodiversity.be)
PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAABCgAGBQJVAE5MAAoJEAi2KiTKQR5poUMQALZx3K7tImN9Tw/IzByaB22V
+OklM+M6DrLcq8K+AdBvWfIWW+ZP+7v5mkvlZoK0WmdoU1Ahhg8KdCNSq60iCdIR
Y9uFDe1yaH8q9U/otTfsEGEwhG4pHlQWoXHyeLPvULqVBnnGl7RlH8TLscMuDZoF
zo8BDmzOERIvcHrDaZyfK4sk4MDzvbrHghvI8uoDUQQTxM4xHAfRmFXgnlPRsJ+t
BDeOpK8aSrviJj9Os9LKU1nM8z3DOSwlxBT4NX75ZsgsPZVquP1FNgEgjDOec5qY
0h8/fdap9bfMoyj+mF3jxm1E0OisNP6YmzOUR3r4eCFOufYpM3UCp40GYlFlXz2Y
82vcsaUVYKaXEglPD73wkT1BTM2IOtYIfvTR4AVGyLhjXxS7mWUiYrLIGvhbTBNK
gz1aZOaJqAeg78xUEn9QqORtgDfbSBxiycjQyvR8JZlCCoU/Cky010cJRuhQBezS
ubp7zdsIJxJdAbBAAQOIw23dWsaE3gagpil/8/dDYW6M1EfiE+HyYRhHb8j+D20z
OlgbkSW2iQXbImjSZ4oMKLtUxZ1J52a0NrUw439wBgCRcQ2jNx+DVKfJpT1Hxepw
KwmdkeH2dphLDyrFWWGECLQHpkZUyzXvdQECIxK3+NV/HP91Hph4T8CIVIvfljAz
Q65IITr1wXFxYnmK2MdU
=lwFR
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150311141644.GS6600>