Re: Postgresql in a Virtual Machine - Mailing list pgsql-performance

From Mark Kirkwood
Subject Re: Postgresql in a Virtual Machine
Date
Msg-id 5293BF9B.1000405@catalyst.net.nz
Whole thread Raw
In response to Re: Postgresql in a Virtual Machine  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-performance
On 26/11/13 09:28, Andrew Dunstan wrote:
>
> On 11/25/2013 03:19 PM, Heikki Linnakangas wrote:
>> 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. Synchronous replication is likely going to be the biggest
>> bottleneck by far, unless it's mostly read-only. I don't know if
>> virtualization will have a measurable impact on network latency, which
>> is what matters for synchronous replication.
>>
>> So, I'd suggest that you try it yourself, and see how it performs. And
>> please report back to the list, I'd also love to see some numbers!
>>
>>
>
>
> Yeah, and there are large numbers of public and/or private cloud-based
> offerings out there (from Amazon RDS, Heroku, EnterpriseDB and VMware
> among others.) Pretty much all of these are VM based, and can be
> suitable for many workloads.
>
> Maybe the advice is a bit out of date.
>

Agreed.

Possibly years ago the maturity of various virtualization layers was
such that the advice was sound. But these days it seems that provided
some reading is done (so you understand for instance how to make writes
go to the hosting hardware), it should be fine.

We make use of many KVM guest VMs on usually Ubuntu and the IO
performance is pretty indistinguishable from bare metal. In some tests
we did notice that VMs with >8 cpus tended to stop scaling so we are
using more smaller VMs rather than fewer big ones [1].

regards

Mark

[1] This was with Pgbench. Note this was over a year ago, so this effect
may be not present (different kernels and kvm versions), or the magic
number may be higher than 8 now...




pgsql-performance by date:

Previous
From: "Gudmundsson Martin (mg)"
Date:
Subject: Re: Postgresql in a Virtual Machine
Next
From: Merlin Moncure
Date:
Subject: Re: Postgresql in a Virtual Machine