pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Boszormenyi Zoltan <zb@cybertec.at>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Lee Nguyen <leemobile@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgresql in a Virtual Machine
Date: Tue, 26 Nov 2013 10:39:48 -0500
Message-ID: <5294C0C4.1080003@dunslane.net> (raw)
In-Reply-To: <5294A77F.8050508@cybertec.at>
References: <CAHghi5Cj_6KmwaUopF3y=vSjs3Q83VyXQy5DQhfLyP_Zt0yxbA@mail.gmail.com>
	<5293B0B9.1060200@vmware.com>
	<5294A77F.8050508@cybertec.at>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>


On 11/26/2013 08:51 AM, Boszormenyi Zoltan wrote:
> 2013-11-25 21:19 keltezéssel, Heikki Linnakangas írta:
>> On 25.11.2013 22:01, Lee Nguyen wrote:
>>> Hi,
>>>
>>> Having attended a few PGCons, I've always heard the remark from a few
>>> presenters and attendees that Postgres shouldn't be run inside a VM. 
>>> That
>>> bare metal is the only way to go.
>>>
>>> Here at work we were entertaining the idea of running our Postgres 
>>> database
>>> on our VM farm alongside our application vm's.  We are planning to 
>>> run a
>>> few Postgres synchronous replication nodes.
>>>
>>> Why shouldn't we run Postgres in a VM?  What are the downsides? Does 
>>> anyone
>>> have any metrics or benchmarks with the latest Postgres?
>>
>> I've also heard people say that they've seen PostgreSQL to perform 
>> worse in a VM. In the performance testing that we've done in VMware, 
>> though, we haven't seen any big impact. So I guess the answer is that 
>> it depends on the specific configuration of CPU, memory, disks and 
>> the software.
>
> We at Cybertec tested some configurations about 2 months ago.
> The performance drop is coming from the disk given to the VM guest.
>
> When there is a dedicated disk (pass through) given to the VM guest,
> PostgreSQL runs at a speed of around 98% of the bare metal.
>
> When the virtual disk is a disk file on the host machine, we've measured
> 20% or lower. The host used Fedora 19/x86_64 with IIRC a 3.10.x Linux 
> kernel
> with EXT4 filesystem (this latter is sure, not IIRC). The effect was 
> observed
> both under Qemu/KVM and Xen.
>
> The virtual disk was not pre-allocated, since it was the default setting,
> i.e. space savings preferred over speed. The figure might be better with
> a pre-allocated disk but the filesystem journalling done twice (both 
> in the
> host and the guest) will have an effect.


Not-pre-allocated disk-file backed is just about the worst case in my 
experience.

Try pre-allocated VirtIO disks on an LVM volume group - you should get 
much better performance.

cheers

andrew



-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (30+ messages)  latest in thread

Message-ID: <5294C0C4.1080003@dunslane.net>
Permalink:  ../5294C0C4.1080003@dunslane.net/
Also on:    postgresql.org/message-id/5294C0C4.1080003@dunslane.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andrew@dunslane.net, zb@cybertec.at, hlinnakangas@vmware.com, leemobile@gmail.com
  Subject: Re: Postgresql in a Virtual Machine
  In-Reply-To: <5294C0C4.1080003@dunslane.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox