async-sync-advisor

Recommend async, spawn_blocking, or rayon patterns for Rust AWS Lambda handlers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Rust Lambda developers choose the optimal concurrency pattern (async, spawn_blocking, or data-parallel strategies) to improve throughput and reduce latency for mixed workloads.

Core Features & Use Cases

  • Concurrence-pattern detection: Identifies CPU-bound vs I/O-bound components and recommends async, spawn_blocking, or Rayon usage.
  • Pattern examples: Provides Rust code sketches showing how to combine async and blocking work safely.
  • Performance guidance: Explains when and why to prefer concurrent I/O, blocking offload, or parallel computation.

Quick Start

Ask the skill to review a Lambda handler and return a recommended concurrency pattern with a short rationale.

Frequently Asked Questions about async-sync-advisor

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

FAQPage Schema
How do I choose between async and blocking patterns for Rust Lambda handlers?

Async patterns optimize I/O-bound workloads by handling concurrent requests efficiently, while blocking patterns like tokio::task::spawn_blocking or rayon suit CPU-intensive tasks. Use async for database queries and API calls, spawn_blocking for heavy computation, and rayon for data-parallel work to maximize Lambda throughput.

When should I use tokio::task::spawn_blocking in a Lambda handler?

Use spawn_blocking to offload CPU-intensive work from async code without blocking the runtime. This pattern prevents latency spikes in mixed I/O and compute workloads by running blocking operations on a dedicated thread pool while keeping I/O tasks concurrent.

Can I combine async I/O with CPU-heavy work in a single Lambda handler?

Yes. Mixed workloads benefit from hybrid patterns: handle I/O concurrently with async/await, offload CPU tasks via spawn_blocking or rayon for parallel computation, and coordinate both patterns safely. This reduces end-to-end latency compared to purely async or purely blocking approaches.

What's the performance impact of choosing the wrong concurrency pattern for Lambda?

Async-only designs starve CPU-bound tasks and create request queues; blocking-only designs waste throughput on I/O waits. Correct pattern matching—async for I/O, blocking or rayon for compute—directly improves request latency and Lambda cost efficiency under mixed workloads.

How do I know if my Lambda handler is CPU-bound or I/O-bound?

Profile your handler: I/O-bound workloads spend time waiting on external services (databases, APIs); CPU-bound workloads spend time in computation or data processing. Identify which dominates, then apply async for I/O dominance, spawn_blocking or rayon for CPU dominance, or hybrid strategies for mixed patterns.

Does rayon work with AWS Lambda for parallel CPU tasks?

Yes. Rayon provides data-parallel iteration suitable for Lambda's multi-core environment. Wrap rayon work with spawn_blocking to avoid blocking the async runtime, allowing safe parallel computation within async handlers for algorithms like map-reduce or bulk data processing.