Serverless: 15% slower & 8x more expensive
Context (read use case) is always the king when it comes to statements like this. Einar Egilsson of CardGames.io wanted to see if hosting their API using serverless framework made sense & gave it a go. Turns out that for some workloads serverless frameworks can get a lot more expensive than the old & traditional options.
He set up two instances to route requests for one of their games - one on the new serverless setup and another one on their old Beanstalk setup - to compare performance. Einar ran 100 requests (one database call per request) for both the setups and found the serverless setup to be 15% slower.
He was paying about $164.21 per month with the Beanstalk setup.The new serverless setup costed much more than what he expected. Their API accepts around 10 million requests a day which translated to about $35 per day, just for API Gateway. Add the Lambda cost of about $10 a day and he was at a cost of $45 per day or $1350 per month - about 8 times more than the $164 per month of the start state setup.
Two takeaways from this:
- Decide within the context. Stay away from blanket solutions. Use cases matter the most.
- The “Pay for what you use" always sounds like a cheaper option but you must always do the maths for your use case before making any switch.
6 min read