DEV Community

Cover image for The Easiest Way to Run Microservices: Comparing AWS and Heroku

The Easiest Way to Run Microservices: Comparing AWS and Heroku

Jason Skowronski on April 25, 2019

It might be a truism, but the companies that perform the best are ones which execute the fastest and deliver the best customer experience. For deve...
Collapse
 
darcyrayner profile image
Darcy Rayner

This is a great article. Although, wouldn't AWS Lambda be a fairer comparison? You don't have to worry about configuring autoscaling, setting up apache, setting up the DNS, (apigateway does this for you, you can set up your own DNS if you need a custom URL), you skip all the VPC steps, (even with RDS which supports a HTTP API now). Using something like serverless framework is simple and pretty concise. It's also typically cheaper if you have an unpredictable load, because you pay per use, and don't have to over provision dynos. As for databases, with Aurora Serverless for RDS or Dynamo On Demand for NoSQL, you don't have to worry about autoscaling. I know they don't have a PHP environment for lambda,(although there are work arounds), which is the main thing that breaks the comparison. Does Heroku have a serverless offering?

Collapse
 
mostlyjason profile image
Jason Skowronski

Serverless functions are a great way to run microservices, depending on your team's needs. Serverless isn't exactly a direct comparison since Heroku offers dynos which support long-running processes and runs a full app or web server. It's more closely related to what you'd get on an EC2 instance or AWS Fargate. I figured EC2 is more widely used so I picked that for my comparison.

Lambda is geared more towards short running processes and has an execution limit of a few minutes, whereas a dyno runs continuously. This has some advantages for operations requiring more compute or high latency operations such as coordinating multiple service calls. You'll also run into fewer issues with warm up time, and is potentially lower cost for ongoing usage. It may also be quicker to port your existing service built on Django or Express to a dyno than rewrite it as as serverless function. Each team would have to consider which is best for their specific needs.

Yes Aurora Serverless and Dynamo are also great backend database options, again depending on your use case. You can call any database from Heroku so you can choose which you want to use. Traditional RDS is probably more widely used at the moment so that's why I used it for my comparison.

Collapse
 
raulc27 profile image
Raul Castro

Great article! I have my app directly attached github running on heroku, so I just push it and put focus on the private repo at github...

Collapse
 
bleidi profile image
Rafael "Bleidi" Souza

Nice article! Althougth is not fair to compare an Infraestructure-as-a-Service (Iaas) with a Plataform-as-a-Service (PaaS). I Aldo think ElasticBeanstalk could had made it fair.

Collapse
 
shenril profile image
Shenril • Edited

Thank you for the explanation!
I also feel this isn't really a fair comparison
AWS offers QuickStart or ElasticBeanstalk or Lambda that would cut in half the steps you're describing.

Collapse
 
johncmunson profile image
John Munson

Comparing to AWS Lambda would not be comparing apples to apples. The code would likely need to be modified to fit with the handler format that Lambda expects. There are cold starts to consider. The list goes on.

However, comparing to Beanstalk probably would’ve made sense.

Collapse
 
smakubi profile image
Samwel Emmanuel

Great article! Though I would caution readers on the onset that this is an apples to oranges comparison. Heroku is a PaaS, AWS is an IaaS.