Skip to main content

Helper library to handle warming requests from X-Lambda (more:

Project description

X-Lambda Helper (Python version)

A Python library to help handle warm-up requests generated by X-Lambda.

X-Lambda predicts AWS Lambda demand and keeps a fleet of containers warm to mitigate cold-start latency. Warm invocations sent by X-Lambda are received by a Lambda function, which needs to respond accordingly.

This X-Lambda Helper project helps to handle warm invocations in Python functions.


Quick start

  1. Install X-Lambda Helper: pip install xlambda_helper.
  2. Decorate your Lambda handler following the example below:
  3. Deploy your code in AWS Lambda.

Usage example

import xlambda_helper

def handler(event, context):
    # Your original code goes here
    x_men = [
        {'Charles': 'Professor Xavier'},
        {'Logan': 'Wolverine'},
        {'Jean': 'Phoenix'},
        {'Scott': 'Cyclops'}

    return x_men


X-Lambda Helper will be executed every time your handler is invoked by AWS Lambda. It will check whether the invocation is a warming request coming from X-Lambda. If not, it will run your handler code normally. If yes, it will short-circuit to return a default answer and will not execute the handler function.

When handling warm requests, X-Lambda Helper will automatically adjust your function behavior:

  • Check whether it was a cold start
  • Sleep for a period of time, if needed
  • Defer to your original handler function, if invocation is not a warm request

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlambda_helper-0.0.31.tar.gz (3.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page