Laravel Vapor: When to use a Load Balancer

Updated: Aug 22, 2019 — 1 min Read#vapor

By default, Laravel Vapor configures your lambda function to use AWS's API Gateway; which is a service that allows you to manage traffic from the internet to your different AWS resources.

The great thing about API Gateway is that it follows the pay-as-you-go model, you only pay for the number of requests your application receives. If the application receives no traffic you simply pay nothing at all. Also if you're on AWS free tier you get your first 1 million requests for free!

The price for using API Gateway is $3.5 per million requests for the first 333 million requests, which makes it a perfect solution for applications that don't get very high traffic.

However, for applications that receive more than 6 million requests per month constantly, the pay-as-you go model doesn't really work. For this, Laravel Vapor allows you to provision a Load Balancer where you pay AWS a flat rate for every hour the Load Balancer is up ($17/month roughly) + charges for something they call (Load Balancer Capacity Units) and you can receive any number of requests.

The good thing is, you can use the same Load Balancer with multiple Vapor projects and you still pay the flat rate + LCU charges.

I'd personally use API Gateway for a while until I have a rough figure of the costs based on the usage of my application, if the application receive high traffic then using a Load Balancer would be more cost effective.

By Mohamed Said

Hello! I'm a web developer, cyclist, runner, swimmer, and freediver. Nice to meet you! I currently work at Laravel. You can find me on Twitter, Github, and Strava. You can also check my blog.

Join Our Mailing List

If you like this article, you may want to consider joining our mailing list to receive new content once it is posted.
This site was built using Wink. Follow the RSS Feed.