infra-scaling

Tune Langfuse ECS autoscaling settings using Terraform and Datadog evidence.

34.0k|3.7k|Updated May 18, 2023
One-click install
npx skills add https://github.com/langfuse/langfuse --skill infra-scaling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: infra-scaling
Source: https://github.com/langfuse/langfuse/tree/main/.agents/skills/infra-scaling
Command: npx skills add https://github.com/langfuse/langfuse --skill infra-scaling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Balancing infrastructure cost against performance for Langfuse web, web-iso, and web-ingestion services requires careful analysis of autoscaling thresholds, container counts, and production metrics, and mistakes can cause either wasted spend or latency regressions.

Core Features & Use Cases

  • Autoscaling Tuning: Reviews and adjusts RPM targets, scaling boundaries, minimum task counts, and max-capacity multipliers in Terraform tfvars across prod-us, prod-eu, prod-hipaa, and prod-jp.
  • Evidence-Based Decisions: Queries Datadog for CPU, request counts, event-loop delay, latency, and error rates, and inspects APM traces to distinguish container saturation from ClickHouse-bound queries.
  • Exact Marker Math: Computes dashboard scale-up and scale-down markers using OpenTofu console to avoid off-by-one errors from Terraform float behavior.
  • PR and Linear Workflow: Creates GitHub PRs for scaling changes and prepares human-reviewed Linear follow-up tickets only after explicit approval.
  • Use Case: When prod-hipaa web containers sit idle at an accidental floor of 20 tasks, use this Skill to verify health metrics, lower the minimum to 3, raise the multiplier to preserve burst capacity, and open a reviewed PR.

Quick Start

Use $infra-scaling to review Langfuse web-ingestion autoscaling in prod-us with Datadog evidence and prepare a GitHub PR if changes are recommended.

Frequently Asked Questions about infra-scaling

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

FAQPage Schema
How do I tune ECS autoscaling for Langfuse web-ingestion?

Read the current tfvars first, then gather 7-day Datadog evidence on CPU, request counts, latency, and errors. If CPU is low and health is green, raise the RPM target or narrow the boundary; if the service sits at its minimum, lower the minimum task count instead.

How to reduce Langfuse infrastructure cost without hurting latency?

Check whether services are floor-bound at their minimum task count, since raising RPM targets saves nothing there. Lower accidental idle floors after verifying HA and compliance requirements, and raise the max-capacity multiplier to preserve burst ceiling.

Should I lower RPM targets when web-iso latency is high?

Not automatically. Inspect full APM traces first; if slow spans are dominated by ClickHouse queries, lowering RPM targets will not reduce query cost or duration. Only reduce RPM when evidence shows container-local saturation or event-loop delay.

How are autoscaling dashboard markers calculated in Terraform?

Scale-up threshold is rpm_target plus ceil(rpm_target times boundary), and scale-down is rpm_target minus the same. Compute markers with tofu console rather than mental math, because Terraform float behavior can cause off-by-one errors.

What is the minimum task count for Langfuse production services?

Prod web-ingestion keeps a minimum of 3 containers, and 3 is also an acceptable prod minimum for web and web-iso when no higher HA, isolation, or compliance floor is required. The web_ingestion_instances variable acts as the autoscaler minimum.

When does this Skill create Linear tickets for scaling changes?

Only after presenting a human-review table and receiving explicit approval of row IDs and actions. It creates one ticket per scaling adjustment, never assigns tickets without an explicit assignee, and never creates tickets for Valeriy.