4 ms·
I use API Gateway to provide an API endpoint powered by Lambda (and deployed via Serverless). It took a few hours to understand the relationships between Gatewa
by e1g 8y ago
I use API Gateway to provide an API endpoint powered by Lambda (and deployed via Serverless). It took a few hours to understand the relationships between Gateway and Lambda, the wire a custom domain names with HTTPS, but ones you understand its operating model it runs very well.
'Cold starts' is a complicated topic. AWS will keep your Lambda 'hot' for ~5 minutes since the last invocation - you are not paying for the 5 minutes, but it still sits in their RAM waiting for requests. This means that any request within 5 minutes of the last request does not pay the cold-start price. So I used Pingdom to monitor/ping the endpoint every 5 minutes, thus keeping one instance of the function perpetually 'hot'. Note that this hack will not work if you need high concurrency: you can only keep 1 instance alive. In practice, it's enough for us as one instance can serve most of the traffic in our case.
- catchmeifyoucan 8y agoI don't think it's too bad, about ~1s for a cold start. But let's say you serve your login page with Lambda, every request thereafter could be much faster because your function is no longer cold. 1 slow request, but chances are your user is making more than one, or usually it's a fire and forget like a form submission. https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f https://hackernoon.com/im-afraid-you-re-thinking-about-aws-l...
- e1g 8y agoGood article! It reflect my experience, but explains the tradeoffs and techniques very well.