I built a hotel booking web application, serving 500k requests/month, 3000 daily users, 100-200 bookings/day, using AWS Serverless services which costs just ~$0.8/month to operate last year
Thanks for the write up, but those are awful cold start times. You'd be better off with Middy as opposed to Express and using Powertools for Lambda instead of New Relic.
Thanks a lot, middy is cool. From what I read it could be 10ms cold start, correct? I’ll do some POC and we’ll see. Powertools seem like a lot of works compared to what we’ve already had OOTB and built along the way with New Relic, so it’s for another day.
[Update] I could not find reliable source on middy cold start benchmark, but it seems like ~400ms for Lambda wrapper is a pretty normal standard? If I could choose again, I would still have chosen ExpressJS because it just eases the local development for most NodeJS developers.
Thanks, that's pretty optimized. My Lambda is using 512MB + NodeJS 18 setup, according to the benchmark at https://maxday.github.io/lambda-perf/, it should be around ~175ms, so middy is very optimized indeed.
I would probably start using middy for future Lambdas, but existing lamba should be fine with ~400ms using ExpressJS. So thanks a lot for your comments. (As I mentioned, my application is not sensitive to cold start, so it's not my biggest concern now, but yes, NewRelic makes cold start metrics look awful)
Hi, sorry for late reply. We use a 3rd party PMS to manage bookings (which handles overbooking). However, with DynamoDB, you can use Conditional Write to avoid overbooking.
Thanks. We design the application with DynamoDB in mind, so there’s no need for SQL DB. DynamoDB also supports transactions and strong consistency so I don’t expect to use SQL DB any time soon. But that’s a good questions.
Wow that is cool! I’ve always been doubting whether to fully use DynamoDB, now this make me more confident. Would love to see how you design the tables if you dont mind lol. Thanks anyway!
E mới xem podcast của a với Yan. Thấy rất quen hoá ra là anh Hiếu ở Lê Lợi. Cảm ơn a về bài viết, mong có thể contact với a để trao đổi thêm :D
Thanks for the write up, but those are awful cold start times. You'd be better off with Middy as opposed to Express and using Powertools for Lambda instead of New Relic.
Thanks a lot, middy is cool. From what I read it could be 10ms cold start, correct? I’ll do some POC and we’ll see. Powertools seem like a lot of works compared to what we’ve already had OOTB and built along the way with New Relic, so it’s for another day.
[Update] I could not find reliable source on middy cold start benchmark, but it seems like ~400ms for Lambda wrapper is a pretty normal standard? If I could choose again, I would still have chosen ExpressJS because it just eases the local development for most NodeJS developers.
I get under 200ms cold starts with middy. Try my aws cdk middy starter - https://github.com/AndrzejKomarnicki/awscdk-nodejsfunction-middy
It's setup for function url, but types are interchangeable with api gw v2. It also already comes with Idempotency support through powertools.
Thanks, that's pretty optimized. My Lambda is using 512MB + NodeJS 18 setup, according to the benchmark at https://maxday.github.io/lambda-perf/, it should be around ~175ms, so middy is very optimized indeed.
I would probably start using middy for future Lambdas, but existing lamba should be fine with ~400ms using ExpressJS. So thanks a lot for your comments. (As I mentioned, my application is not sensitive to cold start, so it's not my biggest concern now, but yes, NewRelic makes cold start metrics look awful)
Hi, how do you manage overbooking with DynamoDB?
Hi, sorry for late reply. We use a 3rd party PMS to manage bookings (which handles overbooking). However, with DynamoDB, you can use Conditional Write to avoid overbooking.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ConditionalUpdate
Hi, what will be the cost if we're not on Free Tier?
AWS Lambda and DynamoDB are currently always free.
Assuming AWS one day abandons always free tier for both Lambda and DynamoDB, then it’s probably $6/month
Great article! do you use other db for transactional data or just dynamodb?
Thanks. We design the application with DynamoDB in mind, so there’s no need for SQL DB. DynamoDB also supports transactions and strong consistency so I don’t expect to use SQL DB any time soon. But that’s a good questions.
Wow that is cool! I’ve always been doubting whether to fully use DynamoDB, now this make me more confident. Would love to see how you design the tables if you dont mind lol. Thanks anyway!