Performance Observability
This document explains how to measure the performance of Lemline workflows with the metrics and logs Lemline provides, and what to change when it is not sufficient.
What Lemline Measures
Runners record, for every message they process (see Metrics Reference):
Metric | Use |
|---|---|
| Time spent executing workflow steps |
| Throughput and failures per workflow |
| Steps in progress on a runner |
| Cost of decoding and encoding messages, which grows with workflow data size |
| Memory, garbage collection and CPU of the runner |
There are no per-task or per-instance timing metrics. To see the timeline of a single instance, use the dashboard or the lifecycle events (see Lifecycle Analytics Reference).
Setting Up Monitoring
Metrics are on by default on lemline listen and lemline gateway start, at http://<host>:8080/q/metrics. Change the port with lemline.metrics.port or --metrics-port.
Prometheus scrape configuration:
Useful Queries
Finding Bottlenecks
Compare processing time with end-to-end time. If steps are fast but instances are slow, messages are waiting in the broker: add runners or partitions.
Look at slow workflows. A high processing duration usually comes from the remote services called by
calltasks or fromruntasks.Check runner CPU and memory. High CPU with low concurrency use points at expensive expressions or large data; memory pressure points at large workflow data.
Read the logs of one instance. Run a runner with
--debugto log each task with its input. Do not leave it on in production.
Optimization Techniques
In workflows
Keep workflow data small: use
output.asandexport.asto keep only what later tasks need. The whole state travels in every message.Run independent calls in parallel with
fork.Do not rely on task-level
timeoutto bound remote calls: Lemline only enforces timeouts onlistentasks. HTTP calls use fixed client limits instead (15 seconds to connect, 30 seconds per request).Use
retrypolicies with backoff rather than tight loops.
In the deployment
Add runners, and with Kafka add partitions.
Tune
lemline.messaging.<broker>.<channel>.consumer.concurrency(default 64).Keep
lemline.orchestrator.modeataction(default):allsends one message per task, including control-flow tasks, and is meant for testing.Place runners close to the broker, the database and the services they call.