VM Performance: Difference between revisions

From ConShell
Jump to navigation Jump to search
No edit summary
No edit summary
Line 62: Line 62:
  done
  done


Also, consider either disabling the xinetd service or specific services it handles e.g. telnet
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 ===
=== Install vmware-tools ===
Line 72: Line 78:


=== Other misc ===
=== Other misc ===
Turn off selinux, ipv6, auditd
Turn off selinux - set the following in /etc/selinux/config
SELINUX=disabled
and/or add selinux=0 to grub conf kernel line.
 
Turn off ipv6 - put the following line in /etc/modprobe.conf (RHEL/CentOS)
alias net-pf-10 off


== Outside the VM (on the host) ==
== Outside the VM (on the host) ==
Line 78: Line 89:
* Use RAID 0+1 or RAID-10, as it is the fastest disk access possible.
* 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
* Consider your filesystem type, xfs and jfs are reportedly MUCH faster then ext3
* Never use NFS


=== Devices ===
=== Devices ===
Only assign what is needed. Consider NOT assigning USB, Audio and floppy drives.
Only assign what is needed. Consider NOT assigning USB, Audio and floppy drives.
== References ==
* [http://searchservervirtualization.techtarget.com/tip/0,289483,sid94_gci1231666,00.html VMware ESX Server guest OS performance tips]
* [http://koltsoff.com/pub/securing-centos/#3 Implementing network security on Centos/RHEL Servers]

Revision as of 01:54, 21 April 2007

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.

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.

Result: Use uniprocessor

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

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

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

and/or add selinux=0 to grub conf kernel line.

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

alias net-pf-10 off

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 use NFS

Devices

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

References