Agent skill · data analytics · jeremylongshore

langfuse-performance-tuning

Optimize Langfuse tracing performance for high-throughput applications.

Why this skill is useful

Provides specific performance tuning scripts and configurations for optimizing Langfuse tracing that are not widely known.

What it needs

Requires @langfuse/otel, @opentelemetry/sdk-node installed locally. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Langfuse Performance Tuning Overview Optimize Langfuse tracing for minimal overhead and maximum throughput: benchmark measurement, batch tuning, non-blocking patterns, payload optimization, sampling, and memory management. Prerequisites Existing Langfuse integration Performance baseline to compare against Understanding of async patterns Performance Targets Metric Target Critical -------- -------- ---------- Trace creation overhead < 1ms < 5ms Flush latency (batch) < 100ms < 500ms Memory per active trace < 1KB < 5KB CPU overhead < 1% < 5% Instructions Step 1: Benchmark Current Performance Step 2: Optimize Batch Configuration Setting Low Volume High Volume Ultra-High --------- ----------- ------------- ------------ Batch size 15 50-100 200 Flush interval 5s 10s 30s Queue size 1024 4096 8192 Step 3: Non-Blocking Trace Wrapper Ensure tracing never blocks your application's critical path: Step 4: Payload Size Optimization Large trace payloads slow down flush and increase costs: Step 5: Sampling for Ultra-High Volume When you cannot afford to trace every request: Step 6: Memory Management Optimization Impact Matrix Optimization Latency Impact Throughput Impact Effort ------------- --------------- ------------------- -------- Increase batch size High High Low Non-blocking wrapper High Medium Low Payload truncation Medium Medium Low Sampling High Very High Medium Memory monitoring Low Low Low Error Handling Issue Cause Solution ------- ------- ---------- High P99 latency Sync flush in hot path Use non-blocking wrapper Memory growth No payload limits Truncate inputs/outputs Request timeouts Batch too large Reduce batch size or increase timeout Dropped spans Queue full Increase maxQueueSize Output Produce a tuning receipt with the baseline and post-change P50/P95 latency, throughput, sampling rate, batch settings, and dropped-event count. Include the rollback setting for each change; do not treat fewer traces as lower latency without reporting the sampling denominator. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/langfuse-performance-tuning

View the source on GitHub

Browse the @skills marketplace