I've learnt a lot about scaling projects on Heroku to get the most for your money. Everything costs more on Heroku (and rightly so) and so finding the best way to squeeze out as much performance as possible for your money is important. Let me share some of these newly gained wisdom with you.
1. Pipelines are Excellent
Heroku Pipelines is a new feature that allows you to specify a pipeline of code.
git push staging master to a staging environment, test everything and then
heroku pipelines:promote to promote the code to a production environment instantly! There's no build process, it just moves the code over to the new application instantly.
Best of all, pipelines are free. You just pay for the resources used as normal.
2. Hobby dynos are fine
For small traffic sites that require no more than one dyno, even if you're a "professional", hobby dynos are absolutely fine!
I had initially assumed that hobby dynos were watered down versions of Standard-1X dynos. Perhaps they had higher numbers of tenants per server? Turns out I was wrong.
Hobby dynos are actually just Standard-1X dynos but with their ability to scale above 1 dyno removed. In other words, if you're running an application with just a single 1X dyno and you're paying $25 a month for it, you're paying $18/month more than you should.
You do get a few other bits and pieces for your extra $18, like preboot and builds that are 'faster' (although, I have no way of proving or disproving this) but for low-traffic websites, that's really not needed.
Heroku have even admitted that their professional dynos are named such as to gently encourage users to use professional dynos in a professional setting.
...if you're a business, and you're using hobby dynos? You just feel, maybe, a little bit embarrassed about that. And it's just those little cues all through the product.
(Definitely watch that video, it's a facinating insight in to their new pricing structure.)
3. Load test. Lots.
A lot of the sites we have on Heroku have quite spikey traffic. That is, most of the time they're doing modest traffic but at particular times (a new on sale, pantomime, etc.) the traffic can easily grow by 20-50x over the course of a 30 second TV ad.
The temptation in these situations is to slide the dynos scaler up to 50, sit back, and relax. This doesn't always work though.
With the release of Performance dynos, we managed to squeeze 96 threads out of a Performance-L dyno which actually turned out to be more economical.
Performance dynos are also single-tenant (sort of, I'll come on to this later) so you don't risk the issue of noisy neighbours.
We found that using Performance dynos over a short period to deal with a sudden spike in traffic actually works well rather than using 50 Standard dynos.
Don't let the pricing scare you. $500/dyno/month sounds like a horrifying amount of money but since it's pro-rated to the second, actually dealing with the aftermath of a TV ad isn't too bad and usually ends up costing less than $1.
4. Make use of support
Heroku's support is excellent. We currently don't pay the $1000/month support contract for any of our projects for three reasons.
- A grand? Are you serious?
- Every single support ticket I've ever raised with Heroku has been answered within hours and every single downtime event has been our fault, not theirs!
- Their system appears to be sufficiently rock-solid that support from Heroku isn't required.
Their agents are always super helpful, clued up and eager to help. That said, on one occation, when they fell short of our expectations they helped to solve the issue very quickly but getting recompense proved quite a long process.
5. Read the docs
Deploying something to Heroku is easy. That's the whole point. But when you get in to the nitty-gritty, there's some really handy little features that you may not have spotted.
Things like using
.slugignore, writing your own buildpacks, app forking, review apps and all the other stuff. You can disappear down a rabbit hole reading the Heroku docs.
6. SSL is crap
You still pay $20/month per domain for and SSL endpoint. Not including the cost of the certificate itself. I understand that there are technical limitations around this and there are costs for Heroku to recoup here which is why there is a cost but $20 per month seems extortionate.
On a recent bilingual (English/Welsh) project, we had to provision both the
.wales domain for a project and since you cannot provision more than one SSL domain per application had to use some workaround which apparently Heroku have been saying is now the 'official' solution, despite not being documented anywhere except StackOverflow.
On top of that, getting your DNS records to work with SSL on Heroku are even more of a pain.
Amazon Route 53 DOES NOT support Heroku and bare domains with SSL. Do not try it. It does not work. The only way you can do this is to use a DNS Provider that supports ALIAS records or CNAME flattening. The only free one I have so far found is Cloudflare and we use it for all of our projects.
SSL is the background of the secure web. Heroku need to do some serious work to make this less painful or SSL adoption will not be as fast as it otherwise should be.
If you don't mind someone else holding the private keys to your certificates, you can use the Cloudflare SSL without any issue.
Just one gripe.
Since Heroku have been acquired by Salesforce, their constant attempt at reaching to the 'Enterprise' market is exhausting and irritating.
Heroku is amazing because of it's pay-as-you-go attitude. You pay for what you use, no more, no less.
If you run a tiny blog, it'll cost you nothing, if you run a suite of applications with hundreds of millions of requests a day, it'll cost a bomb.
It's very sensible, but Heroku seems to be going the way of the dreaded
Contact Sales button. If you want any of their new features: Private spaces, static outbound IPs, user management, SSO, etc. then you have to sign up for an 'Enterprise' contract. I'm led to believe these start at $1000/month PLUS any resources that you use. When I suggested to their sales guy that this was ridiculous, he seemed oddly sympathetic as if he'd had 30 other developers that day say the same thing.
This irks me. It works out cheaper for us to create accounts for our clients, get them to be billed by Heroku directly and then invite the whole Substrakt team as collaborators on a project. Heroku should totally go after the 'enterprise' market, but not to the detrement of its core developer market.
Heroku is popular now, in no small part, due to developers like me who use it on a small hobby project and then recommend it to their bosses. If we don't have access to all of its features, then we cannot recommend it to anybody and I'm sure as hell not spending $1000+/month to evaluate something that might be a benefit to the company that I work for.