Debian VM - hard disk / cpu settings

Sep 21, 2012
30
0
6
Hello,

after searching for quite a while and only finding very old posts or not linux/debian specific, I decided to bring up this question:

Which are the best practice / performance settings for Debian 7.5 KVM VMs?

As far as i found results:
Bus/Device: VirtIO
Format: Raw
Cache: No cache

Is this still true? For cache I found a few howtos recommending write back for ubuntu, might this apply to debian as well?

As for CPU i guess kvm64 is still the best way?

Thanks for the help!

P.S.: PVE 3.2
Code:
proxmox-ve-2.6.32: 3.2-129 (running kernel: 2.6.32-30-pve)
pve-manager: 3.2-4 (running version: 3.2-4/e24a91c1)
pve-kernel-2.6.32-30-pve: 2.6.32-130
pve-kernel-2.6.32-26-pve: 2.6.32-114
lvm2: 2.02.98-pve4
clvm: 2.02.98-pve4
corosync-pve: 1.4.5-1
openais-pve: 1.1.4-3
libqb0: 0.11.1-2
redhat-cluster-pve: 3.2.0-2
resource-agents-pve: 3.9.2-4
fence-agents-pve: 4.0.5-1
pve-cluster: 3.0-12
qemu-server: 3.1-16
pve-firmware: 1.1-3
libpve-common-perl: 3.0-18
libpve-access-control: 3.0-11
libpve-storage-perl: 3.0-19
pve-libspice-server1: 0.12.4-3
vncterm: 1.1-6
vzctl: 4.0-1pve5
vzprocps: 2.0.11-2
vzquota: 3.1-2
pve-qemu-kvm: 1.7-8
ksm-control-daemon: 1.1-1
glusterfs-client: 3.4.2-1
 
Last edited:
My suggestions:
CPU = Host, because enable all his flags
cache for performace = writeback, but at risk of losing information if the physical host crashes or is breaks
cache for security = writethrough, isn't fast, but is the more sure, you will not lose information, and writethroug also do cache of writes on the physical host (a more RAM in the physical host, more amount of cache will have)
Bus/Device: VirtIO
Format: LVM as block device for your VMs
I/O scheduler for the VM = noop (no optimized, the PVE host have his own I/O scheduler)
RAM: ?? (you did not tell us what use will have)

If you have a RAID controller with BBU:
Set the RAID controller with write cache
 
Thank you for your advice.

Some more information about the project:

We have rootserver that runs proxmox and we want to run 3-4 KVM VMs on it.

We will need at least:
2 Debian VMs (one running webserver, mail, mysql etc.; one running some teamspeak servers and possible gameservers)
1 Windows VM (most likely Win7)

The machine has 32 GB RAM, each vm will get around 6-8 GB RAM
The "web VM" already exists and is running on a proxmox 2.3 machine (since ~ 2 years) and will be moved to the new machine.

Thank you again for any further advice.

Another question: Can I change the cpu / cache settings of the KVM Debian VMs and reboot the VMs for that settings to take effect without changing something in the VMs)?
 
Last edited:
We have rootserver that runs proxmox and we want to run 3-4 KVM VMs on it.

We will need at least:
2 Debian VMs (one running webserver, mail, mysql etc.; one running some teamspeak servers and possible gameservers)
1 Windows VM (most likely Win7)

The machine has 32 GB RAM, each vm will get around 6-8 GB RAM

About of the amount of RAM, i believe that 6 GB RAM for each VM will be good, but for be very sure, for each VM the best option will be:
1- Start only a VM at the same time in a same PVE host
2- Assign lots of RAM to the VM, it is only for do this test (first apply a shutdown, and after you should start it for that the changes take effect).
3- Install htop in your Linux VMs
4- Use the VM deeply for some hours
5- For Linux VMs, execute htop into the VM (with the {F2} key configure the view with colors, show all, etc. for get a view more clear of each process. And the h {help} key will help you to understand it), and see the use of RAM. A important note: view of buffers and cache isn't relevant for this task, them only use the free RAM that is available, then you can subtract this memory for know the minimun required.
6- Also you can run by CLI into the VM:
shell> free -h
7- For Windows VMs, use the "task administrator" for see the use of RAM, remember that always the buffers and cache isn't relevant for this task, them only use the free RAM that is available, then also you will have that subtract it.
8- Remember that with more memory RAM free in the VM, more amount of cache can handle the VM, and obviously the VM will be more faster in terms of access to his files.
9- With VMs in writeback disk mode, remember that with more memory RAM free in the PVE host, more amount of buffers of blocks of disk can handle KVM, and obviously the VM will be more faster in terms of access to block of disks.
10- Follow all these steps for testing the next VM.

The "web VM" already exists and is running on a proxmox 2.3 machine (since ~ 2 years) and will be moved to the new machine.

Here you can see the use of RAM executing htop (and tweak it with F2 key), or run by CLI: free -h

Good luck with your project

Best regards
Cesar

Re Edited: Remember that MySQL have his own optimization, that include the use of RAM, cores of CPU, caches, and many other things. If you want don't lose data if the VM be hang, or the host be hang, you should optimize MySQL. Many hours of work was for me study this tasks, remember that for security reasons, will be better:
1- configure MySQL for that not do write cache
2- For get the best performance, assign to MySQL as read cache a amount of RAM equal to the BB.DD. of MySQL (the 80% of performance is gained with this configuration)
 
Last edited:
Thanks for the very detailed advices and the example. Very much appreciated! I'll check that on the old proxmox server, where we have 2 running KVM VMs with debian both running for that long time (700+ days).

You also wrote earlier: "Format: LVM as block device for your VMs"

I guess you meant in my storage setup? I rechecked that and just realised that I might have a mistake in my setup. I have 2 VGs and created 2LVs (on debian setup): one for the hostsystem and swap and one (/var/lib/vz) for all the rest of the space (I installed proxmox ontop of debian since this is a rent server). Proxmox ofc assinged my storage as a directory for that LV. I think I should delete that second LV and only assign some space of it for iso, backups etc. and setup the rest for storage LVM?
Or would this have disadvantages over that directoy setup?
 
Okumba, LVM as block device only will be util for have a space of disk available for be used as virtual disks for your VMs (or images as it says in the GUI of PVE), Then, it will not have a file system that can be used for others purposes, as backups, templates, ISOs, etc.

For get this, you should create by CLI a LVM partition (that can be a complete or partial disk), after you will should create by CLI a Virtual Group (VG) in the created LVM partition, and finally in the GUI of PVE, go to "datacenter", "storage", "add", "LVM" for add this new VG and complete all his fields. Completed all this, you will can create VMs and uses the LVM partition as his virtual disks (using the ID that you added in the GUI of PVE)

Good luck

Cesar
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!