Mimicking daemon processes with serverless functions

By definition, serverless functions are short-lived and have a maximum lifetime before your platform of choice kills them. At the time of writing, the current limitation for an AWS Lambda function is 300 seconds (5 minutes) and the default 6 seconds. Our example relies on a long-lived process that is continually reading from the Twitter stream and publishing those results to the queue. How then can we accomplish this long-lived behavior with an inherently short-lived system?

To mimic a constantly-running process, we can take advantage of the scheduled invocation of Lambda functions. Other cloud providers should provide similar functionality. In short, we can use the maximum lifetime of ...

Get Serverless Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.