I have a web service with 100,000s hits a day. It is currently on a VPS running on LAMP+memcached. The current configuration hits the kmemsize limit of the server.

The server has a lot of free memory and it is not consuming much CPU so it is far from being exhausted. Besides kmemsize all params are pretty low.

What do you suggest to do to solve this bottleneck. I thought about switching to nginx on the server side and installing apc on the php side. do you think it will open the bottlneck? Any other suggestions?


First I'd check to increase these limits...

...the vzXYZ tools of openvz provide a good starting point on setting up ovz containers. When you used vzsplit to generated a config for a number of containers on a given hardware-node, you would have got a sample config with balanced limits equally to all containers. So that is fine to start from...

But in production you will encounter several situations when these limits aren't useful. Therefore they need to bee customized to fit into needs of each individual container. It's nice to monitor the user beancounters...

cat /proc/user_beancounters
   uid  resource                     held              maxheld              barrier                limit              failcnt
 1220:  kmemsize                 18511794             31073180            273694720            277906112                   22
        lockedpages                     0                    8                 2056                 2056                    0
        privvmpages                204185               258842               605796               666375                    0
        shmpages                     7830                 8806                30845                30845                    0

for increasing failcnt. If you get a failcnt on kmemsize for example you could easily increase the limits with the vzctl tool.

vzctl set 1220 --kmemsize 410542080:416859168 --save

Take a deeper look at the wiki http://wiki.openvz.org/UBC_consistency_check. Adjusting limits is not that painfull and I even found overcommitted nodes working without any probs. But be careful!

This script is helpful when setup as a cron-job http://github.com/peletiah/openvz/blob/master/check_beancounter.py

  • Thanks for the answer. I'm on Plesk/CentOs . do you know if this can be done there?
    – Niro
    Oct 6 '09 at 16:14
  • do you have control over the hardware node itself? Oct 6 '09 at 16:19
  • ah I just read your other comment - Yes, Virtuozzo itself (not plesk) should have some management functions to adjust these values. Btw: APC is always nice to have in PHP- Environments ;-) Oct 6 '09 at 16:25

I'm guessing you're using a Virtuozzo VPS or OpenVZ based VPS. You may want to switch to a Xen-based VPS provider like 478east, or ask your host to switch the kmemsize limits.

I might not be 100% right on this, so you may want to wait for another opinion.

  • 1
    Thanks for the answer. I'm using Virtuozzo plesk on CentOS. Switching host is the last thing I want to do.
    – Niro
    Oct 6 '09 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.