Postgres on Heroku and AWS
Heroku provides hosted Postgres, Redis, as well as other services via addons.
While Heroku is vague about the hardware that dynos run on, they explicitly define the specs of the underlying machines for postgres databases in their docs.
There are are variety of service tiers in Heroku’s Postgres offering. The hobby levels are multi-tenant (they share a machine with other customers) so their performance isn’t guaranteed or suitable for production.
The standard tier and above provide dedicated instances, but the premium tier or higher is required for high availability (HA).
For the purposes of our comparison, we’re going to look exclusively at Heroku’s highly available premium tier and AWS’s equivalent.
Comparison
The following table compares the HA offerings from Heroku and AWS. For Heroku, we’re using the premium tier for cost calculations (private and shield types are identical, but cost more). For AWS, we’re including the cost of provisioning an HA database alongside a General Purpose and Provisioned IOP SSD.
Plan | vCPU | RAM (GB) | PIOPs | Disk Size (GB) | Instance type | Disk type | Heroku | AWS on-demand | AWS reserved |
---|---|---|---|---|---|---|---|---|---|
0 | 2 | 4 | 200 | 68 | db.t2.medium | General Purpose | $200.00 | $120.76 | $84.76 |
2 | 2 | 8 | 750 | 256 | db.m5.large | General Purpose | $350.00 | $315.20 | $211.52 |
3 | 2 | 15.25 | 1,000 | 512 | db.r4.large | Provisioned IOPs | $750.00 | $688.00 | $522.40 |
4 | 4 | 30.5 | 2,000 | 768 | db.r4.xlarge | Provisioned IOPs | $1,200.00 | $1,312.00 | $980.80 |
5 | 8 | 61 | 4,000 | 1,000 | db.r4.2xlarge | Provisioned IOPs | $2,500.00 | $2,490.00 | $1,826.16 |
6 | 16 | 122 | 6,000 | 1,500 | db.r4.4xlarge | Provisioned IOPs | $3,500.00 | $4,455.00 | $3,127.32 |
7 | 32 | 244 | 9,000 | 2,000 | db.r4.8xlarge | Provisioned IOPs | $6,000.00 | $8,060.00 | $5,404.64 |
8 | 64 | 488 | 12,000 | 3,000 | db.r4.16xlarge | Provisioned IOPs | $8,500.00 | $14,670.00 | $9,359.28 |
As we can see, there is a markup on Heroku’s offering, but it’s surprisingly competitive with Amazon’s offerings. It appears that at the 8th-level plan, Heroku is actually more cost effective than AWS.
Resources
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html – documentation describing the behavior of SSD storage options for RDS. This was helpful for me to understand how General Purpose SSDs generate IOP credits.
- spreadsheet I used to calculate costs