I have some domains on a VPS server. Typical account memory usage for all domains runs at 50% of available, but I have a problem. One domain is causing me trouble because intermittently traffic will spike on that domain, causing so many requests within 1 min that I exceed my memory allocation for my entire VPS package. Apache is then killed but the virtualization software and Apache must then be restarted. A sample snippet from tops right before the sever went down would like like this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27816 coldclim 18 0 39524 26m 5880 R 3.7 5.1 0:00.77 php
27710 coldclim 18 0 34876 21m 5592 R 2.3 4.2 0:00.40 php
27850 coldclim 18 0 29444 15m 5432 R 1.1 3.1 0:00.25 php
27860 coldclim 17 0 32412 18m 5516 R 1.1 3.7 0:00.33 php
27858 coldclim 18 0 35136 21m 5592 R 0.8 4.2 0:00.42 php
27987 coldclim 17 0 21028 5556 3232 R 0.8 1.1 0:00.03 php
27856 coldclim 18 0 32420 18m 5516 R 0.6 3.7 0:00.34 php
27947 coldclim 16 0 25804 12m 5432 R 0.6 2.4 0:00.13 php
27958 coldclim 16 0 25544 12m 5432 R 0.6 2.4 0:00.12 php
27960 coldclim 16 0 24104 10m 5376 R 0.6 2.1 0:00.10 php
27962 coldclim 18 0 27884 14m 5432 R 0.6 2.8 0:00.19 php
27854 coldclim 18 0 34880 21m 5592 R 0.3 4.1 0:00.40 php
27830 coldclim 18 0 36176 22m 5732 R 0.0 4.4 0:00.50 php
27831 coldclim 18 0 32932 19m 5528 R 0.0 3.8 0:00.35 php
27851 coldclim 18 0 32412 18m 5524 R 0.0 3.7 0:00.34 php
27852 coldclim 18 0 29176 15m 5432 R 0.0 3.1 0:00.24 php
27855 coldclim 18 0 27612 14m 5432 R 0.0 2.8 0:00.18 php
27857 coldclim 18 0 31364 17m 5496 R 0.0 3.5 0:00.29 php
27861 coldclim 18 0 24500 11m 5428 R 0.0 2.2 0:00.11 php
27862 coldclim 18 0 30848 17m 5476 R 0.0 3.4 0:00.28 php
27956 coldclim 18 0 25800 12m 5432 R 0.0 2.4 0:00.14 php
27961 coldclim 18 0 22400 8440 4584 R 0.0 1.6 0:00.04 php
27973 coldclim 18 0 24376 10m 5388 R 0.0 2.1 0:00.09 php
27974 coldclim 18 0 23188 9204 4900 R 0.0 1.8 0:00.05 php
All of that memory usage adds up. I would like to "throttle" the number of processes that user/domain can run. I think this would be a quick and easy way to keep the domain from taking down my entire VPS. My understanding is that I could do this with the /etc/security/limits.conf file.
Is that correct?
I have never done this before. Do I want to set a hard or soft limit? I think if I wanted to limit the number of processes for "coldclim" to 15 I would add a line to limits.conf like this:
Code:
coldclim hard nproc 15
Assuming that is correct, can anyone tell me how the website would respond once it reached its limit? Would visitor queries become sluggish, or would the website not come up for them at all?
Thanks for the help!