Virtual Machines



Set your disk scheduling algorithm to ‘noop’.

The Linux kernel has different ways to schedule disk I/O, using schedulers like deadline, cfq, and noop. The ‘noop’ — No Op — scheduler does nothing to optimize disk I/O. So why is this a good thing? Because common virtual machines systems are also doing I/O optimization and queuing! It’s better for a guest OS to just hand over all the I/O requests to the hypervisor to sort out than to try optimizing them itself and potentially defeating the more global optimizations.

You can change the kernel’s disk scheduler at boot time by appending:


to the kernel parameters in your boot loader configurations.

File systems

Linux’s default behaviour when mounting a filesystem is to remember the last access time for every file. This effectively turns every read into a write, and increases the amount of disc access needed. The noatime and nodiratime mount options disables this behavior and can give a tangible speed boost to a Virtual Machine.

/dev/VolGroup00/LogVol00 / ext3 defaults,noatime,nodiratime 1 1

Scheduled jobs

Schedule jobs to not run simultaneously.

Linux distributions often have some common system maintenance tasks scheduled automatically, like log rotations, locate database updates, etc. These can be quite I/O intensive. Likewise, things like system monitoring tasks often are scheduled to run at the same time on all hosts (at 0, 15, 30, and 45 minutes after the hour, for example). If you can introduce a delay in these tasks that would help spread the load out.

One super simple trick I use in /etc/cron.daily/logrotate and /etc/cron.daily/mlocate.cron is to sleep for a random amount of time. The bash shell has $RANDOM, which generates a random number between 0 and 32767. For example, if you can wait up to 5 minutes to do these things try adding:

/bin/sleep $((RANDOM/109))

to the scripts (109 = 32767/300 seconds). I do this with log rotations, mlocate database updates, monitoring system scripts, backup jobs, and anything that runs at a common time, changing the divisor to meet whatever timeframe I need.

Time keeping

Always install and set NTP client.

fruity/AdminAndConfs/VirtualMachines (last edited 2010-12-01 13:54:48 by fruity)