Skip to main content

Helper library to handle warming requests from X-Lambda (more: https://bit.ly/xlambda).

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.

Requirements

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


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

    return x_men

About

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.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xlambda_helper-0.0.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file xlambda_helper-0.0.3.tar.gz.

File metadata

  • Download URL: xlambda_helper-0.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for xlambda_helper-0.0.3.tar.gz
Algorithm Hash digest
SHA256 13845880eaa268dea4ee704ccb5e404a10bdeeddc06a5d716da200be9d15be92
MD5 4dff47b3f672967023a0ab506816d5c9
BLAKE2b-256 c1d1688d1558ef21f8a6b0abaf1244f696880618e0cb447a325c90c0e54e12fe

See more details on using hashes here.

File details

Details for the file xlambda_helper-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: xlambda_helper-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for xlambda_helper-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 94640b5d1837247431ecaa3f5b3216371615cd552601a15870049e88b6cf0479
MD5 e853202cb905577d967d5d76e3962067
BLAKE2b-256 8ab725fa39237c160cff2c2d06515103aa980ea1534718f44c284e92aea2fbb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page