Cloud Hosting for PostgreSQL
Database Hosting Options
● Colocation● Dedicated Server● Virtual Machine● Database as a Service
Finding Your Just Right Hosting
Pssh, that's easy!● Just use EC2!● $COOL_NEW_STARTUP uses it!● I could spin up dozens of databases on-
demand!
EC2 Caveats
● See Christophe Pettus' PGCon 2012 presentation PostgreSQL on AWS
● Dedicated Instances: base cost at least $7300/month, plus per-instance costs
● Don't trust (ephemeral) instance storage● Beware Regional and Internet Data Transfer
pricing, EBS storage and I/O costs● Does your database use actually fit EC2's
business and cost model?
Choosing a Hosting Provider
● Three main factors to consider:– Stability
– Stability
– Stability
● Beware “too good to be true” or “Unlimited”● Check how long they've been in business,
contact details, office location● Remember: moving your master database is
much trickier than moving a web server.
Options
● Number and speed of CPU cores● Memory, guaranteed vs. burstable● Disk I/O● disk space● 10/100/1000 Mbps, metered or unmetered● data center location● Virtualization method: OpenVZ, Virtuozzo,
Vserver, KVM, Xen, VMWare
No love for Postgres?
● Hosting providers offer servers customized for:– Game servers
– SEO
– Storing backups
– High bandwidth
– High RAM
– MySQL
● Don't trust your hosting provider to handle e.g. VPS migrations without corruption
Heroku Postgres
● “database as a service”● Crane and Kappa offer great bang for the buck,
BUT:● 1TB max. database size on all offerings● Can't create global objects: stuck with single
default username per-database?● No database superuser● Can't setup replication outside of Heroku
VPS Toolkit
● bwm-ng: watch out for excessive bandwidth use, especially during backups
● ioping: run for an hour, check max. latency:--- /home/josh/ (simfs /dev/simfs) ioping statistics ---
1515 requests completed in 1550734.6 ms, 44 iops, 0.2 mb/s
min/avg/max/mdev = 0.1/22.9/4521.9/142.1 ms
● Ensure performance is acceptable for your most I/O intensive jobs: stats rollups, backups and restores, CLUSTER, etc.
● Don't forget the hosting provider's dashboard
Ain't gonna happen
Ain't gonna happen #2
Ain't gonna happen #3
Read those TOSs
● You will not engage in any activity that interferes with or disrupts services
● DreamHost Web Hosting servers are not intended as a data backup or archiving service.
● We may suspend... if we determine... may adversely impact the Service Offerings or the systems or Content of any other AWS customer
● Customers may not ... run any “jail-breaking” software that circumvents the restrictions placed on the container by the parent node.
Beware the budget VPS
Beware the Budget VPS #2
“So basically, you've got a broken kernel here: it claimed to give PG circa 135MB of memory, but what's actually there is only about 128MB. I don't see any connection between those numbers and the shmmax/shmall settings, either --- so I think this must be some busted implementation of a VM-level limitation.
I see no Postgres bug here. You need to take this up with your hosting provider, who have given you a faulty kernel.
regards, tom lane
Backups
● Don't trust a single provider with your master database and only set of backups!
● Several hosting providers may colocate in the same datacenter.
● Some providers offer a special backup/storage VPS with generous disk space
● Consider sending backups offshore: NL, DE, FR, UK all have good connectivity and hosting deals
Cost
● Hosting is becoming cheaper rapidly. Don't get locked into multi-year commitments
● Let's look at the history of deals posted on lowendbox
● Beware: many hosting providers who offered great deals are no longer around
Further Resources
● vpslist.net: quarterly rankings of VPS providers by performance on I/O and CPU benchmarks
● vpsbenchmarks.net: detailed benchmarks of many VPS providers
● Hostmonk.com: search by price, disk, memory, bandwidth
● lowendbox.com: if you're looking for cheap auxiliary machines
● webhostingtalk.com: look up past experiences with a provider, exclusive deals posted, ask for opinions
Fin
● Slides available, CC-BY-NC 3.0 license● I'll put data used online shortly● Questions?