Laravel Queues in Action (2nd edition) is now available!

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.

Hey! 👋 If you find this content useful, consider sponsoring me on GitHub.

You can also follow me on Twitter, I regularly post about all things Laravel including my latest video tutorials and blog posts.

By Mohamed Said

Hello! I'm a former Laravel core team member & VP of Engineering at Foodics. In this publication, I share everything I know about Laravel's core, packages, and tools.

You can find me on Twitter and Github.

This site was built using Wink. Follow the RSS Feed.