Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Controlling resource usage with Barriers, Resource Constraints, and Queue steps

Compare Barriers, Resource Constraints, and Queue steps for controlling how deployments use resources

Harness has several ways to control deployments and resource usage and to protect resources and their capacity limits. Compare the differences, then use the practices below to choose one.


What you will learn from this topic

  • How to use a Barrier to hold parallel stages or step groups until each one reaches the Barrier

  • How to use Resource Constraints so two deployments do not use the same service and infrastructure at the same time

  • How to use a Queue step to queue pipeline executions that share a resource key

  • How to choose an option for the deployment you need to coordinate


Before you begin

Use the topic for the control you plan to add:


Control option definitions

The following options control how deployments use resources.

Barriers

Barriers synchronize stages and step groups of a pipeline that run in parallel. A Barrier holds one stage or step group until another stage or step group reaches a specific point.

For more information, go to Synchronize parallel stages and step groups using Barriers.

Resource constraints

Resource Constraints protect capacity limits by preventing simultaneous deployments to the same service + infrastructure combination. The service + infrastructure combination acts as a fixed key.

Resource Constraints are added to every stage by default. You can disable them in a stage's Infrastructure settings by enabling Allow simultaneous deployments on the same infrastructure.

For more information, go to Pipeline resource constraints.

Queue steps

Queue steps synchronize pipeline executions. They queue pipelines that use a custom key.

Multiple deployments are queued so that one deployment completes before other deployments with the same key can proceed.

For more information, go to Control resource usage with Queue steps.

If Queue steps with the same resource key exist in pipelines in projects A and B, and the pipeline in project A is running, the pipeline in project B is queued until the pipeline in project A is completed.


Best practices

Use these practices to choose a resource control:

  • Barriers: Use a Barrier when you want to coordinate the timing of different components' deployments with stages or step groups that run in parallel in the same pipeline. For example, the pipeline runs stages A and B in parallel, and a database migration in stage A must complete before a deployment in stage B. Place a Barrier step after the migration in stage A and before the deployment step in stage B.

  • Resource Constraints: Use Resource Constraints when you want to prevent simultaneous deployments to the same service + infrastructure combination. This feature is enabled by default.

  • Queue steps: Use Queue steps when you want to control the sequence of multiple pipeline executions. You can use Queue steps on different pipelines or on multiple executions of the same pipeline.


Next steps

Last updated

Was this helpful?