lambda-optimization-advisor

Analyze Rust AWS Lambda handlers for performance and cost inefficiencies.

2|1|Updated Oct 31, 2025
One-click install
npx skills add https://github.com/EmilLindfors/claude-marketplace --skill lambda-optimization-advisor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lambda-optimization-advisor
Source: https://github.com/EmilLindfors/claude-marketplace/tree/main/plugins/rust-lambda/skills/lambda-optimization-advisor
Command: npx skills add https://github.com/EmilLindfors/claude-marketplace --skill lambda-optimization-advisor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill analyzes AWS Lambda handler code in Rust and suggests performance optimizations to reduce latency and cost, including concurrency, initialization patterns, and memory considerations.

Core Features & Use Cases

  • Concurrency optimization: Suggests concurrent requests with tokio::try_join! or tokio::join! for I/O-bound calls.
  • Lazy/init patterns: Advises on reusing clients and resources across invocations.
  • Build & deployment guidance: ARM64 builds and memory sizing considerations.

Quick Start

Start with identifying hotspots in a Lambda handler, apply the recommended pattern, then re-deploy and measure impact.

Frequently Asked Questions about lambda-optimization-advisor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize AWS Lambda performance for Rust functions?

Rust Lambda optimization focuses on concurrency patterns, client reuse across invocations, ARM64 builds, and memory configuration. Analyze your handler for sequential I/O operations and apply tokio::try_join! to run requests concurrently, initialize expensive resources once outside the handler, enable ARM64 builds for cost reduction, and right-size memory to balance latency and pricing.

Can I reduce cold-start latency in Rust Lambda handlers?

Cold-start reduction in Rust Lambda involves lazy initialization of clients and connections outside the handler invocation path, selecting appropriate memory sizes to speed execution, and using ARM64 builds which often initialize faster than x86. Moving client creation to the global scope lets the runtime reuse them across warm invocations.

What release profile settings improve Rust Lambda build performance?

Rust Lambda release profiles should apply opt-level=3 for optimization, enable link-time optimization (lto), reduce codegen-units to 1 for better optimization, strip symbols to shrink binary size, and set panic=abort to eliminate unwinding overhead. These settings reduce package size and execution time without sacrificing correctness.

How do I handle concurrent I/O in AWS Lambda with Rust and tokio?

Concurrent I/O in Rust Lambda uses tokio::try_join! or tokio::join! to execute multiple async operations in parallel within a single invocation. This pattern is effective for high I/O workloads like calling multiple external APIs or databases, reducing total latency by overlapping network waits instead of executing sequentially.

What's the difference between ARM64 and x86 builds for Rust Lambda functions?

ARM64 Lambda builds run on Graviton processors, offering lower cost per invocation and often faster cold-start times compared to x86. For Rust, ARM64 builds require minimal code changes and are compatible with standard tokio and async patterns, making them a cost-effective optimization with no functional trade-offs.

When should I avoid initializing AWS clients inside Lambda handlers?

Avoid per-invocation client creation because it consumes CPU and memory on every call, increasing latency and cost. Initialize HTTP clients, database connections, and AWS SDK clients at the module level outside the handler so the Lambda runtime reuses them across warm invocations, dramatically reducing overhead.