Skip to main content
Learn how to scale Laddr agents horizontally and deploy to production environments.

Horizontal Scaling

Scale Workers

Scale agent workers to handle increased load:

Docker Compose Scaling

Scale workers using Docker Compose:

Queue Backends

Redis (Development)

Fast, lightweight queue backend for development:

Kafka (Production)

Durable, scalable queue backend for production:
Kafka provides better message persistence and horizontal scaling capabilities for production workloads.

Memory (Testing)

In-memory queue for local testing:
Memory backend only works within a single process. Use Redis or Kafka for multi-worker deployments.

Database Configuration

PostgreSQL (Production)

Use PostgreSQL for production deployments:

SQLite (Development)

SQLite for local development:

Monitoring

Dashboard

Access the dashboard for real-time monitoring:

Metrics

Monitor key metrics:
  • Queue Depth - Number of pending tasks
  • Worker Utilization - Active workers vs idle
  • Throughput - Tasks processed per second
  • Error Rate - Failed tasks percentage
  • Latency - Average task completion time

Logs

View and follow logs:

Production Deployment

Environment Variables

Configure production environment:

Health Checks

Implement health checks:

Resource Limits

Set appropriate resource limits:

Load Balancing

Worker Distribution

Kafka automatically distributes tasks across workers: Each worker in a consumer group processes a subset of tasks.

Partition Strategy

Configure Kafka partitions for better parallelism:

Performance Tuning

Worker Configuration

Optimize worker settings:

Database Connection Pooling

Configure connection pooling:

Troubleshooting

High Queue Depth

If queue depth is growing:
  1. Scale up workers: laddr scale researcher 10
  2. Check worker logs for errors
  3. Verify database/storage connectivity
  4. Check for slow tools or LLM calls

Worker Failures

If workers are failing:
  1. Check logs: laddr logs researcher --tail 100
  2. Verify API keys and credentials
  3. Check resource limits (CPU/memory)
  4. Review error messages in dashboard

Performance Issues

If performance is slow:
  1. Monitor dashboard metrics
  2. Check database query performance
  3. Review LLM response times
  4. Optimize tool implementations
  5. Consider caching strategies

Next Steps