VM Performance: Difference between revisions

From ConShell
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
{{TRADS}}
== Linux VM Performance Tuning Guidelines ==
== Linux VM Performance Tuning Guidelines ==
I will document some tweaks and tips to increase performance of a Linux virtual machine. Many tips will likewise apply to physical machines as well, but the focus is on virtual machine technology. Most of my experience is with CentOS-3 and 4 (this is a Red Hat clone) running on VMware ESX server 2.5.x and 3.0.x
I will document some tweaks and tips to increase performance of a Linux virtual machine. Many tips will likewise apply to physical machines as well, but the focus is on virtual machine technology. Most of my experience is with CentOS-3 and 4 (this is a Red Hat clone) running on VMware ESX server 2.5.x and 3.0.x
Line 106: Line 107:
* [http://koltsoff.com/pub/securing-centos/#3 Implementing network security on Centos/RHEL Servers]
* [http://koltsoff.com/pub/securing-centos/#3 Implementing network security on Centos/RHEL Servers]
* [http://pubs.vmware.com/guestnotes/wwhelp/wwhimpl/js/html/wwhelp.htm VMware Guest Notes]
* [http://pubs.vmware.com/guestnotes/wwhelp/wwhimpl/js/html/wwhelp.htm VMware Guest Notes]
{{ABADS}}

Revision as of 10:47, 20 September 2007

Linux VM Performance Tuning Guidelines

I will document some tweaks and tips to increase performance of a Linux virtual machine. Many tips will likewise apply to physical machines as well, but the focus is on virtual machine technology. Most of my experience is with CentOS-3 and 4 (this is a Red Hat clone) running on VMware ESX server 2.5.x and 3.0.x

Inside the VM

SMP vs. Uniproc

Because a hypervisor already multiplexes cpu cycles to the VMs that need it, there is usually nothing to be gained from configuring SMP within a VM. In fact the addl overhead of SMP can actually slow down a VM. Bottom line: Use uniprocessor

Memory allocation

Be sure the virtual machine is configured with at least 256MB of memory.

Filesystem

  • If possible, use a performance-enhanced filesystem such as xfs and jfs, which are reportedly MUCH faster then ext3
  • For JFS under CentOS-4 you will need the "plus.c4" kernel from "extras" repo and jfsutils.

Web servers

Consider lighttpd or tux instead of apache.

Terminal Emulator (xterm et al)

I recommend mrxvt over gnome-terminal or konsole. It has a much lower memory footprint.

Shell

ash is a shell that uses much less memory than bash. Users have reported freeing up to 12MB of RAM by switching to ash.

Getty

There is little need to getty to be running on more than a couple of ttys. By removing tty3-tty6 you can save a couple MB of RAM and some tiny amount of processor time.

Comment out the lines (shown below) in /etc/inittab

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6

Send a SIGHUP to init to re-read the inittab file

kill -HUP 1

Turn off unnecessary services

Much like getty listening to ttys, the default configuration of most Linux distributions is not well suited to performance.

  • X windows
    • in /etc/inittab... id:3:initdefault:
    • xfs - x font server, optional
    • gdm - if the inittab tweak above doesn't cut it

Try this command: /sbin/chkconfig --list | grep 3:on Here are some things I tend to turn off in CentOS and Red Hat.

  • isdn
  • pcmcia
  • anacron
  • bluetooth
  • kudzu
  • cpuspeed
  • auditd
  • cups
  • smartd
  • gpm

I could go on and on with these!

Here is a quick sh command to take care of it. Adjust as necessary.

for svc in isdn pcmcia anacron bluetooth kudzu cpuspeed auditd cups smartd gpm; do
/sbin/service $svc stop
/sbin/chkconfig $svc off
done

If you are not mounting or exporting any NFS shares, these addl. services can be disabled

for svc in portmap nfslock netfs autofs; do
/sbin/service $svc stop
/sbin/chkconfig $svc off
done

Consider either disabling the xinetd service or specific services it handles e.g. telnet

Install vmware-tools

Obviously this only applies if VMware is your underlying platform. Enable tools.syncTime="TRUE" if nothing else.

Network driver

Under ESX, use the vmxnet driver not the pcnet32 (aka vlance). This will require the vmware-tools to be installed.

Other misc

Turn off selinux - set the following in /etc/selinux/config

SELINUX=disabled


Turn off ipv6 - put the following lines in /etc/modprobe.conf (RHEL/CentOS)

alias ipv6 off
alias net-pf-10 off

Also make sure this line appears in /etc/sysconfig/network

NETWORKING_IPV6=no

Outside the VM (on the host)

Storage

  • Use RAID 0+1 or RAID-10, as it is the fastest disk access possible.
  • Consider your filesystem type, xfs and jfs are reportedly MUCH faster then ext3
  • Never store your VMs on NFS

Devices

Only assign what is needed. Consider NOT assigning USB, Audio and floppy drives.

References


Template:ABADS