---
title: "Squeezing every millisecond: How we rebuilt the Datadog Lambda Extension in Rust"
description: "Datadog rewrote its AWS Lambda Extension from a Go build of the full Datadog Agent into a purpose-built Rust sidecar (Project Bottlecap), cutting cold start overhead from about 450 ms to 70 ms, memory from 128 MiB to 77 MiB, and binary size from 55 MB to 7 MB."
url: "https://swe.quest/articles/squeezing-every-millisecond-how-we-rebuilt-the-datadog-lambda-extension-in-rust-c788e8ecc0f0b212"
canonical: "https://www.datadoghq.com/blog/engineering/datadog-lambda-extension-rust/"
source: "Datadog Engineering"
published: "2025-04-09"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["serverless","rust","performance","observability","refactoring"]
---

# Squeezing every millisecond: How we rebuilt the Datadog Lambda Extension in Rust

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2025-04-09, 9 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/datadog-lambda-extension-rust/](https://www.datadoghq.com/blog/engineering/datadog-lambda-extension-rust/)

## Summary

Datadog rewrote its AWS Lambda Extension from a Go build of the full Datadog Agent into a purpose-built Rust sidecar (Project Bottlecap), cutting cold start overhead from about 450 ms to 70 ms, memory from 128 MiB to 77 MiB, and binary size from 55 MB to 7 MB. The team benchmarked every PR against cold start overhead and hand-wrote AWS API calls and signatures instead of using SDKs. To cover both API-style and batch workloads, the extension supports configurable flush strategies: flushing at the end of an invocation, racing it, flushing periodically, or combining these. Rollout used a roughly 4 ms startup check that fails over to the bundled legacy extension when it detects unsupported configurations, with telemetry on fallbacks guiding which features to support next.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)

## Prerequisites

- AWS Lambda execution lifecycle ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))
- Lambda extensions API ([easy posts on Serverless](https://swe.quest/tags/serverless.md?difficulty=easy))

## Keywords

AWS Lambda, Datadog Lambda Extension, Project Bottlecap, Datadog Agent, Rust, Go

## Related posts

- [Benchmarking AWS Lambda Cold Starts Across JavaScript Runtimes](https://swe.quest/articles/benchmarking-aws-lambda-cold-starts-across-javascript-runtimes-7eb1f21624996f8c.md): Deno · 2024-07-25 · Medium · 8 min read · Serverless, Performance engineering, Runtimes & VMs, JavaScript
  Across Express, Fastify and Hono URL-shortener apps deployed to AWS Lambda via Docker and the Lambda Web Adapter, Deno 1.45 showed lower cold-start Init Duration than Node 22 and Bun 1.1, with the Lambda-managed Node runtime included as a reference.
- [How to Migrate from AWS Lambda to Railway](https://swe.quest/articles/how-to-migrate-from-aws-lambda-to-railway-e94376caa43bd890.md): Railway · 2024-12-13 · Medium · 5 min read · Serverless, Containers, Cloud platforms, Deployment
  An AWS Lambda function can be moved to Railway by packaging it as a container image built on the AWS Lambda Node.js base image and pushing it to Docker Hub.
- [Deno 1.20 Release Notes](https://swe.quest/articles/deno-1-20-release-notes-bca0b4c539f63df8.md): Deno · 2022-03-17 · Medium · 12 min read · JavaScript, Runtimes & VMs, Performance engineering, Developer tools, Rust
  Deno 1.20 cuts JavaScript-to-Rust op call overhead by up to ~60% by using Rust proc macros to generate a dedicated V8 binding per op, eliminating op routing and skipping deserialization of unused arguments; a 1 MB base64 roundtrip drops from ~125 ms to ~3.3 ms. The release also adds automatic gzip/brotli compression of non-streamed HTTP responses, an unstable \`deno bench\` subcommand (1000 warmup plus 1000 measured iterations by default), and a cross-platform \`deno task\` runner using a POSIX-like shell subset.
- [How to build a 30M RPS CDN in 30 days with Rust and WASM](https://swe.quest/articles/how-to-build-a-30m-rps-cdn-in-30-days-with-rust-and-wasm-874ba9ecc2d85852.md): Railway · 2026-06-04 · Medium · 12 min read · CDN & edge, WebAssembly, Rust, Networking, Deployment
  Railway built Hikari, its own CDN with 60 POPs and 180+ nodes, in 30 days.
- [Migrating our Messages API to Rust](https://swe.quest/articles/migrating-our-messages-api-to-rust-9b451909ab785c36.md): Anthropic Engineering · 2026-11-25 · Medium · 24 min read · Rust, Refactoring & migrations, Performance engineering, Testing, AI for coding
  Anthropic migrated its production Messages API from Python to Rust, using the live Python service as an oracle because tests were incomplete and the API kept changing.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
