Skip to content

Concurrency & Resource Limits

Bruin runs assets in parallel based on their dependencies. Assets without dependencies on each other execute simultaneously.

Workers (CLI)

The --workers flag controls how many assets run at once:

bash
bruin run --workers 8
WorkersUse Case
1-4Memory-heavy Python assets, local development
8-16General use (default: 16)
16-32Lightweight SQL assets pushing work to the warehouse

Pipeline Concurrency (Bruin Cloud)

The concurrency setting in pipeline.yml controls how many runs of the same pipeline can overlap:

yaml
concurrency: 2  # Allow 2 runs simultaneously (default: 1)

Keep this low (1-2) unless you're backfilling independent date ranges.

Connection Concurrency Limits

Use max_concurrent_assets on a connection in .bruin.yml to limit how many assets can use that connection at the same time during a run:

yaml
environments:
  default:
    connections:
      postgres:
        - name: "postgres-main"
          host: "db.example.com"
          port: 5432
          database: "analytics"
          username: "${POSTGRES_USER}"
          password: "${POSTGRES_PASSWORD}"
          max_concurrent_assets: 2

This is useful for rate-limited APIs, small databases, or warehouses with strict concurrency quotas. If more runnable assets need the same connection, Bruin keeps the extra assets queued until one of the active assets releases that connection slot.

Connection limits work together with --workers: --workers is the total number of assets Bruin can run at once, while max_concurrent_assets is the per-connection cap. The lower effective limit wins for assets that use that connection.

For ingestr assets, Bruin tracks both the source connection and the destination connection. For example, an ingestion asset moving Shopify data into Postgres counts against both the Shopify source limit and the Postgres destination limit while it runs.

The value must be a positive integer. Omit max_concurrent_assets when a connection should not have a per-connection limit.

Instance Types & Weighted Slots (Bruin Cloud)

Larger instances consume more of your tenant's resource pool:

InstanceMemorySlots Used
b1.nano256 MB1
b1.small1 GB~2
b1.large4 GB~4
b1.xlarge6 GB~6

Example: With 32 available slots, you can run:

  • 32 nano instances, OR
  • 8 large instances, OR
  • A mix (e.g., 4 large + 16 nano)

This means memory-intensive pipelines naturally run fewer assets in parallel.

Quick Reference

SettingControlsDefaultScope
--workersAssets running simultaneously16Single run
max_concurrent_assetsAssets using one connection simultaneouslyUnlimitedSingle run
concurrencyPipeline runs overlapping1Cloud only
instanceCPU/memory per assetb1.nanoCloud only

Platform Notes

  • DuckDB: Cannot share database files across parallel processes. Use --workers 1 for shared files.
  • Cloud warehouses (BigQuery, Snowflake): Handle high concurrency well since computation happens on their infrastructure.