Page 10 of 13 FirstFirst ... 89101112 ... LastLast
Results 91 to 100 of 122

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

  1. #91
    Join Date
    Oct 2012
    Beans
    4

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

    @abcuser,

    Thank you for looking into this a little further. I'm can't wait to get this working!

    I have tried the following combinations:

    1:
    Code:
    BLACK_PROCESSES_LIST='Plex[[:blank:]]Transcoder'
    2:
    Code:
    BLACK_PROCESSES_LIST="Plex[[:blank:]]Transcoder"
    3:
    Code:
    BLACK_PROCESSES_LIST='/usr/lib/plexmediaserver/Resources/Plex[[:blank:]]Transcoder'
    4:
    Code:
    BLACK_PROCESSES_LIST="/usr/lib/plexmediaserver/Resources/Plex[[:blank:]]Transcoder"
    5:
    Code:
    BLACK_PROCESSES_LIST="`/usr/lib/plexmediaserver/Resources/Plex[[:blank:]]Transcoder`"
    I know you said last night that your script is not designed to accept direct paths, #3, 4, and 5, and while #3 and #4 do not work, #5 does work. The only thing is that it still kicks out the libass.so.4 error. I posted a question in the Plex forums about this file, but haven't had a response, yet.

    ==============


    While writing this, I just tried this on a whim:

    Code:
    BLACK_PROCESSES_LIST="`Plex\ Transcoder`"
    When manually starting the daemon, it immediately outputs:

    Code:
    /usr/bin/cpulimit_daemon.sh: line 9: Plex Transcoder: command not found
    I thought this was a sign of it not working. It turns out, it seems, that it may simply be a notification that the process command name is not found in the currently running processes. As soon as I start and/or stop a video, as expected, the output reads
    Code:
    Process XXXX detected
    Process XXXX dead!
    If the "command not found" is an acceptable output from your script, this may work just fine for me. I'm going to test it out with multiple streams in a little bit. I have a meeting to go to right now.


    Thank you for your time!

  2. #92
    Join Date
    Mar 2007
    Beans
    630

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

    Quote Originally Posted by brettgavin View Post
    5:
    Code:
    BLACK_PROCESSES_LIST="`/usr/lib/plexmediaserver/Resources/Plex[[:blank:]]Transcoder`"
    I know you said last night that your script is not designed to accept direct paths, #3, 4, and 5, and while #3 and #4 do not work, #5 does work. The only thing is that it still kicks out the libass.so.4 error.
    Using above command with "`" character it means EXECUTE program in quotes and set output to variable BLACK_PROCESS_LIST. I don't think this is going to be working correctly, because executing a program in my humble opinion will not output a program name. I would be really surprised if this works out.

  3. #93
    Join Date
    Oct 2012
    Beans
    4

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

    Please forgive my limited understanding of scripting. I took some classes many years ago, but I dont remember a ton of it.

    I understand what you're saying about the backticks actually executing a program. Do you think it works because the program name and the command name appear to be identical?


    ----

    Using this:

    Code:
    BLACK_PROCESSES_LIST="`Plex\ Transcoder`"
    I set the daemon interval to 60 to give the transcoder a chance to process enough video at the beginning to avoid unnecessary buffering.

    It seems to work fine, even with that simple output message about the command not being found (this only appears when running the script manually; does not appear on boot).

    Here are a couple screenshots:

    before 60s check


    after 60s check


    ----

    If this does continue to work well, I have one more idea that I could use your help with.

    I would like to be able to set the daemon to check every x seconds (like you have it setup) but upon finding the blacklisted command, wait one additional interval cycle before enacting the cpulimit function. Do you have an idea of how to go about this?
    Last edited by brettgavin; October 5th, 2012 at 07:33 PM.

  4. #94
    Join Date
    Oct 2012
    Beans
    4

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

    @abcuser Here is a link to my post and setup instructions that you helped me get working:

    http://brettgavin.wordpress.com/

    Here is the Plex forum post about it as well:

    http://forums.plexapp.com/index.php/...neous-streams/

  5. #95
    Join Date
    Oct 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

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

    I have set up the version of this script from Sept 2010 as found here. While it seems to work fine in general, I have an issue that I don't see mentioned anywhere in this thread.

    I placed "mysqldump" in the blacklist, as we run a backup script which uses this as part of the archiving. Mysqldump is limited, but all the instances of mysql are as well. I tried adding the -w option to grep in cpulimit_daemon.sh (matches exact word only) with no change.

    I'm a little fuzzy with regex and I'm not sure exactly what's going on in the script so I'm stuck. Apparently it matches anything, in whole or in part, to the strings delimited in the blacklist. Can anyone verify and/or offer a solution to make it work only on mysqldump and not mysql as well?

    Thanks.
    David

  6. #96
    Join Date
    Mar 2007
    Beans
    630

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

    @David,
    1. What is the output of command:
    top -b -n1 -c

    2. What is the output of command:
    top -b -n1 -c | grep -E 'mysqldump'

    Does this command also list the mysql process?

    3. What is exact BLACKLIST variable?
    4. What is your CPU_LIMIT variable?

  7. #97
    Join Date
    Oct 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

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

    Answer to #1 is attached file.

    Answer to #2 is:
    Code:
    root@localhost:~# top -b -n1 -c | grep -E 'mysqldump'
    30159 root      20   0 11684  912  784 S    0  0.0   0:00.00 grep --color=auto -E mysqldump
    Answer to #3 is:
    Code:
    BLACK_PROCESSES_LIST= "rdiff-backup|mysqldump"
    Answer to #4 is:
    Code:
    CPU_LIMIT=20
    Strangely enough, I removed the "mysqldump" portion of the blacklist and restarted and it still cut off at 20%. Is it possible this is acting like everything is subject to limiting? Is my blacklist variable format correct?

    I should mention that these results are with the cpulimit stopped as the server quickly fails (due to mysql cutting off in so many threads) when it is on.

    Thanks for your help.
    Attached Files Attached Files
    David

  8. #98
    Join Date
    Mar 2007
    Beans
    630

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

    Quote Originally Posted by david.rahrer View Post
    Answer to #2 is:
    Code:
    root@localhost:~# top -b -n1 -c | grep -E 'mysqldump'
    30159 root      20   0 11684  912  784 S    0  0.0   0:00.00 grep --color=auto -E mysqldump
    from #2 I see there is no "mysqldump" program running and so it can't be cpu-limited if it does not exists. Was program mysqldump really running when you executed the #2 command?

    Quote Originally Posted by david.rahrer View Post
    Strangely enough, I removed the "mysqldump" portion of the blacklist and restarted and it still cut off at 20%. Is it possible this is acting like everything is subject to limiting? Is my blacklist variable format correct?
    BLACKLIST only limits processes listed except if this variable is empty then it limits all of the processes (as described in first post of this thread).

    Stop or restart also kills all of the cpulimit processes so everything that was limited is getting full CPU access again.

  9. #99
    Join Date
    Oct 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

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

    The following is the response from #2 when the mysqldump script is running.

    Code:
    root@WSN005:~# top -b -n1 -c | grep -E 'mysqldump'
    19923 root      20   0 99012 3092 1312 S    4  0.1   0:03.16 /usr/bin/mysqldump -Q --single
    19930 root      20   0  9384  880  760 S    0  0.0   0:00.00 grep --color=auto -E mysqldump
    David

  10. #100
    Join Date
    Mar 2007
    Beans
    630

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

    @david.rahrer, this looks good to me. Don't know what the problem is. I don't use mysql, so maybe there is something else that is wrong...

Page 10 of 13 FirstFirst ... 89101112 ... 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
  •