Open main menu

OpenVZ Virtuozzo Containers Wiki β

Performance tuning

Revision as of 11:34, 19 September 2007 by Alexandr Andreev (talk | contribs)

This page describes how to improve performance of OpenVZ system.

Contents

HW node environment tuning

Disable unnecessary services

Disable all default services that you do not need to use and then reboot your host.


For example, the audit daemon can significantly decrease performance of linux kernel system calls (up to ~20%) even if you do not use any audit rules, or even if you just stopped this service without host reboot!


To setup default services, use chkconfig or ntsysv in RedHat, or rc-update in Gentoo, update-rc.dv on Debian

Shell scripts performance improvement

To improve performance of small shell scripts, which spends a lot of time starting the shell binary itself (like the shell scripts test from the unixbench package), you can set your LANG environment variable to "C".


To see current settings, type

 # locale

If you want to change it only for the current shell session, do:

# export LANG=C

If you want to change the default value, modify the /etc/sysconfig/i18n file.


If your default LANG environment variable was set to something like en_US.UTF-8, you can reduce shell (bash) startup time up to ~15% with LANG=C.

Virtual Environment tuning

CPU distribution inside VE on SMP hosts

  • If the total number of VE's in your host is more than CPUs number, and there are many threads running inside each VE it is better to give just a single VCPU to each VE.

In this case thread memory locality will significantly reduce overhead on SMP memory coherence and overall performance can be increased up to ~50-100%!

To set the number of CPUs available inside VE use:

# vzctl set $VEID --cpus N

Network checksumming

(TODO)

Shell scripts performance improvement

Please note, that on VE creation the default LANG value will be the same as in the HW node. So you can tune it in node (see [[#Shell scripts performance improvement] aaa]), or set it in VE the same way.


The second important thing is the locale cache. By default it is created by glibc rpm post install script and it can be up to 50 MBytes on some distributions. So on some VE templates it can be missed to save disk space. But you can always create it inside VE after VE creation by the following command (you must be the root user):

# build-locale-archive

And again, in some cases shell (bash) startup time can be reduced up to ~15%.