Hacker News new | ask | show | jobs
by leovingi 2390 days ago
Am I misunderstanding something here? Based on the AWS calculations on the Lambda pricing page, a single 256Mb Lambda would incur a cost of $2.7902232 per month, using "provisionedConcurrency: 1". Pushing it to 3008Mb, to get access to more processing power, makes that go up to $32.78 per month (EU London region). Compared to the standard way of warming it up by hitting the endpoint once every 5 minutes, which comes out to 8640 calls per month, which costs next to nothing.

Unless I am terribly mistaken, it doesn't seem like allowing AWS to handle this and not doing it in code (warmup plugin, cron job, etc.) is worth the cost.

4 comments

Pinging the lambda to keep it warm doesn’t do the same thing.

When you do that, it only keeps one instance warm. If you have 10 concurrent requests, even if one is warm, the other 9 requests will still experience a cold start.

The only way around this is to send a request that holds the connection open long enough to make sure concurrent requests start a new lambda instance. While you are keeping the request open, that lambda instance isn’t available for a real call.

If the entire purpose of lambda is to make things easier, once you start down the Rube Goldberg path of trying to keep enough instances warm, it kind of defeats the purpose. Just spend the money and the time to set up an autoscaling group of the smallest instances of EC2 or use Fargate if you don’t want the cold start times.

It really depends on how much a fast request is worth to you. With a manual ping, you can keep only one function alive. In the worst case you may actually block your existing function with that ping which causes another instance to be spawned for real requests (and experience slow startup there).

The timed pings are just a hack and don't solve all the issues.

Apparently you get a discount on the execution time for provisioned lambdas, not sure how much this would offset (the more actual utilization you get the better I guess)

> @ben11kehoe @kondro @mwarkentin You pay for the configured Provisioned Concurrency with a flat hourly charge. Lambda usage gets billed the same, but with a discount on unit pricing ($0.035/GB-hour vs $0.06 on "on demand").

http://twitter.com/ajaynairthinks/status/1202125357144391680

I am curious how, without actually invoking the function, lambda knows when your application has been initialized. Does it just run your application for a few seconds and then freeze it? Or does it not even run the application code, merely ensure the virtual machine is loaded into memory ready to be run? It seems a periodic warmer invocation at least has the advantage of ensuring your app is fully initialized and ready to respond to requests.