Does anyone know any easy way to limit CPU usage? in Help

I want to run a big database job which needs a big SSD, so I was planning on using Vultr for this. However, the job is likely to max out all CPUs for several days, which I believe will be considered abuse of Vultr. Does anyone know if there is an easy way of limiting CPU usage in linux? I could install virtualbox and run a VM with all CPUs capped at say 50%? What do people think?

Comments

  • edited January 21
    Hello,

    Don't worry, Vultr got you covered. When you use way too much CPU Vultr automatically limits it to keep balance within other servers in same node.

    Let me quote Use Policy:

    "In the event any instance uses excessive CPU from activities such as cryptocurrency CPU mining, Vultr.com reserves the right to limit the CPU available to your instances in order to maintain a consistent level of performance on all our nodes."

    If you want to read more here is link:
    https://www.vultr.com/legal/use_policy/

    However I would strongly recommend creating a support ticket to just let them know, or they can limit your CPU usage on request.

    I hope this helps.

    Kind Regards,
    Doc

    -- I am not official Vultr Support Member, I am just community contributor --
  • edited January 25
    I did create a support ticket (before posting here), but they made it clear to me that maxing out the CPUs for an extended period would be abuse and further action may be taken if it's done repeatedly.
    Instead, I used the bare metal (taking advantage of the free credit), but the disks are a bit too small for what I need and I can't add block storage. I'll go back and ask again, and see what they say about limiting the CPU on my request.
  • @motninja
    Have you thought about writing a little program that suspends your job for (say) 10 seconds every minute?
  • A quick google shows "cputool" may be what you want. It does indeed work by temporarily suspending processes:

    https://gitlab.devlabs.linuxassist.net/cputool/cputool
  • Also I think there is a thing called CPULIMIT I dont know if it is still latest, but you can try

    apt-get install cpulimit

    cpulimit -p XXXX -l YY

    XXX = Process ID
    YY = % cpu

    Example:

    cpulimit -p 4875 -l 30

    Ths will limit process id 4875 to use only 30% of cpu
  • I second the suggestion for using CPUlimit. It does exactly what you are looking for, you can set your database process to use a max amount of CPU %.

    On the more recent versions you can even launch new processes using cpulimit like this: "cpulimit -l 25 my-database-program"
Sign In or Register to comment.

Registration Required

A VULTR.com account is required to use the forum. Click here to sign in.

Quick Links