Monday, April 1, 2013

Heroku's cost per dyno

I was always wondering ... how much does a dyno cost to heroku.
Heroku gives a free dyno per user (720 dyno hours per month) so that seems like a lot
especially given that the dynos behave like small EC2 instances - occassionally better occassionally worse. It seems to be costing the same as a reserved small EC2 instances... - but without actually reserving it for a year. Seems like a good deal right?

Lets assume that this was true, ie that heroku doesn't "auto-idle" your app.
My friend told me that Heroku uses lxc 
Searching Heroku+lxc at google shows very little and even the quora article that I found the most useful (which returned by google) has the lxc reference removed... I am thinking conspiracy theories here...

Anyway here is the information I found from the quora article:

Apparently heroku uses High Memory Extra large instances


High-Memory Extra Large Instance
17.1 GiB of memory
6.5 EC2 Compute Units (2 virtual cores with 3.25 EC2 Compute Units each)
420 GB of instance storage
64-bit platform
I/O Performance: Moderate
EBS-Optimized Available: No
API name: m2.xlarge



High-Memory Reserved Instances
Extra Large$272$0.169 per Hour$398$0.136 per Hour



and stuffs up to at least 60 dynos in each such machine.

like Heroku runs up to at least 60 dynos/workers per railgun instance, which appears to be an EC2 "High-Memory Extra Large Instance" with 17.1GB of RAM and two 2.67GHz CPU cores (see http://aspen-versions.heroku.com...)


Now, the link pointed above leads to a decommissioned app (more conspiracy theories..).
I wonder is he making up the 60 number?

Heroku states that each dyno gets 512MBs of mem.. (related info at heroku site + this article )but that would be 35 dynos per machine not 60...plus on top of that how do you get that cpu ? heroku promises much more than 0.1 EC2 compute unit (1 ec2 compute unit ~= a 1GHZ 2007 Opteron).
So it seems that the answer in all these is overbooking.
Heroku does the very convenient (and ok from my perspective ) thing of forcing people to write small apps that can be restarted and is much more efficient than an individual user at keeping a big number of apps to a single machine making sure all along to move apps around when their workload increases beyond what fits their machine... ie. I think they keep their promise of 512MB ram and 1 cpu)

Anyway, assuming that 60 is right, heroku's cost per dyno is  $0.169/hr x 24hrs x 30days = $121 / 60 dynos ~= $2/dyno every month. So they charge $45/month and theypay $2. The freebie dyno-month is a non negligible $2/month.. Of course auto-idling must be reducing that to a much smaller number.


No comments:

Post a Comment