News for hackers. Stuff that matters.
Re:I left Heroku for OpsWorks and shaved 40% off response times by iagooar on Friday February 07, 2014 @04:38PM (#7198910)
While I can understand the advantages the author of the article mentions, I must say that one should think about making the move to OpsWorks, because you can't compare their prices without considering other costs / tradeoffs.

A friend of mine and I have been working on a startup for the last 8 months. It has been tough as we have been working full time for a company and hacking like crazy once we got home, or on weekends.

We chose to use Heroku because of the dead simple workflow that would allow us to spend time developing features instead of maintaining the infrastructure. This may sound like a cliché, but boy was it a good decision. The platform is rock solid, deployments are a bless and the add-on system is just one of the best time savers you can get.

We know OpsWorks (or earlier Scalarium) from our full-time job, and we know how cool it is. But we also know that it requires a lot of time and additional effort to keep things running.

This may pay off if you run a company which can afford it, but you should think about it twice if you have limited resources (and other, more important things to do!).

Even now, after we have launched, we still see no reason why we should move from Heroku to OpsWorks (or another platform). We have made some optimizations and clever (to us) decisions to avoid running into scalability problems. Maybe we will think about migrating once we get a ton more clients and even more traffic. It is cheaper to just add some dynos than spending time on server administration.

In the end, it's all about making the right decision, so don't hurry and if you think Heroku is too expensive for your business, maybe you are not making enough revenue from your customers. On the other hand, if you have the money and time, than go for it.

Re:I left Heroku for OpsWorks and shaved 40% off response times by nthj on Friday February 07, 2014 @05:07PM (#7199081)
I'd be really interested to know more about how the switch shaved 40% off of the response times. What was the major bottleneck? RAM? CPU? Network IO to PostgreSQL? Network IO to memcache?

Heroku is offering 2X and soon, 4X dynos; did he experiment with these?

The author also sounds rather excited about nginx serving static assets. The Rack::Cache problem on Heroku is easily solved with a CDN layer (and Heroku even recommends you do so.) (Cult Cosmetics /is/ set up with CloudFront, so the author obviously knows this.)

There are a lot of Rails architecture smells in this article, such as worrying about the 60-second boot timeout and the 30-second request timeout. [1] I have to wonder if the time invested in learning Chef and managing the architecture may have been spent making the app more performant.

Developer time is really, really expensive. Not only can you bill $100-$150 hour instead of learning how to use Chef, you could be shipping features for your own products, which can bring you passive income forever. A lot of companies are successfully running on Heroku, and it seems strange to throw everything out for the explained reasons.

[1] Specifically, adding 'require: false' to your Gemfile and only loading heavy libraries when you need them greatly helps with boot time. Ideally, you won't run any image processing libraries (like RMagick) except in background jobs, and your main app should not even need these libraries available. Same goes for PDF generation, scraping technology, or any other heavy processing.

The 30-second timeouts either need to be handled via background jobs (the author mentioned they use sidekiq) or uploading directly to S3, side-stepping the web process entirely.

Re:I left Heroku for OpsWorks and shaved 40% off response times by swrobel on Friday February 07, 2014 @05:12PM (#7199119)
I was using 2X dynos on Heroku. I did have memory issues and had to continually reduce the number of unicorns that I was running. I think CPU and disk were the major bottlenecks, but again, Heroku makes it hard to track down exactly what the cause is.

Also, we're an ecommerce site so we rely on a lot of external services (specifically for payments) where we have to run the call in the web process ... hence the issue with 30s timeouts.

Re:I left Heroku for OpsWorks and shaved 40% off response times by rguzman on Friday February 07, 2014 @06:52PM (#7199585)
> we have to run the call in the web process

I know you probably have good reason for this, but this smells like an architecture problem. Whenever you are talking to an external service it is a good idea to have your code laid out such that you can do that in the background. I understand that if you didn't plan enough architecture and maybe even product design to make that feasible from the get-go it is an expensive thing to build, but regardless of who is your hosting provider sooner or later you'll likely need to do it.

One thing I've always liked about heroku, at least in concept, is that it forces you to have good architecture. Some times it is a bit of a pain, but I think this pays off quicker than you seem to realize.

Re:I left Heroku for OpsWorks and shaved 40% off response times by joevandyk on Friday February 07, 2014 @08:59PM (#7199989)
How would you do payment processing in the background without temporarily storing the payment details?
Re:I left Heroku for OpsWorks and shaved 40% off response times by steveklabnik on Friday February 07, 2014 @09:19PM (#7200029)
I work for a payments company.

Generally, you use JavaScript to actually tokenize the card. You then save that token in your actual application, and then use it to actually charge against.

This model works just fine with background jobs.

Re:I left Heroku for OpsWorks and shaved 40% off response times by swrobel on Friday February 07, 2014 @07:35PM (#7199763)
valid point.
Re:I left Heroku for OpsWorks and shaved 40% off response times by thinkbohemian on Friday February 07, 2014 @05:40PM (#7199248)
I agree with the CDN comment. Please use a CDN to serve your assets no mater what you host on. It's so easy, and the performance gains to the end user are good, it should be an obvious choice.
Re:I left Heroku for OpsWorks and shaved 40% off response times by swrobel on Friday February 07, 2014 @05:44PM (#7199277)
Agree with both of you 100%, but the fact that Heroku forces this choice is a frustrating one nonetheless.
Re:I left Heroku for OpsWorks and shaved 40% off response times by Aqueous on Saturday February 08, 2014 @12:13AM (#7200354)
If companies think Heroku is more expensive they are failing to factor in how expensive it would be to have an employee to do all the work that Heroku takes off their plate. I work 45 - 50 hours a week developing. If I have to do devops - provisioning, deployment and system administration work - to maintain a server infrastructure there goes 15 - 20 hours! Surely my company is paying less to Heroku to manage that redundant, and at this point formulaic infrastructure than to me to do the same things that they've automated away. I can then work on our products. That seems less expensive, not more.
Re:I left Heroku for OpsWorks and shaved 40% off response times by grey-area on Saturday February 08, 2014 @09:03AM (#7201191)
Once you have done the setup once and have it all automated, it's more like 1 hour per week keeping on top of upgrades, backups etc. So for many people heroku is an expensive option, even when starting out. Nothing wrong with using it, but outsourcing your infrastructure does not come cheap, compared to other options like a VPS.
Re:I left Heroku for OpsWorks and shaved 40% off response times by Aqueous on Saturday February 08, 2014 @02:06PM (#7202151)
VPS is much more expensive because you have to do all the work to provision (either manually or automatically) the software stack you are working with, configure every new instance either, configure your deployment and testing pipeline using a CI server and using git hooks, and keep the whole edifice up and running. The time overhead is very large, and it ends up taking over as the major cost driver.
Re:I left Heroku for OpsWorks and shaved 40% off response times by grey-area on Saturday February 08, 2014 @03:06PM (#7202428)
Having done most of the steps you mention above for multile clients, I'd contend the time overhead is not very large - most things can be automated, and once that is done an extra instance is just a matter of spinning up a server and deploying - also you can scale a very long way on one or two instances when the hardware is beefy enough (e.g. this website), backup, deploy, testing can all be automated. There are definitely some situations where a service like Heroku or AWS makes a lot of sense, but it can get expensive very quickly; you're trading time to setup/manage for higher ongoing costs forever. VPS is cheaper but requires some setup. That's a trade-off each company has to evaluate individually given the talent and money they have.
Re:I left Heroku for OpsWorks and shaved 40% off response times by swrobel on Friday February 07, 2014 @04:45PM (#7198950)
Agree with most of what you say, but adding dynos increases concurrency but doesn't do anything to reduce response times. Sometimes you just need a faster box.
Re:I left Heroku for OpsWorks and shaved 40% off response times by thinkbohemian on Friday February 07, 2014 @05:48PM (#7199300)
Or a bigger (more RAM) box, I posted this to the Ruby Rouges mailing list on tail latencies: https://gist.github.com/schneems/8849116

Concurrency is only half the battle with tail latencies. Of course dedicated CPU helps as well :)

Re:I left Heroku for OpsWorks and shaved 40% off response times by swrobel on Friday February 07, 2014 @06:13PM (#7199409)
Good stuff schneems, in my case, too little, too late.
Re:I left Heroku for OpsWorks and shaved 40% off response times by thinkbohemian on Friday February 07, 2014 @06:41PM (#7199531)
Understood, can't be everything to every one. BTW thanks for sticking around and answering questions/engaging :)
Re:I left Heroku for OpsWorks and shaved 40% off response times by swrobel on Friday February 07, 2014 @07:36PM (#7199765)
gladly :)