{ "info": { "author": "Rob Howley", "author_email": "howley.robert@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "[![PyPI version](https://badge.fury.io/py/lambda-warmer-py.svg)](https://badge.fury.io/py/lambda-warmer-py)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# lambda-warmer-py: taking care of aws lambda cold starts\nThe `lambda-warmer-py` package contains a single decorator that makes it easy to minimize the drag of aws lambda cold \nstarts. Just ...\n\n 1. wrap your lambdas in the `@lambdawarmer.warmer` decorator and\n 2. ping your lambda once every 5 minutes\n\nand you'll cut your cold starts way down. \n\nConfiguration options are also available that ...\n* allow for keeping many *concurrent* lambdas warm\n* sending [CloudWatch metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/working_with_metrics.html) \n tracking the number of cold and warm starts by lambda function name \n\nThe warming logic is a python adaption* of the `js` [package](https://github.com/jeremydaly/lambda-warmer), `lambda-warmer`. Read more about the background to this approach on his site [here](https://www.jeremydaly.com/lambda-warmer-optimize-aws-lambda-function-cold-starts/)\nand some best practices on lambda optimization [here](https://www.jeremydaly.com/15-key-takeaways-from-the-serverless-talk-at-aws-startup-day/).\n\n\\* In addition to supporting CloudWatch Metrics, there are some small differences in parameterization. See [configuration](#configuration).\n\n\n## Install\n\n```bash\npip install lambda-warmer-py\n```\n\n## Using the lambda warmer\n\n### The basics\nIncorporating the lambda warmer into your existing lambdas only requires adding a single decorator.\n```python\nimport lambdawarmer\n\n\n@lambdawarmer.warmer()\ndef your_lambda_function(event, context):\n pass\n```\n\n### Concurrent warming\nTo leverage the concurrency options, the package will invoke your lambda multiple times. This means that the deployed\nlambda will need the following permissions\n```yaml\n- Effect: Allow\n Action: lambda:InvokeFunction\n Resource: [your-lambdas-arn]\n```\n\n### Enabling ColdStart/WarmStart CloudWatch Metrics\nIn order for the lambda warmer to track cold and warm start metrics, the lambda execution role will need permissions\nto send metric data to CloudWatch. The required policy action is \n```yaml\n- Effect: Allow\n Action: cloudwatch:PutMetricData\n```\n\n## Warming your lambdas\nCreate a [CloudWatch Rule](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html) that \nperiodically invokes your lambda directly and passes the following json as the event\n```python\n{\n \"warmer\": true,\n \"concurrency\": (int, defaults to 1)\n}\n```\nIt is possible to change the `warmer` and `concurrency` names by overriding parameters in the `warmer` decorator. See\n[configuration](#configuration) for details.\n\n## Configuration\nThe lambda warmer is configured via the function parameters for the `@warmer` decorator. It takes the following ...\n\n### `flag (string, default = 'warmer')`\nName of the field used to indicate that it is a warm up event.\n\n### `concurrency (string, default = 'concurrency')`\nName of the field used to set the number of concurrent lambdas to invoke and keep warm.\n\n### `delay (int, default = 75)`\nNumber of millis a concurrent warm up invocation should sleep. This helps avoid under delivering on\n the concurrency target.\n\n### `send_metric (bool, default = False)`\nWhether or not CloudWatch Metrics for the number of cold/warm starts will be sent at each invocation. The metrics names\nare `ColdStart` and `WarmStart`, are recorded under `LambdaWarmer` namespace, and can be filtered by lambda function name.\n\n#### Example: warmer configuration overrides\nUsing alternative event and delay configurations is straightforward.\n```python\n@lambdawarmer.warmer(flag='am_i_a_warmer', concurrency='how_many_lambdas', delay=150)\ndef your_lambda_function(event, context):\n pass\n```\nThis implementation will expect events of the form\n```python\n{\"am_i_a_warmer\": true, \"how_many_lambdas\": (int)}\n```\nand all concurrent executions will delay for 150 milliseconds.\n\n#### Example: sending metrics\nIf you want to track metrics on number of warm/cold starts activate that functionality in the decorator.\n```python\n@lambdawarmer.warmer(send_metric=True)\ndef your_lambda_function(event, context):\n pass\n```\n\n*Note*: Configuration options that are *excluded* from this implementation but can be found in the `js` version are \n* `test`: Testing is handled in the unittests using mocks/fakes instead of flagged invocations\n* `log`: Logging levels of imported python packages should be handled via the stdlib `logging` module. \n* `correlationId`. This has been made into the snake cased `correlation_id` since we're in python and is always set to \nthe current lambda's `aws_request_id` field as is recommended in the original `lambda-warmer` package.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/robhowley/lambda-warmer-py", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "lambda-warmer-py", "package_url": "https://pypi.org/project/lambda-warmer-py/", "platform": "", "project_url": "https://pypi.org/project/lambda-warmer-py/", "project_urls": { "Homepage": "https://github.com/robhowley/lambda-warmer-py" }, "release_url": "https://pypi.org/project/lambda-warmer-py/0.5.0/", "requires_dist": null, "requires_python": "", "summary": "keep lambdas warm and monitor cold starts with a simple decorator", "version": "0.5.0" }, "last_serial": 5882506, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "794ed38dd586b387a61b1a47779dca38", "sha256": "b0ed1e0f99736fc7d4042aaa98222900801a54bdea062c06c8123ef8a10e7807" }, "downloads": -1, "filename": "lambda_warmer_py-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "794ed38dd586b387a61b1a47779dca38", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4924, "upload_time": "2019-02-27T03:49:30", "url": "https://files.pythonhosted.org/packages/fb/83/0012c4223d1b4e75ffc5a4817982168afe0b10d19e2e3abe0b0c18a28118/lambda_warmer_py-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3e6d082eee573b5916752e9704992c0b", "sha256": "50b390c4f43621243df81c1f08ad6b84099f07ff342a8b692ecab8cdc9b72bf3" }, "downloads": -1, "filename": "lambda-warmer-py-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3e6d082eee573b5916752e9704992c0b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3173, "upload_time": "2019-02-27T03:49:31", "url": "https://files.pythonhosted.org/packages/ca/02/5d66c1c3a5585a9300538d898e0d4909f720930dca0ce78aa6f4cac2c2f9/lambda-warmer-py-0.1.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "05b37004ae3d5c3ca80f361e2ab08611", "sha256": "2452605f2d16b2dc77bdd295380f1ffe3e5db45cfb6de221d865ccb95b374f6c" }, "downloads": -1, "filename": "lambda_warmer_py-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "05b37004ae3d5c3ca80f361e2ab08611", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6580, "upload_time": "2019-02-27T20:02:39", "url": "https://files.pythonhosted.org/packages/0b/b9/88d05ddac58754726159d883adf6c77d092be9d70912b19073b36e183a04/lambda_warmer_py-0.2.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "afab94302e866747f880c693dad7cb96", "sha256": "e44a07cec41a416dcfb6cd421305ac0f1130f721f9024b5c857510e8ad65073b" }, "downloads": -1, "filename": "lambda-warmer-py-0.2.1.tar.gz", "has_sig": false, "md5_digest": "afab94302e866747f880c693dad7cb96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5648, "upload_time": "2019-02-27T20:02:41", "url": "https://files.pythonhosted.org/packages/db/0c/867bdd0df6e15a27868afe771ba0fbef4a0fe30447553a5684690b57d506/lambda-warmer-py-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "b379ac0a1096a619d46940d30ac4647c", "sha256": "9b33280092bd86f014c01814c6160342fe3cb3b3fac32c494c5209bb73d9774d" }, "downloads": -1, "filename": "lambda_warmer_py-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "b379ac0a1096a619d46940d30ac4647c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6640, "upload_time": "2019-04-03T01:36:05", "url": "https://files.pythonhosted.org/packages/fa/2a/1c6b2fa4e4c380f569b8194ee75ec4dc4a97361a0318200f21da7b21b3fb/lambda_warmer_py-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5d630f0e1348f07c9e83ec81aa055b1d", "sha256": "7911695ed6e359d2568ae5ea7802b3aa05d2e271eedb20ea624d94e3b8d7f158" }, "downloads": -1, "filename": "lambda-warmer-py-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5d630f0e1348f07c9e83ec81aa055b1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5709, "upload_time": "2019-04-03T01:36:08", "url": "https://files.pythonhosted.org/packages/f7/02/bee1f2410cbdd07e817bd0a60ca525f4084e11e5577bda16ee10326cdeb5/lambda-warmer-py-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "af9e3cbdd95d4d9fd2f1d04c713d2d3f", "sha256": "015de9db2bde15dc831940473d5830614d3b90bddb9c57adfdafd69812603158" }, "downloads": -1, "filename": "lambda_warmer_py-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "af9e3cbdd95d4d9fd2f1d04c713d2d3f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7462, "upload_time": "2019-04-29T13:31:22", "url": "https://files.pythonhosted.org/packages/f3/83/73d7782281a8b17617977c98a43ab1a58e82cad60073a11d5f7c12b4cc9f/lambda_warmer_py-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "35f28c12ec2241a748361bc501e8ff88", "sha256": "d6fb417c128277603fb43a6ff7daf4c46e43955b86a117cfdcfc70dafb3299e8" }, "downloads": -1, "filename": "lambda-warmer-py-0.3.1.tar.gz", "has_sig": false, "md5_digest": "35f28c12ec2241a748361bc501e8ff88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5713, "upload_time": "2019-04-29T13:31:35", "url": "https://files.pythonhosted.org/packages/23/c9/1d44a67fb068b0096b37111977eb8772c0e041f8d646369a06bab589c0b8/lambda-warmer-py-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "71dc9bf0a70ff312729d5bdeb6644478", "sha256": "6f681c76c4f831fef94803a0ac61c76fe19d2cf39070a5e51dcc40c7435a9f7a" }, "downloads": -1, "filename": "lambda_warmer_py-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "71dc9bf0a70ff312729d5bdeb6644478", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7578, "upload_time": "2019-08-15T22:57:29", "url": "https://files.pythonhosted.org/packages/86/2c/e22d4b67892010642bf57f9eb57a87af86464859e766d3bb3e1e8cb4e349/lambda_warmer_py-0.4.0-py3-none-any.whl" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "e7dbfc545048b458c9cb257348444241", "sha256": "a5b5078748eeccf9d098a70ddac6fb3625be519695419c213483a6a028337426" }, "downloads": -1, "filename": "lambda_warmer_py-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e7dbfc545048b458c9cb257348444241", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7629, "upload_time": "2019-09-25T00:37:54", "url": "https://files.pythonhosted.org/packages/6e/87/b3dcf97d98e777334e9b615110d350b3e987eb5d1b77e550bccb7f3cd7b2/lambda_warmer_py-0.5.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e7dbfc545048b458c9cb257348444241", "sha256": "a5b5078748eeccf9d098a70ddac6fb3625be519695419c213483a6a028337426" }, "downloads": -1, "filename": "lambda_warmer_py-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e7dbfc545048b458c9cb257348444241", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7629, "upload_time": "2019-09-25T00:37:54", "url": "https://files.pythonhosted.org/packages/6e/87/b3dcf97d98e777334e9b615110d350b3e987eb5d1b77e550bccb7f3cd7b2/lambda_warmer_py-0.5.0-py3-none-any.whl" } ] }