LogoLogo
HomeAbout usSign up
  • Introduction
  • AttentionSet
    • AttentionSet Best Practices
    • How to View AttentionSet for Others
    • How to Manually Change Attention
    • AttentionSet Chrome extension
    • Attention reasons
    • AttentionSet Slack Home Page
  • Releases
    • Getting Started with Releases
    • Concepts for Releases
      • Terminology for Releases
      • Two-step delivery
      • Rollbacks
      • Cherry-picks
      • Dogfood, Canary and Rollout
      • Release notes
    • How-to Guides for Releases
      • How to Create a Release Project
      • How to Configure Environments
      • How to Create a Scheduled Release
      • Create Custom Workflow Parameters
      • How to Manage Cherry-Picks
      • How to Resolve a Cherry-Pick Failure
      • Working with your CI / CD
        • GitHub Actions workflow
        • Buildkite workflow
    • API Reference for Releases
  • FlexReview
    • Getting Started with FlexReview
    • How to Onboard a Large Org
    • Concepts for FlexReview
      • Read-Only Mode in FlexReview
      • Recursive Ownership in FlexReview
      • Reviewer suggestion and assignment
      • FlexReview Teams and SLO Management
      • Validation in FlexReview
    • How-to Guides for FlexReview
      • How to Get a Reviewer Suggestion
      • How to Exclude Reviewers
      • How to Set Up Team Rules
      • Whitelist Teams for Review Assignment
      • Troubleshoot Reviewer Assignment
      • PagerDuty Integration for Reviewers
      • How to Set Up FlexReview Validation
      • Recommended Slack Notification Settings
      • How to Exclude OOO Reviewers
    • FlexReview Reference
      • Configuration
      • Slash commands
      • Expert scoring algorithms
      • Slack Notifications
      • Out of Office User Exclusion
    • FlexReview Roadmap
  • MergeQueue
    • Getting Started with MergeQueue
    • Merge Rules
    • How-to Guides for MergeQueue
      • How to Configure Base Branches
      • How to Customize Required Checks
      • How to Set Up Fast-Forwarding
      • How to Set Up Pre-Queue Conditions
      • How to Queue / Dequeue via API
      • Pause / Unpause Queues via API
      • Slash Commands Using GitHub Comments
      • How to Customize Sticky Comments
      • Require an Aviator Status Check
      • Backport a PR
      • How to Configure ChangeSets
      • Custom Integrations
        • GitHub Integration
      • How to Create Personal Access Tokens
      • How to Set Up SAML Configuration
        • Microsoft Active Directory
      • How to Merge Stacked PRs
      • How to Block Pull Request Mergeing with Slash Commands
    • Concepts for MergeQueue
      • Queue Modes
      • Pull Request Lifecycle
      • Analytics
      • Parallel Mode
      • CI Status Requirements
      • MQ Created Branches
      • Batching
      • Managing flaky tests
      • Fast-forwarding
      • Pre-Queue Conditions
      • Sticky Comments
      • Backporting
      • Paused Queues
      • Affected Targets
        • Directory-Based Affected Targets
        • nx based affected targets
        • GitHub Actions based Affected Targets
      • ChangeSets
        • Global CI Validation
        • ChangeSets FAQs
      • Priority Merges
        • Instant Merges
      • Merge Rules Audit Trail
      • Timeline
      • Ready Hook
      • Reduce Queue Failures From Staleness
    • MergeQueue References
      • Configuration Schema
      • Configuration Reference MergeQueue
      • GitHub Slash Commands
      • Status Codes
  • Stacked PRs CLI
    • Quickstart for Stacked PRs CLI
    • CLI Installation
    • How-to Guides for Stacked PRs CLI
      • How to Create Stacked PRs in CLI
      • How to Navigate & Modify Stacked PRs
      • Add Commits in the Stack
      • How Split a Commit in CLI
      • How to Split and Fold Pull Requests
      • How to Rename a Branch in CLI
      • How to Adopt a Branch in CLI
      • Orphan a Branch with Aviator CLI
      • How to Do Git Subcommand Aliasing
      • How to Create an Access Token
      • How to Set Up Auto Completion in CLI
      • How to Use Editor Plugins in CLI
    • Concepts for StackedPRs CLI
    • How to Rebase and Sync with GitHub
    • Configuration for StackedPRs CLI
    • Stacked PRs FAQs and Troubleshooting
      • Working with Aviator CLI
      • Default Branch Update Master to Main
    • Manpages for Stacked PRs CLI
      • av(1)
      • av-adopt Command Guide
      • av-auth-status(1) in CLI
      • av-stack-branch(1) in CLI
      • av-commit-create(1) in CL
      • av-stack-diff(1) in CLI
      • av-fetch(1) in CLI
      • av-git-interaction Command Guide
      • av-init(1) in CLI
      • av-stack-next(1) in CLI
      • av-orphan Command Guide
      • av-pr-status(1) in CLI
      • av-pr-create(1) in CLI
      • av-stack-prev(1) in CLI
      • av-stack-reorder(1) in CLI
      • av-reparent Command Guide
      • av-restack Command Guide
      • av-commit-split(1) in CLI
      • av-switch Command Guide
      • av-stack-sync(1) in CLI
      • av-stack-tidy(1) in CLI
      • av-stack-tree(1) in CLI
    • Aviator CLI Major Releases
      • Aviator CLI v0.1.0 Release Notes
  • Aviator's Chrome Extension
  • Pilot Automated Actions
    • Scheduled Events
    • JavaScript Execution
    • Pilot Automated Actions Reference
      • GitHub Reference
      • MergeQueue Reference
      • Slack Reference
  • API and Integrations
    • Slack Integration Guide
    • GraphQL API Quickstart
    • Prometheus Metrics Setup for GCP
    • Reference
      • JSON API
      • GraphQL
      • Webhooks
      • Monitoring Metrics
  • Manage
    • Access Management
    • GitHub App Permissions
    • Security
      • Aviator Agents Data Usage & Retention Policy
    • On-Premise Installation
      • GitHub App for On-Prem
      • GitHub OAuth for On-Prem
      • Use Helm Instructions
      • Use Docker Compose Instructions
      • Prometheus endpoint
      • Slack Integration for On-Premise
      • Google SSO Login for On-Prem
    • FAQs
      • Troubleshooting GitHub app connection
      • MergeQueue FAQs
      • Billing FAQs
Powered by GitBook
On this page
  • How it works
  • Config Settings
  • Current workflow
  • Workflow with batching
  • Handling Failures

Was this helpful?

  1. MergeQueue
  2. Concepts for MergeQueue

Batching

Learn the nuances of batching and related FAQs. Batching works alongside Parallel mode to scale the throughput of PRs merged, by merging more PRs per CI run.

Batching works alongside Parallel mode to increase the throughput of PRs merged, by merging more PRs per CI run.

How it works

Config Settings

There are two settings to set in your configuration file.

batch_size = This is the number of queued PRs batched together for a draft PR CI run. Defaults to 1.

batch_max_wait_minutes= The time to wait before creating the next batch of PRs, e.g. if batch_size = 3 but there are only currently 2 queued PRs, then a batch of those 2 PRs will be created after batch_max_wait_minutes. Defaults to 0.

version: 1.0.0
merge_rules:  
    labels:    
        trigger: "label_name"
    merge_mode:
        type: "parallel"
        parallel_mode:
            batch_size: 3
            batch_max_wait_minutes: 0

Current workflow

Here is the current workflow of parallel mode. It defaults to batch_size=1 since each additional CI pipeline will combine the changes from 1 PR and all the previous PRs in the queue.

Workflow with batching

By adjusting batch_size, your repo can merge PRs faster with reduced CI runs. Let’s look at an example where batch_size=3 and we have 6 total tagged PRs.

Pipeline #1 will batch together the changes from PR#1, PR#2, and PR#3. Once the CI passes, PRs 1-3 will be merged.

Pipeline #2 will batch together the changes from Pipeline #1 and PR#4, PR#5, and PR#6. Once the CI passes, PRs 4-6 will be merged.

By increasing the batch_size from 1 to 3, we can merge 6 PRs vs 2 PRs in the same time it takes to run 2 CI pipelines.

Here’s a quick comparison of how many additional CI pipelines* are run with different batch sizes for a queue with 10 PRs.

*Additional CI pipelines are the CI runs in addition to the CI that runs on the original PR.

batch_size = 1
batch_size = 3
batch_size = 5

Additional CI Pipelines

10

4

2

Handling Failures

Bisection

It's inevitable that we will run into build failures - we handle this by requeuing PRs into bisected batches.

For example, let's say our batch_size=5 and we have PRs #1-5 in a single batch, with the corresponding draft PR #6.

If the draft PR fails, then we will close draft PR #6, and requeue all of PRs #1-5. These PRs will be put into two bisected batches - the first batch contains PRs #1-3, the second batch contains PRs #4-5.

If a PR in the batch fails, we similarly requeue with bisection. In the above example, if PR #1 fails, then we block PR #1 and requeue PRs #2-5. Those PRs will be requeued into two batches - PRs #2-3 in one batch, PRs #4-5 in the other.

Other FAQs

How do you handle PRs with a skip_label?

All PRs with skip labels will be prioritized. They will be bumped to the top of the queue and will always be in its own batch. PRs with a skip_label will never be batched with other PRs.

What happens if I dequeue a PR?

The corresponding draft PRs as well as any subsequent draft PRs will be closed. PRs in the current batch will be requeued.

What happens if I add a new commit?

If you add a new commit to a PR, the associated draft PR will be closed and all subsequent draft PRs will be reset. The PRs in the batch will be automatically requeued.

What happens if my PR fails to merge but other PRs in the batch succeed?

If your PR fails to merge, we will automatically retry merging again. If it still fails, the PR will be blocked and may require manual changes.

What happens if I close the draft PR associated with multiple PRs?

If you manually close a draft PR, this will trigger a full reset of the queue. All draft PRs will be closed, and all PRs will be requeued.

What happens if I close my PR?

If you manually close a PR that has been queued and has an associated draft PR, this will trigger a full reset of the queue. All draft PRs will be closed and all PRs are requeued.

PreviousMQ Created BranchesNextManaging flaky tests

Last updated 3 months ago

Was this helpful?

Workflow with batch_size=1.
Workflow with batch_size=3.
Bisection if draft PR fails.