{"id":13482694,"url":"https://github.com/awslabs/llrt","last_synced_at":"2025-05-14T08:05:12.969Z","repository":{"id":221477083,"uuid":"694161442","full_name":"awslabs/llrt","owner":"awslabs","description":"LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.","archived":false,"fork":false,"pushed_at":"2025-05-13T14:00:44.000Z","size":4584,"stargazers_count":8386,"open_issues_count":49,"forks_count":372,"subscribers_count":49,"default_branch":"main","last_synced_at":"2025-05-14T08:03:53.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awslabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-09-20T12:57:50.000Z","updated_at":"2025-05-13T14:00:39.000Z","dependencies_parsed_at":"2024-03-10T19:25:37.542Z","dependency_job_id":"da08645b-8b20-406a-b236-42fdb5a1aac5","html_url":"https://github.com/awslabs/llrt","commit_stats":null,"previous_names":["awslabs/llrt"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fllrt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fllrt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fllrt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Fllrt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awslabs","download_url":"https://codeload.github.com/awslabs/llrt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101588,"owners_count":22014907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:04.579Z","updated_at":"2025-05-14T08:05:12.936Z","avatar_url":"https://github.com/awslabs.png","language":"JavaScript","readme":"[![LLRT CI](https://github.com/awslabs/llrt/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/awslabs/llrt/actions/workflows/ci.yml) [![LLRT Release](https://github.com/awslabs/llrt/actions/workflows/release.yml/badge.svg)](https://github.com/awslabs/llrt/actions/workflows/release.yml)\n\nLLRT (**L**ow **L**atency **R**un**t**ime) is a lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications. LLRT offers up to over **10x** faster startup and up to **2x** overall lower cost compared to other JavaScript runtimes running on **AWS Lambda**\n\nIt's built in Rust, utilizing QuickJS as JavaScript engine, ensuring efficient memory usage and swift startup.\n\n\u003e [!WARNING]\n\u003e LLRT is an **experimental** package. It is subject to change and intended only for evaluation purposes.\n\n\u003csub\u003eLLRT - [DynamoDB Put, ARM, 128MB](example/functions/src/v3-lib.mjs):\u003csub\u003e\n![DynamoDB Put LLRT](./benchmarks/llrt-ddb-put.png \"LLRT DynamoDB Put\")\n\n\u003csub\u003eNode.js 20 - [DynamoDB Put, ARM, 128MB](example/functions/src/v3-lib.mjs):\u003csub\u003e\n![DynamoDB Put Node20](./benchmarks/node20-ddb-put.png \"Node20 DynamoDB Put\")\n\nHTTP benchmarks measured in **round trip time** for a cold start ([why?](#benchmark-methodology))\n\n## Configure Lambda functions to use LLRT\n\nDownload the last LLRT release from \u003chttps://github.com/awslabs/llrt/releases\u003e\n\n### Option 1: Custom runtime (recommended)\n\nChoose `Custom Runtime on Amazon Linux 2023` and package the LLRT `bootstrap` binary together with your JS code.\n\n### Option 2: Use a layer\n\nChoose `Custom Runtime on Amazon Linux 2023`, upload `llrt-lambda-arm64.zip` or `llrt-lambda-x64.zip` as a layer and add to your function\n\n### Option 3: Package LLRT in a container image\n\nSee our [AWS SAM example](./example/llrt-sam-container-image) or:\n\n```dockerfile\nFROM --platform=arm64 busybox\nWORKDIR /var/task/\nCOPY app.mjs ./\nADD https://github.com/awslabs/llrt/releases/latest/download/llrt-container-arm64 /usr/bin/llrt\nRUN chmod +x /usr/bin/llrt\n\nENV LAMBDA_HANDLER \"app.handler\"\n\nCMD [ \"llrt\" ]\n```\n\n### Option 4: AWS SAM\n\nThe following [example project](example/llrt-sam/) sets up a lambda\ninstrumented with a layer containing the llrt runtime.\n\n### Option 5: AWS CDK\n\nYou can use [`cdk-lambda-llrt` construct library](https://github.com/tmokmss/cdk-lambda-llrt) to deploy LLRT Lambda functions with AWS CDK.\n\n```ts\nimport { LlrtFunction } from \"cdk-lambda-llrt\";\n\nconst handler = new LlrtFunction(this, \"Handler\", {\n  entry: \"lambda/index.ts\",\n});\n```\n\nSee [Construct Hub](https://constructs.dev/packages/cdk-lambda-llrt/) and [its examples](https://github.com/tmokmss/cdk-lambda-llrt/tree/main/example) for more details.\n\nThat's it 🎉\n\n\u003e [!IMPORTANT]\n\u003e Even though LLRT supports [ES2023](https://262.ecma-international.org/14.0/) it's **NOT** a drop in replacement for Node.js. Consult [Compatibility matrix](#compatibility-matrix) and [API](API.md) for more details.\n\u003e All dependencies should be bundled for a `browser` platform and mark included `@aws-sdk` packages as external.\n\n## Testing \u0026 ensuring compatibility\n\nThe best way to ensure your code is compatible with LLRT is to write tests and execute them using the built-in test runner. The test runner currently supports Jest/Chai assertions. There are two main types of tests you can create:\n\nUnit Tests\n\n- Useful for validating specific modules and functions in isolation\n- Allow focused testing of individual components\n\nEnd-to-End (E2E) Tests\n\n- Validate overall compatibility with AWS SDK and WinterCG compliance\n- Test the integration between all components\n- Confirm expected behavior from end-user perspective\n\nFor more information about the E2E Tests and how to run them, see [here](tests/e2e/README.md).\n\n### Test runner\n\nTest runner uses a lightweight Jest-like API and supports Jest/Chai assertions. For examples on how to implement tests for LLRT see the `/tests` folder of this repository.\n\nTo run tests, execute the `llrt test` command. LLRT scans the current directory and sub-directories for files that ends with `*.test.js` or `*.test.mjs`. You can also provide a specific test directory to scan by using the `llrt test -d \u003cdirectory\u003e` option.\n\nThe test runner also has support for filters. Using filters is as simple as adding additional command line arguments, i.e: `llrt test crypto` will only run tests that match the filename containing `crypto`.\n\n## Compatibility matrix\n\n\u003e [!NOTE]\n\u003e LLRT only support a fraction of the Node.js APIs. It is **NOT** a drop in replacement for Node.js, nor will it ever be. Below is a high level overview of partially supported APIs and modules. For more details consult the [API](API.md) documentation\n\n| Modules        | Node.js | LLRT ⚠️ |\n| -------------- | ------- | ------- |\n| assert         | ✔︎     | ✔︎️    |\n| buffer         | ✔︎     | ✔︎️    |\n| child_process  | ✔︎     | ✔︎⏱   |\n| console        | ✔︎     | ✔︎     |\n| crypto         | ✔︎     | ✔︎     |\n| dns            | ✔︎     | ✔︎     |\n| events         | ✔︎     | ✔︎     |\n| fs/promises    | ✔︎     | ✔︎     |\n| fs             | ✔︎     | ✘⏱     |\n| http           | ✔︎     | ✘⏱\\*\\* |\n| https          | ✔︎     | ✘⏱\\*\\* |\n| net:sockets    | ✔︎     | ✔︎⏱   |\n| net:server     | ✔︎     | ✔︎     |\n| os             | ✔︎     | ✔︎     |\n| path           | ✔︎     | ✔︎     |\n| perf_hooks     | ✔︎     | ✔︎     |\n| process        | ✔︎     | ✔︎     |\n| streams        | ✔︎     | ✔︎\\*   |\n| string_decoder | ✔︎     | ✔︎     |\n| timers         | ✔︎     | ✔︎     |\n| tty            | ✔︎     | ✔︎     |\n| url            | ✔︎     | ✔︎     |\n| util           | ✔︎     | ✔︎     |\n| tls            | ✔︎     | ✘⏱     |\n| zlib           | ✔︎     | ✔︎     |\n| Other modules  | ✔︎     | ✘       |\n\n| Features    | Node.js | LLRT ⚠️ |\n| ----------- | ------- | ------- |\n| async/await | ✔︎     | ✔︎     |\n| encoding    | ✔︎     | ✔︎     |\n| fetch       | ✔︎     | ✔︎     |\n| ESM         | ✔︎     | ✔︎     |\n| CJS         | ✔︎     | ✔︎     |\n\n_⚠️ = partially supported in LLRT_\u003cbr /\u003e\n_⏱ = planned partial support_\u003cbr /\u003e\n_\\* = Not native_\u003cbr /\u003e\n_\\*\\* = Use fetch instead_\u003cbr /\u003e\n\n## Using node_modules (dependencies) with LLRT\n\nSince LLRT is meant for performance critical application it's not recommended to deploy `node_modules` without bundling, minification and tree-shaking.\n\nLLRT can work with any bundler of your choice. Below are some configurations for popular bundlers:\n\n\u003e [!WARNING]\n\u003e LLRT implements native modules that are largely compatible with the following external packages.\n\u003e By implementing the following conversions in the bundler's alias function, your application may be faster, but we recommend that you test thoroughly as they are not fully compatible.\n\n| Node.js         | LLRT      |\n| --------------- | --------- |\n| fast-xml-parser | llrt:xml  |\n| uuid            | llrt:uuid |\n\n### ESBuild\n\n```shell\nesbuild index.js --platform=browser --target=es2023 --format=esm --bundle --minify --external:@aws-sdk --external:@smithy\n```\n\n### Rollup\n\n```javascript\nimport resolve from \"@rollup/plugin-node-resolve\";\nimport commonjs from \"@rollup/plugin-commonjs\";\nimport terser from \"@rollup/plugin-terser\";\n\nexport default {\n  input: \"index.js\",\n  output: {\n    file: \"dist/bundle.js\",\n    format: \"esm\",\n    sourcemap: true,\n    target: \"es2023\",\n  },\n  plugins: [resolve(), commonjs(), terser()],\n  external: [\"@aws-sdk\", \"@smithy\"],\n};\n```\n\n### Webpack\n\n```javascript\nimport TerserPlugin from \"terser-webpack-plugin\";\nimport nodeExternals from \"webpack-node-externals\";\n\nexport default {\n  entry: \"./index.js\",\n  output: {\n    path: \"dist\",\n    filename: \"bundle.js\",\n    libraryTarget: \"module\",\n  },\n  target: \"web\",\n  mode: \"production\",\n  resolve: {\n    extensions: [\".js\"],\n  },\n  externals: [nodeExternals(), \"@aws-sdk\", \"@smithy\"],\n  optimization: {\n    minimize: true,\n    minimizer: [\n      new TerserPlugin({\n        terserOptions: {\n          ecma: 2023,\n        },\n      }),\n    ],\n  },\n};\n```\n\n## Using AWS SDK (v3) with LLRT\n\nLLRT includes many AWS SDK clients and utils as part of the runtime, built into the executable. These SDK Clients have been specifically fine-tuned to offer best performance while not compromising on compatibility. LLRT replaces some JavaScript dependencies used by the AWS SDK by native ones such as Hash calculations and XML parsing.\nV3 SDK packages not included in the list below have to be bundled with your source code. For an example on how to use a non-included SDK, see [this example build script (buildExternalSdkFunction)](example/functions/build.mjs)\n\nLLRT supports the following three bundles by default. Bundle types and suffixes are as follows.\n\n| Bundle Type | Suffix      | Purpose of Use                                            |\n| ----------- | ----------- | --------------------------------------------------------- |\n| no-sdk      | \\*-no-sdk   | Suitable for workloads that do not use `@aws-sdk`.        |\n| std-sdk     | (none)      | Suitable for workloads that utilize the major `@aws-sdk`. |\n| full-sdk    | \\*-full-sdk | Suitable for workloads that utilize any `@aws-sdk`.       |\n\nThe relationship between the supported packages for each bundle type is as follows.\n\n| Analytics                            | no-sdk | std-sdk | full-sdk |\n| ------------------------------------ | ------ | ------- | -------- |\n| @aws-sdk/client-athena               |        |         | ✔︎      |\n| @aws-sdk/client-firehose             |        |         | ✔︎      |\n| @aws-sdk/client-glue                 |        |         | ✔︎      |\n| @aws-sdk/client-kinesis              |        |         | ✔︎      |\n| @aws-sdk/client-opensearch           |        |         | ✔︎      |\n| @aws-sdk/client-opensearchserverless |        |         | ✔︎      |\n\n| Application integration     | no-sdk | std-sdk | full-sdk |\n| --------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-eventbridge |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-scheduler   |        |         | ✔︎      |\n| @aws-sdk/client-sfn         |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-sns         |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-sqs         |        | ✔︎     | ✔︎      |\n\n| Business applications | no-sdk | std-sdk | full-sdk |\n| --------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-ses   |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-sesv2 |        |         | ✔︎      |\n\n| Compute services             | no-sdk | std-sdk | full-sdk |\n| ---------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-auto-scaling |        |         | ✔︎      |\n| @aws-sdk/client-batch        |        |         | ✔︎      |\n| @aws-sdk/client-ec2          |        |         | ✔︎      |\n| @aws-sdk/client-lambda       |        |         | ✔︎      |\n\n| Containers                       | no-sdk | std-sdk | full-sdk |\n| -------------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-ecr              |        |         | ✔︎      |\n| @aws-sdk/client-ecs              |        |         | ✔︎      |\n| @aws-sdk/client-eks              |        |         | ✔︎      |\n| @aws-sdk/client-servicediscovery |        |         | ✔︎      |\n\n| Databases                        | no-sdk | std-sdk | full-sdk |\n| -------------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-dynamodb         |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-dynamodb-streams |        |         | ✔︎      |\n| @aws-sdk/client-elasticache      |        |         | ✔︎      |\n| @aws-sdk/client-rds              |        |         | ✔︎      |\n| @aws-sdk/client-rds-data         |        |         | ✔︎      |\n\n| Developer tools      | no-sdk | std-sdk | full-sdk |\n| -------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-xray |        | ✔︎     | ✔︎      |\n\n| Front-end web and mobile services | no-sdk | std-sdk | full-sdk |\n| --------------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-amplify           |        |         | ✔︎      |\n| @aws-sdk/client-appsync           |        |         | ✔︎      |\n| @aws-sdk/client-location          |        |         | ✔︎      |\n\n| Machine Learning (ML) and Artificial Intelligence (AI) | no-sdk | std-sdk | full-sdk |\n| ------------------------------------------------------ | ------ | ------- | -------- |\n| @aws-sdk/client-bedrock                                |        |         | ✔︎      |\n| @aws-sdk/client-bedrock-runtime                        |        |         | ✔︎      |\n| @aws-sdk/client-bedrock-agent                          |        |         | ✔︎      |\n| @aws-sdk/client-bedrock-agent-runtime                  |        |         | ✔︎      |\n| @aws-sdk/client-polly                                  |        |         | ✔︎      |\n| @aws-sdk/client-rekognition                            |        |         | ✔︎      |\n| @aws-sdk/client-textract                               |        |         | ✔︎      |\n| @aws-sdk/client-translate                              |        |         | ✔︎      |\n\n| Management and governance         | no-sdk | std-sdk | full-sdk |\n| --------------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-appconfig         |        |         | ✔︎      |\n| @aws-sdk/client-appconfigdata     |        |         | ✔︎      |\n| @aws-sdk/client-cloudformation    |        |         | ✔︎      |\n| @aws-sdk/client-cloudwatch        |        |         | ✔︎      |\n| @aws-sdk/client-cloudwatch-events |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-cloudwatch-logs   |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-service-catalog   |        |         | ✔︎      |\n| @aws-sdk/client-ssm               |        | ✔︎     | ✔︎      |\n\n| Media                        | no-sdk | std-sdk | full-sdk |\n| ---------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-mediaconvert |        |         | ✔︎      |\n\n| Networking and content delivery           | no-sdk | std-sdk | full-sdk |\n| ----------------------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-api-gateway               |        |         | ✔︎      |\n| @aws-sdk/client-apigatewayv2              |        |         | ✔︎      |\n| @aws-sdk/client-elastic-load-balancing-v2 |        |         | ✔︎      |\n\n| Security, identity, and compliance        | no-sdk | std-sdk | full-sdk |\n| ----------------------------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-acm                       |        |         | ✔︎      |\n| @aws-sdk/client-cognito-identity          |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-cognito-identity-provider |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-iam                       |        |         | ✔︎      |\n| @aws-sdk/client-kms                       |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-secrets-manager           |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-sso                       |        |         | ✔︎      |\n| @aws-sdk/client-sso-admin                 |        |         | ✔︎      |\n| @aws-sdk/client-sso-oidc                  |        |         | ✔︎      |\n| @aws-sdk/client-sts                       |        | ✔︎     | ✔︎      |\n| @aws-sdk/client-verifiedpermissions       |        |         | ✔︎      |\n\n| Storage             | no-sdk | std-sdk | full-sdk |\n| ------------------- | ------ | ------- | -------- |\n| @aws-sdk/client-efs |        |         | ✔︎      |\n| @aws-sdk/client-s3  |        | ✔︎     | ✔︎      |\n\n| Other bundled packages           | no-sdk | std-sdk | full-sdk |\n| -------------------------------- | ------ | ------- | -------- |\n| @aws-crypto                      |        | ✔︎     | ✔︎      |\n| @aws-sdk/credential-providers    |        | ✔︎     | ✔︎      |\n| @aws-sdk/lib-dynamodb            |        | ✔︎     | ✔︎      |\n| @aws-sdk/lib-storage             |        | ✔︎     | ✔︎      |\n| @aws-sdk/s3-presigned-post       |        | ✔︎     | ✔︎      |\n| @aws-sdk/s3-request-presigner    |        | ✔︎     | ✔︎      |\n| @aws-sdk/util-dynamodb           |        | ✔︎     | ✔︎      |\n| @aws-sdk/util-user-agent-browser |        | ✔︎     | ✔︎      |\n| @smithy                          |        | ✔︎     | ✔︎      |\n\n\u003e [!IMPORTANT]\n\u003e LLRT currently does not support returning streams from SDK responses. Use `response.Body.transformToString();` or `response.Body.transformToByteArray();` as shown below.\n\u003e\n\u003e ```javascript\n\u003e const response = await client.send(command);\n\u003e // or 'transformToByteArray()'\n\u003e const str = await response.Body.transformToString();\n\u003e ```\n\n## Running TypeScript with LLRT\n\nSame principle as dependencies applies when using TypeScript. TypeScript must be bundled and transpiled into ES2023 JavaScript.\n\n\u003e [!NOTE]\n\u003e LLRT will not support running TypeScript without transpilation. This is by design for performance reasons. Transpiling requires CPU and memory that adds latency and cost during execution. This can be avoided if done ahead of time during deployment.\n\n## Rationale\n\nWhat justifies the introduction of another JavaScript runtime in light of existing options such as [Node.js](https://nodejs.org/en), [Bun](https://bun.sh) \u0026 [Deno](https://deno.com/)?\n\nNode.js, Bun, and Deno represent highly proficient JavaScript runtimes. However, they are designed with general-purpose applications in mind. These runtimes were not specifically tailored for the demands of a Serverless environment, characterized by short-lived runtime instances. They each depend on a ([Just-In-Time compiler (JIT)](https://en.wikipedia.org/wiki/Just-in-time_compilation) for dynamic code compilation and optimization during execution. While JIT compilation offers substantial long-term performance advantages, it carries a computational and memory overhead.\n\nIn contrast, LLRT distinguishes itself by not incorporating a JIT compiler, a strategic decision that yields two significant advantages:\n\nA) JIT compilation is a notably sophisticated technological component, introducing increased system complexity and contributing substantially to the runtime's overall size.\n\nB) Without the JIT overhead, LLRT conserves both CPU and memory resources that can be more efficiently allocated to code execution tasks, thereby reducing application startup times.\n\n## Limitations\n\nThere are many cases where LLRT shows notable performance drawbacks compared with JIT-powered runtimes, such as large data processing, Monte Carlo simulations or performing tasks with hundreds of thousands or millions of iterations. LLRT is most effective when applied to smaller Serverless functions dedicated to tasks such as data transformation, real time processing, AWS service integrations, authorization, validation etc. It is designed to complement existing components rather than serve as a comprehensive replacement for everything. Notably, given its supported APIs are based on Node.js specification, transitioning back to alternative solutions requires minimal code adjustments.\n\n## Building from source\n\n1. Clone code and cd to directory\n\n```\ngit clone git@github.com:awslabs/llrt.git\ncd llrt\n```\n\n2. Install git submodules\n\n```\ngit submodule update --init --checkout\n```\n\n3. Install rust\n\n```\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y\nsource \"$HOME/.cargo/env\"\n```\n\n4. Install dependencies\n\n```\n# MacOS\nbrew install zig make cmake zstd node corepack\n\n# Ubuntu\nsudo apt -y install make zstd\nsudo snap install zig --classic --beta\n\n# Windows WSL2 (requires systemd to be enabled*)\nsudo apt -y install cmake g++ gcc make zip zstd\nsudo snap install zig --classic --beta\n\n# Windows WSL2 (If Node.js is not yet installed)\nsudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash\nnvm install --lts\n```\n\n_\\* See [Microsoft Devblogs](https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/#how-can-you-get-systemd-on-your-machine)_\n\n5. Install Node.js packages\n\n```\ncorepack enable\nyarn\n```\n\n6. Install generate libs and setup rust targets \u0026 toolchains\n\n```\nmake stdlib \u0026\u0026 make libs\n```\n\n\u003e [!NOTE]\n\u003e If these commands exit with an error that says `can't cd to zstd/lib`,\n\u003e you've not cloned this repository recursively. Run `git submodule update --init` to download the submodules and run the commands above again.\n\n7. Build binaries for Lambda (Per bundle type and architecture desired)\n\n```\n# for arm64, use\nmake llrt-lambda-arm64.zip\nmake llrt-lambda-arm64-no-sdk.zip\nmake llrt-lambda-arm64-full-sdk.zip\n# or for x86-64, use\nmake llrt-lambda-x64.zip\nmake llrt-lambda-x64-no-sdk.zip\nmake llrt-lambda-x64-full-sdk.zip\n```\n\n8. Build binaries for Container (Per bundle type and architecture desired)\n\n```\n# for arm64, use\nmake llrt-container-arm64\nmake llrt-container-arm64-no-sdk\nmake llrt-container-arm64-full-sdk\n# or for x86-64, use\nmake llrt-container-x64\nmake llrt-container-x64-no-sdk\nmake llrt-container-x64-full-sdk\n```\n\n9. Optionally build for your local machine (Mac or Linux)\n\n```\nmake release\nmake release-no-sdk\nmake release-full-sdk\n```\n\nYou should now have a `llrt-lambda-arm64*.zip` or `llrt-lambda-x64*.zip`. You can manually upload this as a Lambda layer or use it via your Infrastructure-as-code pipeline\n\n## Running Lambda emulator\n\nPlease note that in order to run the example you will need:\n\n- Valid AWS credentials via a `~/.aws/credentials` or via environment variables.\n\n```bash\nexport AWS_ACCESS_KEY_ID=XXX\nexport AWS_SECRET_ACCESS_KEY=YYY\nexport AWS_REGION=us-east-1\n```\n\n- A DynamoDB table (with `id` as the partition key) on `us-east-1`\n- The `dynamodb:PutItem` IAM permission on this table. You can use this policy (don't forget to modify \u003cYOUR_ACCOUNT_ID\u003e):\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"putItem\",\n      \"Effect\": \"Allow\",\n      \"Action\": \"dynamodb:PutItem\",\n      \"Resource\": \"arn:aws:dynamodb:us-east-1:\u003cYOUR_ACCOUNT_ID\u003e:table/quickjs-table\"\n    }\n  ]\n}\n```\n\nStart the `lambda-server.js` in a separate terminal\n\n    node lambda-server.js\n\nThen run llrt:\n\n    make run\n\n## Environment Variables\n\n### `LLRT_EXTRA_CA_CERTS=file`\n\nLoad extra certificate authorities from a PEM encoded file\n\n### `LLRT_GC_THRESHOLD_MB=value`\n\nSet a memory threshold in MB for garbage collection. Default threshold is 20MB\n\n### `LLRT_HTTP_VERSION=value`\n\nExtends the HTTP request version. By default, only HTTP/1.1 is enabled. Specifying '2' will enable HTTP/1.1 and HTTP/2.\n\n### `LLRT_LOG=[target][=][level][,...]`\n\nFilter the log output by target module, level, or both (using `=`). Log levels are case-insensitive and will also enable any higher priority logs.\n\nLog levels in descending priority order:\n\n- `Error`\n- `Warn | Warning`\n- `Info`\n- `Debug`\n- `Trace`\n\nExample filters:\n\n- `warn` will enable all warning and error logs\n- `llrt_core::vm=trace` will enable all logs in the `llrt_core::vm` module\n- `warn,llrt_core::vm=trace` will enable all logs in the `llrt_core::vm` module and all warning and error logs in other modules\n\n### `LLRT_NET_ALLOW=\"host[ ...]\"`\n\nSpace-delimited list of hosts or socket paths which should be allowed for network connections. Network connections will be denied for any host or socket path missing from this list. Set an empty list to deny all connections\n\n### `LLRT_NET_DENY=\"host[ ...]\"`\n\nSpace-delimited list of hosts or socket paths which should be denied for network connections\n\n### `LLRT_NET_POOL_IDLE_TIMEOUT=value`\n\nSet a timeout in seconds for idle sockets being kept-alive. Default timeout is 15 seconds\n\n### `LLRT_PLATFORM=value`\n\nUsed to explicitly specify a preferred platform for the Node.js package resolver. The default is `browser`. If `node` is specified, \"node\" takes precedence in the search path. If a value other than `browser` or `node` is specified, it will behave as if \"browser\" was specified.\n\n### `LLRT_TLS_VERSION=value`\n\nSet the TLS version to be used for network connections. By default only TLS 1.2 is enabled. TLS 1.3 can also be enabled by setting this variable to `1.3`\n\n## Benchmark Methodology\n\nAlthough Init Duration [reported by Lambda](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html) is commonly used to understand cold start impact on overall request latency, this metric does not include the time needed to copy code into the Lambda sandbox.\n\nThe technical definition of Init Duration ([source](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-logging.html#node-logging-output)):\n\n\u003e For the first request served, the amount of time it took the runtime to load the function and run code outside of the handler method.\n\nMeasuring round-trip request duration provides a more complete picture of user facing cold-start latency.\n\nLambda invocation results (λ-labeled row) report the sum total of Init Duration + Function Duration.\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis library is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file.\n","funding_links":[],"categories":["Rust","JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Fllrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawslabs%2Fllrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Fllrt/lists"}