Page 4 of 13 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 122

Thread: HOWTO: Set maximum CPU consumption in percentage by any process

  1. #31
    Join Date
    Aug 2008
    Beans
    3

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Is there any way to run the daemon without reboot ?
    Regards krisik28

  2. #32
    Join Date
    Mar 2007
    Beans
    627

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Hi,
    have you read my first post, there is chapter "4. MANUALLY CHECK, STOP, START AND RESTART DAEMON".
    Regards

  3. #33
    Join Date
    Sep 2009
    Beans
    3

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    *bump*

    hi mate.
    first of all, thanks for sharing this script, really handy!
    but can you explain a bit more about the blacklist function?
    i couldn't get it working

    my intention is to limit a certain php script process, i'm running kloxo as the control panel
    so my command goes like this:
    Code:
    lxsuexec /path/to/script.php
    it doesn't work with blacklist function, cpulimit just wont run.
    but if i let the daemon limit all process, it works fine.
    it just didn't work with blacklist function. i put something like this on the script:
    Code:
    CPU_LIMIT=10           # Maximum percentage CPU consumption by each PID
    DAEMON_INTERVAL=3      # Daemon check interval in seconds
    BLACK_PROCESSES_LIST= "lxsuexec /path/to/script.php"  # Limit only processes defined in this variable. If variable is empty (default) all violating processes are limited.
    WHITE_PROCESSES_LIST=   # Limit all processes except processes defined in this variable. If variable is empty (default) all violating processes are 
    limited.
    thanks in advance for any replies

  4. #34
    Join Date
    Mar 2007
    Beans
    627

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Hi,
    I assume your exact command is not displayed by top command or is displayed something else. Try the following.
    Run you command from terminal:
    Code:
    lxsuexec /path/to/script.php
    and then run following command in another terminal:
    Code:
    top -b -n1 -c
    and search for your command in the Command column. Do you see "lxsuexec /path/to/script.php" string in Command column? If no, then you have to find a command in Command column that matches your command.

    Then write output (or part of output) of your command from Command column in BLACK_PROCESS_LIST variable.

    Hope this helps,
    Abcuser
    Last edited by abcuser; September 15th, 2009 at 08:21 PM.

  5. #35
    Join Date
    Sep 2009
    Beans
    3

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    hi thanks for replying
    i ran
    Code:
    top -b -n1 -c
    and it was displayed exactly as
    Code:
    lxsuexec /path/to/script.php
    i tried to run cpulimit command directly without script, it's working fine the limit applied
    Code:
    cpulimit -p $( ps -eo pid,args | grep "lxsuexec /path/to/script.php" | grep -v grep | gawk '{print $1}' ) -l 5 -z &




    Quote Originally Posted by abcuser View Post
    Hi,
    I assume your exact command is not displayed by top command or is displayed something else. Try the following.
    Run you command from terminal:
    Code:
    lxsuexec /path/to/script.php
    and then run following command in another terminal:
    Code:
    top -b -n1 -c
    and search for your command in the Command column. Do you see "lxsuexec /path/to/script.php" string in Command column? If no, then you have to find a command in Command column that matches your command.

    Then write output (or part of output) of your command from Command column in BLACK_PROCESS_LIST variable.

    Hope this helps,
    Abcuser

  6. #36
    Join Date
    Mar 2007
    Beans
    627

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Hi,
    daemon is written for the processes that you don't know when they start-up. If you know when the process starts up, you can manually execute cpulimit command, so no need for daemon.
    Regards

  7. #37
    Join Date
    Sep 2009
    Beans
    3

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    actually i don't know when the command will be executed mate, i got some clients who will run this script on my server whenever they'd like to and each client has their own directory with a copy of this script. the script itself is a client-side script to transfer file remotely, so whenever the transfer is done the script then will terminate itself.

    the thing is i have some clients who tend to run this script much and it uses huge CPU resource.
    so what i'd like to do basically is to put some of these clients on a blacklist for cpulimit.

  8. #38
    Join Date
    Mar 2009
    Beans
    58

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    when I try to set WHITE_PROCESSES_LIST it does not work. I try to set it so that it does not limit npviewer.bin (flash). I want to do this because when you limit cpu of flash the videos don't play smoothly. Can you please help me?


    thanks
    Last edited by kut77less; October 18th, 2009 at 11:01 PM.

  9. #39
    Join Date
    Mar 2007
    Beans
    627

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    kut77less, when you run your flash program, try to execute command:
    Code:
    top -b -n1 -c
    Do you see this program in this list of processes? Try to write exactly what you get from top command.

  10. #40
    Join Date
    Mar 2009
    Beans
    58

    Re: HOWTO: Set maximum CPU consumption in percentage by any process

    Quote Originally Posted by abcuser View Post
    kut77less, when you run your flash program, try to execute command:
    Code:
    top -b -n1 -c
    Do you see this program in this list of processes? Try to write exactly what you get from top command.

    When I use that command I can see that it is this command



    /usr/lib/nspluginwrapper/i386/linux/npviewer.bin --plugin /usr/lib/flashplugin-installer/libflashplayer.so --connection /org/wrapper/NSPlugins/libflashplayer.so/5193-2
    But When I put the in the white list it still limits the CPU


    Any suggestions?

    Thanks for all your help by the way.

Page 4 of 13 FirstFirst ... 23456 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •