githubEdit

Throughput Tuning

Practical examples for tuning Elsa Workflows throughput, including commit strategies, clustering optimizations, and resource management.

This document provides practical examples for optimizing Elsa Workflows throughput in high-volume scenarios.

Commit Strategy Configuration

High-Throughput Configuration

For maximum throughput with short-lived workflows, minimize commits:

using Elsa.Extensions;
using Elsa.Workflows.CommitStates;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddElsa(elsa =>
{
    elsa.UseWorkflows(workflows =>
    {
        // Configure commit strategies for high throughput
        workflows.UseCommitStrategies(strategies =>
        {
            // Only commit when workflow completes - minimal I/O
            strategies.UseWorkflowExecutedStrategy();
        });
    });
    
    // Additional performance settings
    elsa.UseWorkflowRuntime(runtime =>
    {
        runtime.UseDistributedRuntime();  // Enable for clustering
    });
});

var app = builder.Build();
app.Run();

Code Reference: src/modules/Elsa.Workflows.Core/CommitStates/Strategies/Workflows/WorkflowExecutedWorkflowStrategy.cs

Long-Running Workflow Configuration

For long-running workflows, use periodic commits to balance durability and performance:

Code Reference: src/modules/Elsa.Workflows.Core/CommitStates/Strategies/Workflows/PeriodicWorkflowStrategy.cs

Per-Workflow Strategy Selection

Different workflows can use different commit strategies based on their requirements:

Code Reference: src/modules/Elsa.Workflows.Core/Models/WorkflowOptions.cs

Clustering and Scheduler Tuning

Quartz Scheduler Configuration for High Volume

When running in a cluster with high scheduling load:

Distributed Lock Optimization

Reduce lock contention in clustered environments:

Lock Contention Monitoring

Monitor lock acquisition to identify bottlenecks:

Database Tuning

Connection Pool Configuration

Optimize database connection pooling for high concurrency:

Batch Operations

For bulk workflow operations, use batch APIs:

Observability Setup

Comprehensive Monitoring Configuration

Set up end-to-end observability for performance monitoring:

Key Metrics to Monitor

Metric
Description
Alert Threshold

elsa.activities.executed

Activities executed per second

N/A (baseline)

elsa.activity.duration

Activity execution duration

P95 > 5000ms

elsa.lock.acquisition.time

Lock acquisition latency

P95 > 500ms

elsa.lock.timeouts

Lock acquisition failures

> 10/minute

db.connection.pool.active

Active DB connections

> 80% of max pool

Performance Checklist

Before deploying to production, verify:


Last Updated: 2025-11-28

Last updated