DEV Community

Discussion on: The Easiest Way to Run Microservices: Comparing AWS and Heroku

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.