How to Limit 10% Cpus for LiteSpeed PHP ?

Discussion in 'General' started by dk.mmmm, May 31, 2010.

  1. dk.mmmm

    dk.mmmm Member

    I want to Limit 10% Cpus for lsphp5 , how to ?
  2. NiteWave

    NiteWave Administrator

    "cpulimit is a simple program that attempts to limit the cpu usage of a process (expressed in percentage, not in cpu time). This is useful to control batch jobs, when you don't want them to eat too much cpu. It does not act on the nice value or other scheduling priority stuff, but on the real cpu usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly"

    Please try yourself if it works for lsphp5.
  3. dk.mmmm

    dk.mmmm Member

    I have tried it.

    When I try: cpulimit -e lsphp5 -l 10

    It show waiting proccess running. While my website have a lot visitor.

    Because lsphp5 is running under nobody group.
  4. NiteWave

    NiteWave Administrator

    did it limit lsphp5 10% cpu successfully?

    how many cpu cores on your server?

    usually how many lsphp5 processes are running?
  5. dk.mmmm

    dk.mmmm Member

    My Cpus is 4 cores.

    After I use:
    cpulimit -e lsphp5 -l 10

    It show "Warning: no target process found. Waiting for it..."

    I think it because I use ROOT, and LiteSpeed is nobody.

    However, when I use ps -e , it show a lot lsphp5 are running.
  6. dk.mmmm

    dk.mmmm Member

    Can you tell me

    Application name of LiteSpeed is :

    ls or lsphp5 or something ?
  7. NiteWave

    NiteWave Administrator

    if you have 4 cores, at least limit to 4 X 10%=40%. since full CPU usage is 400%, not 100%

    using top instead of ps can see which processes use CPU most

    from the message "Warning: no target process found. Waiting for it...", it looks like cpulimit not working as expected.
  8. dk.mmmm

    dk.mmmm Member

    thanks your help.

    I found out, cpulimit only limit process run by SSH. Can't limit Web Process :D


Share This Page