Autoscaling Langfuse workers on ingestion queue depth

CPU load is the scaling signal Langfuse documents for workers, but a growing ingestion backlog can lag behind it. This page explains how to scale on queue depth, what to confirm first, and what the setup involves.

On this page

Autoscaling Langfuse workers: when CPU stops being a reliable signal

Scaling Langfuse Worker containers on CPU load is the baseline the Langfuse scaling guide documents, and it is the right first step for most self-hosted deployments. When trace ingestion spikes, however, CPU can stay moderate while events pile up behind the workers, so the backlog grows before any CPU threshold trips. The Langfuse Worker handles asynchronous event processing, which means ingested events wait in a queue until a worker picks them up. The waiting queue depth measures unprocessed work directly, so it is usually the earlier signal of a worker shortfall. Before you configure any autoscaler, confirm in the Langfuse scaling guide which queue metric names Langfuse exposes, how they are published, and which release introduces the tagged form you plan to use.

Treat the metric as a contract between three versions: the Langfuse release running in your cluster, the publishing path (StatsD or CloudWatch, as your environment supports), and the autoscaler's query. Check the Langfuse releases page for the version that added the tagged queue metric, and confirm that your deployed Langfuse version is at or above it. Then verify the metric in your monitoring system under real or load-tested traffic before you attach scaling rules to it. Record the exact metric name, tags and units in your runbook, because a renamed or untagged series will make the autoscaler silently scale on nothing.

Plan for the failure modes that queue-based scaling introduces. A queue that drains only when workers are added can look healthy while the database or ClickHouse behind the workers is saturated, so keep the CPU and memory signals on the same dashboard. Set a maximum replica count that your PostgreSQL connection limits and ClickHouse capacity can absorb, and decide who is paged when the queue grows even at that ceiling. Test scale-in as well as scale-out, since removing workers during an active backlog can extend recovery. Document these decisions with your platform team so the scaling policy is reviewed alongside upgrades, not discovered during an incident.

How a queue depth signal reaches the worker deployment

The signal starts with SDK or OTLP requests that Langfuse Web accepts and places on the queue that Langfuse Worker drains. A metric publisher reads the waiting ingestion work and sends it to the autoscaler, which adjusts the worker deployment. Worker throughput then changes the queue depth, closing the loop. Confirm the queue component and the publisher options in the Langfuse self-hosting docs before you build the metric pipeline.

Queue depth flows from ingestion to the autoscaler, which scales the workers that drain it.

Which scaling signal and publishing path fits your platform

This table compares four ways to decide when the Langfuse worker deployment should grow, from the CPU signal Langfuse documents to queue depth published through StatsD, CloudWatch or an external metric. Read each row against the team that will run the metric pipeline, because the option that scales best on paper fails if nobody owns the publishing path. The main takeaway is that CPU is the documented baseline, while queue depth reacts to backlog directly but adds a metrics pipeline you must operate.

OptionWhat the signal measuresWhere the metric is publishedWho operates the pipelineWhen it fits
CPU-based scaling (Langfuse documented)Average CPU load across worker containersAlready exposed by the container runtime and cluster metricsYour platform team, using standard autoscaler settingsSteady ingestion where CPU rises with load; the simplest starting point
Queue depth published to StatsDNumber of waiting ingestion jobs in the queueA StatsD endpoint that your collector or metrics agent receivesYour observability team, which runs the StatsD receiver and its export pathTeams that already run StatsD and want backlog-driven scaling
Queue depth published to CloudWatchNumber of waiting ingestion jobs in the queueAmazon CloudWatch metrics in the AWS account that hosts the deploymentYour cloud team, which manages the publishing role, namespace and alarmsAWS deployments where teams already alert and scale on CloudWatch
Kubernetes autoscaler reading an external metricQueue depth or another backlog measure exposed through an external metrics adapterWhatever metrics backend the adapter queries, such as a monitoring systemCluster operators, who own the adapter, its permissions and upgradesClusters with a mature autoscaling stack and a need for one scaling model across services
Decision check for your teamConfirm the tagged metric name and minimum Langfuse version in the scaling guideConfirm supported publishing paths with your autoscaler documentationName one owner for the metric pipeline before enabling itChoose the path your team can monitor and repair during an incident

Four signals to watch before changing worker replicas

Worker replica counts should follow evidence, not a single gauge. The four signals below describe different parts of the ingestion path, and each one can mislead when read alone, so check them together before you change the autoscaler's target or the replica count.

Worker CPU load

CPU load on Langfuse Worker is the documented baseline for scaling worker containers, so it is the first signal to check. It shows how busy the processes are right now. A high reading with a shrinking queue usually means the workers are keeping up. A low reading during a backlog is the false signal to watch for: a worker can be waiting on PostgreSQL, ClickHouse or blob storage while its CPU stays quiet, so adding CPU-based replicas will not clear the queue.

Langfuse scaling guide

Waiting queue depth

Queue depth counts events accepted by ingestion that no worker has picked up yet. It is the signal this autoscaling setup is built on, because it shows backlog directly rather than inferring it from load. Read it as a trend: a depth that rises and stays up means throughput is below arrival rate. The false signal here is a short spike after a burst of traffic, which drains on its own and does not justify a permanent increase in replicas.

Worker memory pressure

Memory pressure on workers can cap throughput even when CPU looks low. Workers that approach their memory limit may slow down, restart or be killed by the orchestrator, and each restart returns events to the queue for reprocessing. The false signal is a quiet CPU graph that hides a worker stuck in repeated restarts. Check restart counts and memory against the limit alongside the queue, and avoid adding replicas that would each hit the same ceiling.

Trace visibility delay

Visibility delay measures how long a trace takes to travel from SDK send to appearing in the UI. It is the user-facing result of the whole pipeline, so it confirms whether scaling changed anything that matters to teams. The false signal is a delay that comes from the UI or the query path rather than ingestion. Compare a test trace's timing against queue depth before concluding that workers are the bottleneck.

How to set up queue-depth autoscaling for workers

This sequence moves Langfuse worker scaling from CPU load to the waiting ingestion queue. Each step ends with a check, so the operator knows the metric is trustworthy before any autoscaler acts on it.

  1. Confirm the Langfuse version and release notes

    The platform team confirms the Langfuse version it runs and reads the release notes for the version it plans to run. The GitHub releases page lists v4.63.0, published October 16, 2026, so check whether your target version is newer or older than that and whether its notes describe the queue metric. Record the exact version, the release note entry and the minimum version that exposes the metric. Done when the team can point to the note that describes the metric and the version it appeared in.

  2. Identify the queue metric and its tag

    Using the scaling guide and the release notes, the platform team writes down the exact metric name, its unit, the tag or label that identifies the ingestion queue, and where the worker publishes it. Do not guess these names from dashboards or examples found elsewhere, since they change between versions. Check the metric in a non-production worker by reading its emitted output and confirming the tag value matches the note. Done when the written definition matches what the running worker actually emits.

  3. Enable StatsD or CloudWatch publishing

    The operator who owns the self-hosted deployment enables metric publishing for the worker container, using the configuration keys documented for the chosen version and the chosen destination, StatsD or CloudWatch. Apply the change through the same values file or manifest that manages the rest of the deployment so it survives a redeploy. Restart the worker and read its logs for publishing errors, such as failed connections or permission denials. Done when the worker starts cleanly and logs no publishing errors.

  4. Verify the metric with a known load

    The team sends a known, repeatable batch of test traces to a non-production instance and watches the queue metric in StatsD or CloudWatch. The series should rise while the batch is queued and fall as workers drain it, under the expected tag. Compare the peak against the number of events sent so the team knows the metric counts what it should. Done when the series appears under the expected name and tag and its shape matches the test batch.

  5. Install the autoscaler with worker bounds

    The platform team installs the autoscaler that matches its platform, such as a Kubernetes autoscaler that reads external metrics or a cloud scaling policy that reads CloudWatch, and points it at the verified queue metric. It sets a minimum and maximum worker count, and it keeps the worker resource requests at or above the minimum the scaling guide lists, 2 CPU and 4 GiB. Confirm the autoscaler can read the metric and reports a current value. Done when the autoscaler status shows the live queue value and the configured bounds.

  6. Set thresholds through a load test

    In a non-production environment, the team replays ingestion at increasing rates and records queue depth, worker count and how long the queue takes to return to baseline. The threshold is the queue value where scale-out starts in time to prevent backlog growth without causing repeated scale-up and scale-down. Note that the right value depends on your traffic pattern and worker size, so confirm it with your own test rather than copying a value. Done when the autoscaler logs show scale-out and scale-in events at the chosen threshold.

  7. Document and test the rollback path

    The team records the previous worker replica count, the autoscaler configuration, the metric publishing settings and the version in use, then writes the steps to disable the autoscaler and return to a fixed replica count. It rehearses those steps in a non-production environment. Confirm that after rollback the workers stay healthy and the queue drains at the fixed count. Done when the rollback runbook has been run once and its results are filed with the change record.

Questions teams ask before autoscaling Langfuse workers

Does queue-depth autoscaling for Langfuse workers need an Enterprise license key?

The Enterprise features documented for self-hosted Langfuse do not include worker autoscaling on queue depth. That list covers project-level RBAC roles, protected prompt labels, data retention policies, audit logs, server-side data masking, UI customization, organization creators, and the org management and instance management APIs with SCIM. Autoscaling is configured in your own metrics and orchestration stack, so the license question is mostly about the Langfuse code you run. Confirm this with Langfuse before you commit, using the Langfuse license key documentation as your starting point, and get the answer in writing for your version.

What drives the effort of queue-depth autoscaling?

Effort depends on four parts of the work. The first is the metric pipeline: Langfuse must publish the waiting ingestion queue metric, and that metric must reach your autoscaler through StatsD or CloudWatch. The second is the autoscaler itself, including its rules, minimum and maximum replicas, and cooldown settings. The third is capacity in the data stores: scaling workers pushes more writes into PostgreSQL, ClickHouse and the Redis or Valkey queue, so each may need resizing. The fourth is load testing, which proves the thresholds hold under realistic bursts. Ask any provider to break the quote into these four parts.

Can our internal team set up worker autoscaling without a partner?

Yes, if your team already runs Kubernetes or VMs and has working monitoring. The skills you need are container orchestration and autoscaler configuration, metrics collection with StatsD or CloudWatch, PostgreSQL and ClickHouse capacity planning, and load testing with a rollback plan. You also need someone who can read Langfuse's scaling guidance and check the version requirements for the tagged metric before enabling it. Teams without one of these skills often find the load test and the data store sizing take the longest. A partner is most useful when those gaps are known up front and a fixed scope is preferred.

What do we need to provide before the work starts?

You need to provide access to the cluster or VM hosts that run Langfuse Web and Langfuse Worker, with permission to change deployment and autoscaler settings in a test environment first. You also need access to your monitoring system so the queue metric can be checked, plus current dashboards for PostgreSQL, ClickHouse and Redis or Valkey. Schedule a load test window that does not overlap with production reporting or retention jobs. Finally, name an owner who can approve threshold changes and a rollback path. Ask any provider to confirm this list against your environment before signing.

How is the cost of worker autoscaling structured?

Cost has two layers. The first is infrastructure you pay directly: extra worker capacity when queues grow, the metrics and monitoring services that publish the queue metric, and any added database or ClickHouse capacity the higher write load requires. Most of this recurs and rises with peak ingestion, and it can fall when the autoscaler scales back down. The second is the services fee for planning, implementation and load testing, which is one-time for the build and separate from any ongoing support. DeployOpen's fees follow from a written scope and are not published as a price list, so ask for a quote that shows each part.

Which Langfuse version do we need before we can scale on the queue metric?

The tagged metric depends on the Langfuse release you run, so check the version requirements for the metric in the Langfuse documentation before planning. Confirm the exact minimum version with Langfuse and test that version in a non-production environment. Upgrades within a major version are non-disruptive and apply database migrations at startup, while major upgrades follow separate migration guides. If your planned metric depends on a newer release, schedule that upgrade first so autoscaling is not tested against a moving target.

What goes wrong when workers scale on CPU alone?

CPU is a lagging signal for an ingestion backlog. Workers can sit at moderate CPU while events wait in the queue, or CPU can spike briefly and then drop before the backlog clears, so the autoscaler reacts late or oscillates. Langfuse's scaling guide recommends CPU load for workers, so queue depth is an addition for bursty workloads rather than a replacement. Test both signals under load, and make sure scaling up does not simply move the bottleneck to PostgreSQL or ClickHouse.

Security and operational controls for the scaling path

Scaling workers on queue depth adds a metric pipeline, an autoscaler and a permission to change replica counts, and each of these becomes part of your attack surface and change history. The four controls below are the ones to confirm in your environment before the autoscaler goes into production.

Least-privilege autoscaler permissions

The autoscaler needs to read the queue metric and change the replica count of the Langfuse Worker deployment, and nothing else. Scope its service account or IAM role to that one deployment or scaling resource, and confirm it cannot edit secrets, the web deployment or the database. Check that the credentials used to read the metric are separate from those used to scale, so a leak of one does not grant both. Review the role after every change to the autoscaler's manifest.

Langfuse scaling guide

Metric path kept inside the network

The queue metric travels from the worker or its exporter to StatsD or CloudWatch, and from there to the autoscaler. Keep that path on private addresses, restrict the StatsD listener or metrics port to the monitoring namespace or subnet, and avoid publishing metric endpoints through the load balancer or ingress that serves users. Confirm with a port scan from outside the cluster or VPC that the metric port is closed. Only expose the metrics endpoint that your collector needs.

No personal data in metric names or labels

Queue metrics should describe system state, such as the number of waiting ingestion jobs, and never carry user identifiers, project names, prompt text, trace IDs or email addresses. Labels are stored and often shared with dashboards and vendors, so a single careless tag can copy personal data outside the trace store. Review the metric names and tags your exporter emits, and confirm that retention for the monitoring backend is set to match your data policy.

Logged and reviewed scaling changes

Autoscaling changes replica counts without a human approving each one, so they need an audit trail. Keep the autoscaler configuration in version control, require review for changes to thresholds, minimum and maximum replicas, and cooldown periods, and retain Kubernetes events or CloudWatch scaling activity for the period your change policy requires. Confirm who can edit the autoscaler object and that repeated scale-outs trigger an alert for the operations team.

What to confirm before you tune thresholds

Before you set any scaling threshold, confirm three things against your own Langfuse version: the exact queue metric name and tag the autoscaler will read, the minimum version that publishes that tag according to the release notes, and the path the metric takes from the worker to your autoscaler. Do not copy a metric name from a blog post or an older chart. Check the Langfuse releases page for the version you run, and confirm in your deployment that the StatsD or CloudWatch publisher is enabled, reaching the right endpoint, and emitting the value you expect. A metric that exists but reports a stale or zero value will leave an autoscaler idle during a real backlog, so verify the number moves under a test load before you wire it to any scaling rule.

Next, confirm that the systems behind the workers can absorb more of them. Every added worker opens more connections to PostgreSQL and writes more batches to ClickHouse. If the PostgreSQL connection limit or pooler capacity is already close to its ceiling, extra workers will queue on connection acquisition instead of processing events, and the queue depth will stay high while CPU looks modest. Similarly, if ClickHouse insert throughput, merge capacity or memory is the constraint, more workers will push more concurrent inserts into the same bottleneck. Ask your database and ClickHouse owners for current connection headroom, insert latency and disk and memory margins, and test the scaled-out state at the maximum replica count you plan to allow.

Treat the worker maximum as a capacity decision, not a cost cap. Set the ceiling only after you have measured what the downstream stores tolerate, and plan an alert for sustained queue growth at that ceiling so the team knows the bottleneck has moved. Document which metric, tag and version each autoscaler rule depends on, so an upgrade to a newer Langfuse release can be checked against the release notes before the autoscaler is changed. Confirm the rule still reads the same tag after every upgrade, because a renamed or dropped metric fails quietly.

Limits to confirm in your own environment

Queue-based autoscaling moves load onto the worker deployment, and the worker depends on PostgreSQL, ClickHouse and Redis or Valkey for every event it processes. The cards below cover the checks that decide whether a queue-driven scaler is safe in your environment.

Confirm the queue metric and tag

The waiting ingestion queue metric and its tag are tied to specific Langfuse versions, so the name you scrape in one release may not exist in the next. Before you write the scaler query, confirm the metric name, its tag and the minimum version that publishes it against the release you run. Check the release notes for the exact version you deploy, and test the query against a staging instance before production. A scaler that reads a missing metric often fails silently and leaves workers at their minimum count.

Langfuse releases

Scale-to-zero and always-on ingestion

Scaling workers to zero stops event processing entirely while the queue is empty, and events that arrive during a cold start wait for a new pod to become ready. Decide whether any ingestion path must be processed with no added delay, such as traces used for live alerting or evaluations that run on arrival. For those paths, keep a non-zero minimum replica count and confirm your autoscaler supports it. Document the trade-off with your application owners before you set the floor.

Connection and capacity draw on data stores

Every additional worker opens more connections to PostgreSQL and writes more batches to ClickHouse, so scaling workers moves the bottleneck to the data stores. Ask your database team how many connections each worker uses, what the connection pool limit is and how much write capacity ClickHouse has at peak. Set a maximum replica count that the data stores can sustain, not one that the queue would like. Load-test the upper limit before you expose it to the autoscaler.

Data store floors set the minimum

The scaling guide lists minimum resources of 2 CPU and 4 GiB for web, worker and PostgreSQL, and 2 CPU and 8 GiB for ClickHouse. Scaling workers beyond what PostgreSQL and ClickHouse can hold at those floors shifts failures into the stores, where they are harder to diagnose. Size the stores for your planned worker ceiling, and treat these figures as the starting floor rather than a sizing result. Confirm current requirements in the scaling guide for your version.

ClickHouse minimum
2 CPU, 8 GiB
Langfuse scaling guide

Scaler behavior during short outages

When PostgreSQL or ClickHouse is briefly unavailable, workers fail health checks and queue depth can rise, which may cause the autoscaler to add replicas that fail in turn. Test what happens during a short database restart: whether the scaler adds pods, whether new workers retry cleanly and whether they recover once the store returns. Set scale-up stabilization windows and review restart behavior with your health probe settings so the cluster does not churn during an outage.

How DeployOpen scopes and delivers worker autoscaling

DeployOpen treats worker autoscaling on ingestion queue depth as part of a self-hosted Langfuse deployment inside your own infrastructure. We agree the scope in writing first, then build and test the metric path, the autoscaler and the rollback before handing the setup to your team with documentation.

How we scope

  • We confirm your Langfuse version and whether it meets the version requirements for the tagged queue metric before any build starts.
  • We record which metrics backend you run, StatsD or CloudWatch, and which autoscaler your platform uses.
  • Engagements are fixed-scope, so the written scope states the worker deployments, metric path, scaling bounds and test cases covered.

How we build

  • We configure the worker metric publishing and confirm the waiting-queue series reaches your monitoring system before scaling depends on it.
  • We set up the autoscaler on queue depth alongside CPU, with minimum and maximum replica counts agreed with your database and ClickHouse capacity.
  • We test scale-up under a simulated ingestion burst and scale-down after the queue drains, and record the results in the handover pack.

How we hand over

  • You receive the configuration, metric names, alert thresholds and a runbook describing how to change scaling bounds safely.
  • We walk your platform and on-call engineers through the metric dashboard, the autoscaler events and the steps to disable autoscaling.
  • The documentation records the Langfuse version, the metrics backend and the test evidence so your team can repeat checks after upgrades.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, including re-checking scaling after a Langfuse upgrade changes the metric.
  • A retainer can cover monitoring of the queue metric, review of scaling events and updates when your autoscaler or metrics backend changes.
  • Ask for a quote based on the written scope, which will list what is one-time setup work and what recurs under a retainer.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.