Hosting a PostgreSQL Database
Introduction
I recently came across a company called Heroku who offer a hosted version of PostgreSQL. Since I am looking into hosting a database I thought I would share my thoughts on what you should think about when hosting a PostgreSQL database as well as comparing a Cloud hosting provider like Rackspace against the Heroku service.
What to think about when hosting a server
I recently came across a company called Heroku who offer a hosted version of PostgreSQL. Since I am looking into hosting a database I thought I would share my thoughts on what you should think about when hosting a PostgreSQL database as well as comparing a Cloud hosting provider like Rackspace against the Heroku service.
What to think about when hosting a server
When looking to host your database there are a number of things you need to consider (in no particular order).
Location
Where are your main customers. Where are your servers going to be that will be communicating with the database. Ideally you would like the database to be as close to the other servers as possible, preferably in the same building on the same network.
Redundancy
If you are starting out you may only use a single server and opt to backup the data regularly so that in the case of hardware failure you can reconstruct your server. But eventually you will need to provide a fail over server that can take over when your main server dies or goes offline.
There are a number of different ways this can be achieved which I will not go into here. But the main point being that you will need additional servers that can take over the job when one goes down.
Backups
You will need to be able to backup your database or provide another system such as logging each transaction so that you can play them back to reconstruct the database. Either backup to another server, a cloud based storage system (Rackspace Cloud Files or Amazon S3), backup to tape or SAN (if you are hosting the servers yourself).
Hardware Requirements
How much load is your server going to be handling? The number of connections and the amount of traffic your database can handle will depend the memory, hard drive space and CPU usage of your system.
Network Requirements
You need your network connection to be as fast as possible. This generally would only be an issue if you were running your server from home, but you should still check with your hosting provider to find out a few things
- How much traffic can come in/out?
- How much will it cost if you go over your limit? Or will they throttle it?
- What is the bandwidth speed? 10Mbps, 100Mbps?
- Do you have a static IP address? (if you need one, you may be able to use use DynDNS.org).
If you are hosting via a company such as http://hivelocity.net/ then these are they type of things you can choose during your setup, and change at a later date if you need to.
Harddrive failure - Raid
If you are going to buy the servers and either host them yourself or have it hosted by another facility then you should also look into using a RAID setup (perhaps RAID 5 or RAID 10). Having multiple hard drives that replicate the data between them so that in the case one hard drive fails you can just pull it out and replace it without loosing all your data. And if its hot swappable then you can do this while your server is still running.
Maintenance
Who is going to do all the work? When looking into hosting a server this should be a big factor in your decision. If you are a startup working on your own then this is an even bigger issue since your time is very valuable. If you don’t have time then you will need to employ someone to do the work for you.
Installing Software and Security
If you run your own server, using a hosting provider like Rackspace Cloud or get a dedicated sever from http://hivelocity.net then you will still need to install all the software yourself, and set up all the firewalls and security systems youself. This is not so difficult to do or learn, its just that it takes time and should be factored into your decision making. And if you get it wrong your server might be compromised (hacked) and that could be a complete disaster for your business.
Making sure the server is always running
If a problem ever happens to the server you will need to fix this as quickly as possible. This would mean always having to keep an eye on your server and make sure its running. If your server is running from home then what happens if you go on holiday and come back to find the power went off and your server went down? Or a hard dive failed? Or your ISP went down or started throttling your connection. You will need to make sure you always know the health of your servers.
I do not have any specific links but there are services available that you can use to get an SMS when your server goes down. There are also most likely some useful Android or iPhone apps that can work with these services and tell you the health of your servers.
Comparing Rackspace Cloud with herkoupostgres
For a linux machine the cost is the following (roughly doubling each time)
- 256MB RAM with 10GB Disk for $10.95 month
- 512MB RAM with 20GB Disk for $21.90 month
- 1024MB RAM with 40GB Disk for $43.80 month
- 2048MB RAM with 80GB Disk for $87.60 month
- 4096MB RAM with 160GB Disk for $175.20 month
- 8192MB RAM with 320GB Disk for $350.40 month
- 15872MB RAM with 620GB Disk for $700.80 month
- 30720MB RAM with 1200GB Disk for $1314 month
If you compare this to a hosted postgreSQL service like Heroku then it looks like it costs a bit more (although they don’t state what “Cache” is but here I am comparing it to system memory.
But the difference here is that Heroku is a full service and they take care that everything is running smoothly being backed up and always accessible.
So lets take the difference here for the 34GB Cache
$3200-$1314 = $1886.
So the first that that jumps out at me is that if I was to replicate my server to another machine then that would cost me another $1314 from Rackspace. But Heroku has a service that does this for you called “followers” its a read only version of the database that is kept in sync with the master database. They do not disclose how much a follower costs though, but if its free then that would be a savings.
Heroku provide “Daily, Automated Database Snapshots” as well as “Continuous Protection realtime backups”. If you were to host your own database on a cloud service then this would cost you as well.
Running your own Servers
You can run your own servers, either by buying a box for a few thousand or by getting a dedicated server from a company such as http://hivelocity.net/. You will still have all
Conclusion
From a first look Heroku Postgres does look like a very appealing solution. But for a small startup company it still comes at a cost. And the question of location of the servers may still be an issue. Especially if you are using a database for time critical transactions.
If you are just starting up a company then perhaps you would go cheap and simply host everything on one server (database and your server applications), perhaps your own server running from your home. But eventually a scalable, redundant solution will be required.
My myself I will still be looking to use Rackspace Cloud for my server hosting, including PostgreSQL. But it was interesting reading about companies such as Heroku and I will definitely keep an eye on them.
Comments
Post a Comment