TEST GTmetrix performance Cyril Levert .info

Cyril Levert, my blog

Personnal Blog en mode développeur :)

Mars 05 2011

CPULimit, limiter les ressources CPU utilisées par un processus sous Debian

Par Cyril Administration Linux

Tags Tags cpulimit htop linux debian surveillance processus linux console analyse linux ressources linux

Voici un outil bien sympathique, simple d'utilisation qui peut rendre bien des services : cpulimit 

Dans bien des situations, il peut être intéressant de limiter l'usage du ou des processeur(s) de sa machine, pour ce faire nous allons utiliser ici un limiteur maléable permettant par exemple de limiter un processus par son nom ou par son PID

Tout d'abord installons cpulimit
 

Cyril: /home/nunux/
aptitude install cpulimit


Voyons ensuite comment limiter un processus ...

Supposons limiter le service proftpd par exemple à 20% d'utilisation CPU ( valable pour un processeur ou un coeur ) 

 
Cyril: /home/nunux/
cpulimit -e proftpd -l 20


Plus long mais tout autant jouable
 
Cyril: /home/nunux/
cpulimit --exe proftpd --limit 20


Il est aussi possible de limiter un processus par son PID, dans ce cas il suffira de localiser le PID avec un simple HTOP au préalable puis
 
Cyril: /home/nunux/
cpulimit -p Numéro-du-PID -l 20


Plus long mais tout autant jouable
 
Cyril: /home/nunux/
cpulimit --pid Numéro du PID --limit 20



 Ah dernier détail et pas des moindres, cplumit restera en premier plan dans votre console, pour s'en sortir saisissez la combinaison de touches CTRL+C !


Voici un petit man de cpulimit pour mémoire :)

 
Cyril: /home/nunux/
CPULIMIT(1) User commands CPULIMIT(1)

NAME
cpulimit -- limits the CPU usage of a process

SYNOPSIS
cpulimit TARGET [OPTIONS...]

DESCRIPTION
TARGET must be exactly one of these:

-p, --pid=N
pid of the process

-e, --exe=FILE
name of the executable program file

-P, --path=PATH
absolute path name of the executable program file

OPTIONS

-l, --limit=N
percentage of CPU allowed from 0 to 100 (mandatory)

-v, --verbose
show control statistics

-z, --lazy
exit if there is no suitable target process, or if it dies

-h, --help
display this help and exit

EXAMPLES
Assuming you have started âfoo --barâ and you find out with top(1) or ps(1) that this process uses all your CPU time you can
either

# cpulimit -e foo -l 50
limits the CPU usage of the process by acting on the executable program file (note: the argument "--bar" is omitted)

# cpulimit -p 1234 -l 50
limits the CPU usage of the process by acting on its PID, as shown by ps(1)

# cpulimit -P /usr/bin/foo -l 50
same as -e but uses the absolute path name

AUTHOR
This manpage was written for the Debian project by gregor herrmann but may be used by others.

cpulimit November 2006 CPULIMIT(1)





Partager ou s'abonner

  • Google
  • Yahoo
  • Netvibes
  • Wikio
  • Facebook
  • Diggit
  • Technorati
  • Delicious
  • Viadeo
  • Yoolink
  • Live
  • Myspace
  • Twitter
  • Scoopeo
  • Blogmarks

Commentaires

Aucun commentaire
Sommet de page

Ajouter un commentaire

Code de sécurité  _CODE_ACCESSIBILITE
 

Calendrier

» Février 2012

lun mar mer jeu ven sam dim
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29        

Archives



 Top NoCache Copyrights PHP Minimus CMS