0
votes

I have a server with 6GB of RAM and a 6-Core CPU. Number of websites hosted by the server is about 10, but sometimes 2 of them take 100% CPU and almost entire RAM which cause the whole server to crash and I need to reset it.

I use directadmin on Centos 6. How do I limit resources each website can use, to prevent crashing the whole server?

1

2 Answers 2

1
vote

You didn't provide it, I guess you are using PHP? Please check the system logs for OOM killer to know what process ate all memory.

Run each website on separate user. Then use ulimits to limit them so thy don't use whole memory.

2
  • This wouldn't work since you can't run Apache more than once (and it uses a special user).
    – Nathan C
    Mar 28, 2014 at 12:19
  • You can run multiple apaches on one host. If php is eating the memory, then you can just run only php on separate users, having a common apache.
    – neutrinus
    Mar 28, 2014 at 13:28
0
votes

You have to check for logs,check for mysql queries taking long time to execute. Use "top" or "htop" command to check what process make cpu usage 100%.

  1. Check for how many httpd instances are running
  2. Check when these website are hitting from url,what queries are executing in bacground(most of the time culprits queries are responsible).

For ceentos use cpulimit tool.

Not the answer you're looking for? Browse other questions tagged .