Page 1 of 2

How to set CPU limit on websites

Posted: Sun Dec 31, 2017 8:43 am
by vikhyat
I have like 50 websites on my server and 3 client use insane amount of CPU. The server specs are high (24GB RAM and 8 CORES) Processor. If I put limitations on the CPU usage of these 3 clients then I can put a lot more clients as well as control the server load. Can anyone tell how I can put limitations on this user?

Re: How to set CPU limit on websites

Posted: Sun Dec 31, 2017 9:49 am
by ScIT
resource limitation is, as far as i know, not possible yet. maybe you can speak with this 3 customers, based on their resources a dedicated server or vps would be better.

Re: How to set CPU limit on websites

Posted: Sun Dec 31, 2017 9:52 am
by vikhyat
ScIT wrote:resource limitation is, as far as i know, not possible yet. maybe you can speak with this 3 customers, based on their resources a dedicated server or vps would be better.
What about I set limits using cgroups?

Re: How to set CPU limit on websites

Posted: Sun Dec 31, 2017 10:26 am
by ScIT
I'm sure that will work, until know their is no integrated way in vesta. but of course you can set direct limitations inside of your system.

Re: How to set CPU limit on websites

Posted: Sun Dec 31, 2017 5:22 pm
by vikhyat
I wasn't asking for integrated method. external methods will work too. just wanted to know what external method will be the best. I should go with cgroups only or there is any much better method?

Re: How to set CPU limit on websites

Posted: Mon Jan 01, 2018 10:04 am
by mehargags
Please post your observations and solutions if you are able to setup such limits, it will be an interesting solution.

Re: How to set CPU limit on websites

Posted: Mon Jan 01, 2018 12:26 pm
by vikhyat
mehargags wrote:Please post your observations and solutions if you are able to setup such limits, it will be an interesting solution.
Hi
I have done a setup though a bit of problems are still there. I will update you after the setup is properly done. It's a bit difficult to do it properly.

Update: How to set CPU limit on websites

Posted: Tue Jan 02, 2018 8:38 pm
by vikhyat
Update:
We did it with ulimits instead of cgroups.
We were able to successfully limit the CPU cores of the user to just a single core. Now we are working on limiting it to 50% of that 1 core as even that 1 core is a lot. The person who made this possible will also be writing a free tutorial on our blog on how he did it.

Update: It's done

Posted: Tue Jan 02, 2018 9:49 pm
by vikhyat
The things have been done. We will be posting the tutorial soon to limit the resources of every user on our blog today https://blog.flaunt7.com. We will also work on creating a GUI version of it so that it can be done directly from the control panel itself. It will be on our git repository so anyone can contribute on this. Let me know if you are interested on making the GUI version together.

Re: How to set CPU limit on websites

Posted: Thu Jan 04, 2018 10:16 pm
by vikhyat
Forgot to tell that the tutorial is already up and it was made with keeping VestaCP in mind so it should be easier to achieve the task with this tutorial. This limit has helped us a lot in managing huge server load without suspending user. https://blog.flaunt7.com/managing-resources-cgroups/