Difference between revisions of "Performance tuning"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
Line 1: Line 1:
This page describes how to do correct performance measurements on OpenVZ system.
+
This page describes how to improve performance of OpenVZ system.
  
= Test conditions =
+
= HW node environment tuning =
  
== kernels with different versions ==
+
== Disable unnecessary services ==
* If you want to compare performance of the kernel on different hosts, or measure OpenVZ performance overhead, it's strongly recommended to compare the same kernel version with similar .config file and on the same linux distribution.
 
  
* If you compare kernels with different versions, please check all .config options that are differ, especially _DEBUG_ options. For example, on unixbench pipe throughput test on 2.6.18 kernel, disabled CONFIG_DEBUG_HIGHMEM option will increase performance up to <font color=red>20%</font>
+
Disable all default services that you do not need to use and then reboot your host.  
  
== running services ==
 
* Before performing test measurement, you should disable '''all''' default services in your runlevel and then '''reboot''' your host.
 
  
It is not enough to just stop services, because some services, like <code>audit</code> will affect performance even if the daemon is already stopped. For some unixbench tests it can be <font color=red>~20%</font> overhead if <code>auditd</code> was started once on a host before reboot.
+
For example, the <code>audit</code> daemon can significantly decrease performance of linux kernel system calls (up to ~<font color=red>20%</font>) even if you do not use any audit rules, or even if you just stopped this service without host reboot!
  
On RedHat distributions use <code>chkconfig</code> or <code>ntsysv</code> utility to disable default services. (<code>rc-update</code> in Gentoo, <code>update-rc.dv</code> for Debian)
 
  
== filesystem tests ==
+
To setup default services, use <code>chkconfig</code> or <code>ntsysv</code> in RedHat, or <code>rc-update</code> in Gentoo, <code>update-rc.dv</code> on Debian
* If you perform filesystem tests, please keep in mind filesystem type, block size, mount options and so on.
 
  
For example, ext3 filesystem performance highly depends on journal type and mount options.
+
== network checksumming ==
 +
('''TODO''')
  
* Also please always note/report IO-scheduler type. Different IO-schedulers can highly affect your tests results (up to <font color=red>30%</font>).
+
= Virtual Environment tuning =
  
If your kernel support different IO-schedulers, you can get/set the type here:
+
== CPU distribution inside VE on SMP hosts ==
  
# cat /sys/block/hda/queue/scheduler
+
* If the total number of VE's in your host is more than CPUs number, and there are many tasks running inside each VE, and they are scheduled quite often, it's better to give just one CPU for each VE. In this case the VirtualCPU-scheduler overhead can be significantly decreased, and overall performance can be increased up to ~<font color=red>50-100%</font>!
noop anticipatory deadline [cfq]
 
# echo noop > /sys/block/hda/queue/scheduler
 
  
== network isolation ==
+
To set the number of CPUs available inside VE use:
* You should disable local network/internet connection if your tests doesn't require it.
 
  
== CPU distribution inside VE on SMP hosts ==
+
# vzctl set $VEID --cpus N
* If the number of VE's in your host is more than CPUs number, and there are many tasks/tests running inside each VE, and tasks are scheduled quite often, it's better to give just one CPU for each VE. In this case the VirtualCPU-scheduler performance overhead can be significantly decreased, and performance can increase up to <font color=red>100%</font>!
 
  
To set the number of CPUs available inside VE use:
+
= Recompiling the kernel =
  
# vzctl set $VEID --cpus N
+
== Disable all unnecessary options ==
  
== network performance ==
+
* You can disable all <code>_DEBUG_</code> options in the kernel, this can increase performance up to ~<font color=red>20%</font> on some applications.
* please do not use file transferring utilities to test the network performance, because the bottleneck of these tests is usually file system performance - not TCP/IP stack
 
  
== network checksumming ==
+
* other options ('''TODO''')
'''TODO'''
 

Revision as of 15:49, 3 August 2007

This page describes how to improve performance of OpenVZ system.

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

network checksumming

(TODO)

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 tasks running inside each VE, and they are scheduled quite often, it's better to give just one CPU for each VE. In this case the VirtualCPU-scheduler overhead can be significantly decreased, 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

Recompiling the kernel

Disable all unnecessary options

  • You can disable all _DEBUG_ options in the kernel, this can increase performance up to ~20% on some applications.
  • other options (TODO)