DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library
  1. DZone
  2. Events
  3. Video Library
  4. Rethinking CI for AI: How to Scale Without Bigger Bills or Longer Builds

Rethinking CI for AI: How to Scale Without Bigger Bills or Longer Builds

Details

Short Summary

AI-assisted development can increase the pace at which developers create and update code, but that does not automatically translate into faster software delivery. More pull requests, commits, builds, and tests can put additional pressure on continuous integration (CI), where runner queues, slow jobs, unnecessary test execution, and flaky failures can extend feedback loops and consume additional compute.

In this webinar, Datadog’s Eric Metaj and Rohin Chandra explain how teams can identify where CI time is being spent and determine whether problems stem from capacity, execution performance, or reliability. Through a demonstration of Datadog CI/CD Optimization, they show how teams can investigate pipeline bottlenecks, detect and manage flaky tests, run only relevant tests, balance test workloads, and measure whether CI improvements are reducing build times and unnecessary compute.

Key Takeaways

1. Separate queue time from execution time before adding capacity

A slow CI experience can have different causes. Jobs may be waiting for available runners, or they may start promptly but take too long to execute. Those problems require different responses.

The presenters recommend separating queue time from execution time before deciding where to invest. Adding runners can address a genuine capacity constraint, but it does not make slow steps faster, eliminate unnecessary tests, or prevent flaky-test reruns.

2. Prioritize the work that actually holds up delivery

Optimizing every long-running job does not necessarily make a pipeline faster. Rohin demonstrates how critical path analysis can identify the jobs that are actually holding the clock and delaying subsequent stages.

This distinction helps teams focus optimization efforts where they can affect overall pipeline duration instead of spending time improving jobs that already run in parallel without delaying completion.

3. Treat flaky tests as a reliability problem, not just an inconvenience

Flaky tests create failures that may be unrelated to a developer's code change. Developers then have to determine whether the failure is legitimate, rerun CI, and potentially interrupt their current work.

Datadog CI/CD Optimization can detect flaky tests, quarantine known flakes so they do not block unrelated changes, and use PR gates to identify newly introduced flaky tests before they reach the default branch. The presenters also demonstrate using BitsAI to investigate and propose fixes for flaky tests.

4. Reduce test execution by selecting tests relevant to each change

Running an entire test suite for every change can consume time and compute even when many tests are unrelated to the code being modified.

Datadog's Test Impact Analysis uses test coverage and test history to determine which tests are relevant to a code change. In the demonstration, tests associated with unchanged code are skipped while relevant tests continue to run, shortening the demonstrated test job from roughly four minutes to about two and a half minutes.

5. Balance tests by expected duration instead of test count

Dividing an equal number of tests among workers does not guarantee an evenly distributed workload because individual tests can take different amounts of time.

The demonstration shows test parallelization using expected test duration to distribute work more evenly. After accounting for tests that could be skipped, Datadog's planning step determined that two workers could handle the demonstrated workload instead of four, completing the test job in about two minutes.

6. Measure reliability and time to pass together

Rohin highlights two useful measures for evaluating CI: unexpected failures and time to pass. Unexpected failures capture failures unrelated to a developer's actual change, while time to pass measures how long it takes to reach a successful build.

Looking at both provides a broader view of CI performance because time to pass can include execution time, queue time, approvals, and retries. Improvements should therefore be evaluated by whether developers receive faster, more dependable feedback rather than by execution speed alone.

Key Insights and Practical Implications

  • Diagnose the source of CI delays before scaling infrastructure

    Practical implication: Break down queue time and execution time for frequently used pipelines before adding runners so teams can determine whether they have a capacity problem or a workflow-performance problem.

  • Optimize the critical path first

    Practical implication: Identify the jobs and steps that actually determine total pipeline duration and prioritize those instead of optimizing long-running work that does not delay the pipeline.

  • Track unexpected failures as a reliability signal

    Practical implication: Monitor how often developers must retry CI to obtain a green build and investigate recurring flaky tests, network failures, timeouts, and other unexpected failure sources.

  • Prevent new flaky tests from accumulating

    Practical implication: Use early flake detection and PR gates to identify newly introduced flaky tests before they reach the default branch, while assigning ownership for fixing existing flakes.

  • Avoid running tests that cannot be affected by a change

    Practical implication: Use test coverage and test history to identify which tests are relevant to a code change and skip tests associated only with unchanged code.

  • Balance test workloads based on duration

    Practical implication: Distribute tests according to their expected execution time rather than simply assigning an equal number of tests to each worker.

  • Monitor CI improvements over time

    Practical implication: Track pipeline duration, queue time, failure patterns, and trends such as median and P95 duration to identify regressions and determine whether optimization efforts are improving delivery.

Frequently Asked Questions

Q: Why can AI-assisted development create pressure on CI?

A: The presenters explain that developers and coding agents can create and update pull requests more frequently. Each update may trigger another build, set of tests, and required checks, increasing the amount of work handled by the same CI infrastructure and test suites.

Q: How can teams determine why CI feels slow?

A: Start by separating reliability problems from performance problems. For performance, compare queue time with execution time. For reliability, examine how often CI must be retried before producing a successful build and investigate the sources of unexpected failures.

Q: Does adding more runners solve slow CI?

A: Only when runner capacity is the constraint. Additional runners can reduce queue time, but they do not inherently make slow jobs faster, eliminate unnecessary test execution, or prevent flaky-test reruns.

Q: What is critical path analysis?

A: Critical path analysis identifies the jobs and stages that determine the total duration of a pipeline execution. Improving a job on the critical path can reduce overall pipeline time, while improving another job running in parallel may have no effect if the pipeline is still waiting for a longer job.

Q: How does Datadog Test Impact Analysis determine which tests to run?

A: According to the demonstration, Datadog uses test coverage to understand which files each test covers. If the covered files have not changed and the test previously passed against that unchanged code, the test can be skipped. Tests whose covered code has changed are run.

Q: How does test parallelization improve performance?

A: Instead of dividing tests by count, Datadog can use expected test duration and the planned worker count to balance the workload. The goal is to prevent one worker with a disproportionately long group of tests from delaying the overall result.

Q: How does Datadog handle flaky tests?

A: The session demonstrates several approaches. Known flaky tests can be quarantined so their failures do not fail CI, early flake detection can identify new flakes, PR gates can prevent newly detected flaky tests from being merged, and BitsAI can assist with investigating and proposing fixes.

Q: What are unexpected failures?

A: Rohin defines unexpected failures as CI failures that are not caused by the developer's code change. Examples discussed in the session include flaky tests, race conditions, and timed-out network requests to third parties.

Q: Which improvement might developers notice first?

A: During the Q&A, Rohin identifies test selection as an improvement teams may notice quickly because developers can receive feedback sooner when tests unrelated to a pull request are skipped.

Transcript

Introduction

Max Crampton-Thomas: Hello, everyone, and welcome to today's DZone webinar, Rethinking CI for AI: How to Scale Without Bigger Bills or Longer Builds. I'm Max Crampton-Thomas, and I'll be your host for today's session.

Before we get started, just a quick bit of housekeeping. Today's session is being recorded, and we'll share the on-demand recording with registrants after the event. If you have questions during the presentation, please feel free to submit them using the Q&A tab. We'll address as many as we can during the Q&A portion at the end.

Now, let's get into what we'll be covering today. AI is helping developers write code faster than ever, but faster coding doesn't always mean faster delivery. As teams produce more code, their CI pipelines have more work to do. Builds can take longer, unreliable tests can lead to repeated runs, and costs start to add up.

So how can teams keep up with the pace of AI-assisted development without slowing things down or spending more?

To help us answer that question, we're joined by two experts from Datadog who will share practical ways to identify CI bottlenecks, improve efficiency, and keep costs under control.

Eric Metaj is a product marketing manager who focuses on helping engineering teams keep CI/CD fast, reliable, and cost-efficient as AI changes the way software gets built.

We're also joined by Rohin Chandra, a product manager for CI/CD Optimization. Rohin works with engineering teams to improve development speed by optimizing their CI pipelines and test suites. Before joining Datadog, he worked as a software engineer at Microsoft.

Eric and Rohin, thanks for joining us today. I'll hand it over to both of you.

How AI-Assisted Development Changes CI

Eric Metaj: Thanks, Max. Thanks for having us.

Good afternoon, everyone. I'm Eric, and today we'll be exploring how AI is helping teams write code faster, what that means for your CI pipelines, and where that extra volume is creating pressure. We'll cover which improvements to prioritize and how to measure whether they're helping your teams ship faster while keeping compute spend in check.

Then we'll bring it all together with a hands-on demo of Datadog CI/CD Optimization to show you what this looks like in practice.

Rohin and I are really excited to walk you through how the space is evolving and our CI/CD Optimization product, so let's get started.

Let's start with what changes when writing and updating code becomes faster but the rest of the delivery workflow stays the same.

In the Google DORA report, more than 80% of respondents said that AI had increased their productivity. That's a meaningful signal about the experience of writing software, but individual productivity and delivery performance are two different measures.

A developer can finish a change sooner and still wait just as long for that release to be validated and released. Coding agents are helping developers move from an idea to a pull request really quickly. They're iterating on that pull request more often, and that changes the demand on the systems downstream.

The practical question is whether review, builds, and tests can absorb that additional commit volume while still giving teams a reliable answer in a reasonable amount of time.

Here's the core question I want to ask everyone: If you could write code 10 times faster, could you actually ship it 10 times faster?

We've begun opening the floodgates on code creation, but that code can get trapped in a delivery-pipeline bottleneck. Organizations may find that their current pipelines weren't built for this volume or velocity.

I like how the Google DORA report frames this: AI acts as an amplifier. If your delivery systems are strong, AI can make you faster. But if your delivery systems are messy, AI can scale that mess.

We're not just talking about shipping faster. We're talking about how we build a delivery system that actually scales with AI.

Here's what that shift looks like across delivery workflows. AI is shortening the time it takes to write and revise code. Developers and coding agents are opening PRs more frequently, and they're pushing more updates to each one.

Every update can trigger another build, another set of tests, and another round of required checks. Even a single PR can create several cycles of CI work before the code is ready to merge.

That means the same team can put substantially more demand on the same runners and test suites. A slow job repeats more often. Unnecessary tests consume more compute, and flaky failures send changes through another round of validation.

The bottleneck is shifting downstream. Code is getting ready sooner while the time and capacity needed to validate it are staying the same.

To turn faster coding into faster delivery, we need to understand where CI is making teams wait and spend more.

Four Sources of CI Pressure

Eric Metaj: This additional demand is putting pressure on CI across four different dimensions.

The first is runner queue time. A job is ready to run, but it's waiting for an available runner or concurrency slot, resulting in a capacity constraint before execution even starts.

Second is slow pipeline execution. The job starts, but a slow step or uneven test distribution might hold up the results. You might have several workers finish while one is still processing a large test group.

The third is excess test execution. Every update runs the full suite, including tests unaffected by that change. That adds execution time and compute to each validation cycle.

Fourth is flaky-test retries. Inconsistent failures trigger repeated work and leave engineers investigating whether the code actually broke something.

The key thing to keep in mind is that, to a developer, all four of these might simply feel like CI is slow. But each needs a different response.

This distinction matters when the first proposed fix might be to add more runners. Let's look at what that helps and what adding more runners leaves unresolved.

When CI queues grow, adding more runners is a natural response. When capacity is the constraint, it can often be the right one. If every runner is busy, extra capacity lets queued jobs start sooner. That reduces the wait before execution begins.

But a larger fleet can also increase infrastructure spend while the work inside each job stays the same. Slow steps still take time, unrelated tests still run, and flaky failures still trigger retries.

You can end up processing more jobs at once without making each change much faster or cheaper to validate.

Think about a developer who finishes a change quickly. With AI, they open a PR and then wait for CI. A job sits in a queue, the test suite takes too long, and flaky failures send them back to investigate.

That's how the problem becomes a cost. Engineering time goes into triage. The fix or feature reaches users later, and unnecessary tests and reruns consume more compute every time the pipeline runs.

As change volume grows, that friction repeats more often. It's eating into the productivity gains that teams are expecting from AI.

A Practical CI Optimization Approach

Eric Metaj: What can teams change to get more value back?

A practical approach is to start with a pipeline that developers rely on every day and work through four areas.

The first is fixing the delays that block the most changes. You can look at both how long a delay lasts and how often it happens. Separating queue time from execution time is a great way to understand which fix is appropriate.

The second recommendation is preventing, containing, and fixing flaky failures. Catch new flaky tests before they merge, limit disruption with retry or quarantine policies, and assign ownership of the underlying fix to someone.

The third recommendation is reducing unnecessary test execution. Use the relationship between tests and the changed code to identify work that you can skip, allowing you to save time and compute on each run.

Then it's about balancing the work that remains. It's important to distribute tests by expected duration so one overloaded worker doesn't hold up the entire result.

All of this is the approach behind Datadog CI/CD Optimization. It brings pipeline and test data together with the information teams need to investigate a run.

Teams can identify bottlenecks delaying delivery, use automation to prevent and address flaky failures, and reduce unnecessary work as CI demand grows.

The goal is to help teams decide what to improve, apply the appropriate capabilities, and see whether those changes are actually driving faster delivery, more reliable feedback, and less wasted compute.

Finding Pipeline Delays

Eric Metaj: Let's start with finding the delays that are holding up delivery.

When a developer says, "My PR is stuck waiting for CI," the first step is finding out where that time is going.

CI/CD Optimization helps you break down pipeline execution into jobs and steps. Teams can investigate the critical path and distinguish waiting for capacity from work that takes too long.

When something fails, Datadog provides details about the job and its related logs. That gives an engineer a starting point for understanding what's actually happening within the code.

Teams can monitor recurring failures and performance regressions before they affect more changes.

But developers also need to trust the feedback they get. That brings us to the next point, which is trusting your CI results.

Managing Flaky Tests

Eric Metaj: A flaky test will often leave a developer wondering, "Did my change break something? Should I rerun the build?"

That uncertainty adds investigation time and repeated work that we want to resolve.

CI/CD Optimization helps developers catch new flaky tests with early flake detection, which we'll be demonstrating shortly. Combined with PR gates, teams can stop a detected flake before it reaches the default branch.

You can also contain the disruption. Bounded retries and quarantine policies help keep recurring flaky tests from blocking unrelated changes while a fix is underway.

Lastly, you can remediate and address the underlying problem. BitsAI, our autonomous agent within Datadog, can help investigate a flaky test, propose a fix, verify it through repeated runs, and even open a PR for the team to review.

Together, these capabilities help teams reduce recurring interruptions and regain confidence in the CI results they're getting. Fewer reruns also mean less wasted compute.

Reducing Unnecessary CI Work

Eric Metaj: Now let's look at the last value proposition of CI/CD Optimization, which is reducing the work each change requires.

As AI increases development activity, teams need a way to handle more changes without their compute costs growing at the same time.

CI/CD Optimization helps teams identify available improvements and review their estimated impact. This gives platform teams a starting point for deciding where to act.

For test execution, we have two capabilities that can help.

Test Impact Analysis uses coverage and test history to identify tests unaffected by a change and skip unnecessary execution.

Test parallelization helps the remaining tests finish sooner. It uses expected duration and the planned worker count to balance the workload. The result is that one long-running group doesn't hold up the entire result.

That's how we connect individual CI improvements to sustainable delivery growth.

Betterment Example

Eric Metaj: Let's put this into practice.

One of our customers, Betterment, used Datadog to improve its pipeline and test workflows, with results across the three outcomes we covered in the previous sections.

They saw their build success increase from 50% to 95%, which allowed them to give developers more dependable feedback. Their pipeline time fell by 75%, taking builds from roughly 40 minutes to 10 minutes, and compute costs fell by more than half.

What connects those numbers is the experience described in the quote on the screen: CI became something that developers could finally trust, freeing them to focus on actually building.

Now, Rohin, let's make this concrete. Show us how CI/CD Optimization works in practice.

Demonstration: Measuring CI Reliability and Performance

Rohin Chandra: Thanks, Eric. I'm Rohin. I'm the product manager for CI/CD Optimization at Datadog.

I'm excited to walk you through the product, show you how you can get the benefit of the AI revolution and how quickly you're able to develop code these days, and how that can impact shipping velocity and help you get to customers as quickly as possible.

What you see here are two metrics that you really need to drive to get the benefit of AI code generation and prevent CI from becoming a bottleneck and source of pain as you ship code.

The first is unexpected failures.

Unexpected failures are failures that are not a developer's fault. CI is supposed to fail when it's flagging a real issue that could become a problem for your customers if it were shipped.

If you introduce a code change that breaks the checkout flow, CI should fail and inform the developer about what's going on so they can address the problem.

Unexpected failures are particularly frustrating because they're not the developer's fault. It could be a flaky test. It could be a race condition. It could be a timed-out network request to a third party.

These are the kinds of failures that aren't helpful for a developer. They cause a lot of context switching. You have to figure out what's going on and then ultimately retry CI.

You want this number to be 0% of your total failure rate. That means CI is reliable as a gauge of what's happening with the code.

Then, of course, there's time to pass. Time to pass is how long it takes you to get a green build. You can't ship until you have a green build.

From the time you start the CI process until you actually have a passing build, how long does that take?

Execution time is one part of this: how long your pipeline is running. It's one of the biggest parts. There are also things like queue time, time waiting for approvals, and time retrying that affect this number.

It's a good metric of both performance and reliability. Ultimately, you want it to be as low as possible.

Investigating Individual Pipeline Executions

Rohin Chandra: How can you actually move these numbers? How do you know what's happening in CI, and how do you make an impact so you can ship as quickly as possible?

With Datadog CI/CD Optimization, as Eric showed you, you get every execution that happens across the repositories in your organization in one place. You can see pipelines, repositories, branches, and their executions here.

As an example, let's say we're about to release to production, and I want to make sure our production-release pipeline is in a good state.

I'm worried about potential reliability issues. I want to make sure our pipeline and production release go off without a hitch.

I can filter by CI pipeline name and our production-release pipeline, and I can see every execution that's happened in the past week.

I notice there was an error recently. The natural thing to do is click into the first error that you notice.

With Datadog, you see what happened during that particular pipeline execution. I can see the jobs and the steps within those jobs, and I can see where the error happened.

It happened in unit tests, particularly this "run unit test" step.

Datadog will show you what happened to cause this failure. I can see there's a failed test here. I can see what happened to this test, and I can quickly put this into an agent to diagnose the problem.

That gives me some peace of mind when I need to do this production release. If there's a failure, I'm going to know what's happening immediately and won't have a problem diagnosing it.

That's reliability. How can I make sure my pipeline stays green and smooth and that we can ship to customers as quickly as we're developing?

Critical Path Analysis

Rohin Chandra: There's also the performance aspect.

Even if this particular pipeline is pretty quick, there can be production-release pipelines that are hours long. Even if you're able to get a passing build, it's going to take a long time to get that shipped to production.

You can also investigate performance with Datadog.

Let's take a look at a different pipeline. Here I can see the executions that have happened for this test-and-deploy pipeline.

I can sort by duration. I'm interested in performance, so I can sort by the executions in the past week that took the longest.

This is where critical path analysis is very helpful.

I want to reduce how long this execution takes, but there are so many jobs and stages. Which ones are actually relevant?

The critical path shows you where your effort would be best spent.

As an example, this job you see here, "deploy deliveries proxy GCP," is on the critical path. That means this job is holding the clock. You're waiting for this job to finish before you can move on to the next step.

Even though there are things running in parallel, this stage takes the same amount of time as this job. If I reduce the time of this job, I'd reduce the time of the stage and the overall pipeline execution time.

In contrast, if I reduced the time of this 42-minute job, that wouldn't actually make a difference in execution time because we're still waiting for this 51-minute job to finish.

Finding Organization-Wide CI Problems

Rohin Chandra: Looking at individual executions can help you figure out what's happening if you already have some sense of where you're looking.

Maybe I know I want to look at the production-release pipeline, or I know I want to look at a particular pipeline name.

If you don't know where to start and you're interested in what's happening across your repositories, you can also run queries in aggregate.

Let's say I want to take a look at all the job failures that have happened in the past week by error domain.

This helps you understand, in aggregate and from a zoomed-out view, which failures are happening across the organization.

I can see that we have a lot of network failures, a lot of timeout failures, and not that many test failures causing CI to fail. Network issues therefore seem to be the most important thing for us to investigate as an organization here.

Similarly, you can run queries on performance to help you understand what's happening across all your pipelines, not just a specific one.

If I look at exclusive time on the critical path by job name, what I'm seeing are the jobs causing the most holdup or blockage across every pipeline execution in the past week.

These are the jobs that are exclusively holding the clock.

This test-listen job, for example, has spent an hour and 17 minutes on the critical path this past week. If I don't know where to start, this gives me a prioritized list of where to start.

As Eric mentioned, queue time is another important factor to consider when you're thinking about how best to optimize CI and allocate resources so your delivery pipelines are as efficient as your code generation.

You can look at the jobs that are waiting the most in the queue. This gives you a sense of what percentage of time you're waiting in the queue versus what percentage is spent on execution.

Where is your effort best spent? Is it best spent optimizing the jobs that are running, or is it best spent figuring out an allocation that minimizes queue time?

With Datadog, you can also create dashboards to your liking. Instead of building these queries on demand using the explorer, you can create permanent dashboards that give you a bird's-eye view of what's happening at any moment.

This is an example of the type of dashboard you could create. You can look at your slowest pipelines, median duration, P95 duration, and trends over time.

This is particularly important when you're looking at regressions.

I'm noticing here that this pipeline has a pretty big regression in median pipeline time. I should probably investigate and figure out what's slowing down that particular pipeline.

Was there a new change introduced that's causing this to become more of a bottleneck for us?

Detecting, Quarantining, and Fixing Flaky Tests

Rohin Chandra: It's one thing to have complete visibility into what's happening across your executions, but it's another to actually be able to make changes.

What Datadog can offer, especially with CI/CD Optimization, are proactive things we can do on your behalf to help with performance and reliability. I'll go through some of those now.

One thing that's a real pain for software engineers is flaky tests.

Flaky tests make you retry pipelines constantly. You have to context-switch to figure out whether a test failure is valid or whether it's unrelated to what you're working on.

Overall, flaky tests cause you to burn CI time and ultimately slow down your ability to deliver.

With Datadog, we can detect the flaky tests in a repository and take actions on them.

These are the flaky tests that we see. Some are quarantined.

Quarantining a test means the test is still going to run, but if it fails, we know it's flaky and we're no longer going to fail CI because of it.

For this particular test, we can see the impact score. In the last seven days, 777 pipelines would have failed without quarantining this test.

That's how you can mitigate existing flaky tests.

If you want to go to the next level and get rid of these entirely, you can use our coding agent, BitsAI, to start a session and push up a PR to fix the test.

Instead of doing that one by one, you can also create automations.

Let's say I want to come in every Monday morning with five PRs to review for fixing flaky tests. I can create an automation that will fix five on a certain schedule and let me review those every Monday morning.

I can leave on Friday knowing this automation is going to run, and I'll have five flaky-test fixes when I walk into the office on Monday morning.

It's one thing to prevent or deal with flaky tests that exist today. You can fix them, quarantine them, or mitigate their effects.

But ideally, you'd like to stop the problem at the root. Let's make sure no new flaky tests enter the repository.

With Datadog, you can set up a PR gate to detect new flaky tests on PRs and prevent them from being merged if we detect a new flaky test.

Here's an example of what you would see. We're seeing that our PR introduced a new flaky test. This is the test that was detected.

This happens by running new tests a few times to make sure they're valid tests. If we run the test a few times, we'll either see it pass 100% of the time or we'll see conflicting passes and failures.

Since the code behind it is the same, conflicting passes and failures tell us the test is flaky.

This helps you stop the problem at the root and prevent new flaky tests from entering your repository and making the problem worse.

That's reliability. It's helping you make sure your builds are giving you valid failures when tests fail and helping minimize the number of retries that need to happen, if they need to happen at all.

Test Impact Analysis

Rohin Chandra: On performance, we have other options we can use to make sure pipeline executions are as quick and efficient as possible.

This goes back to what Eric was talking about earlier with test splitting and being smart about test duration.

As you generate more PRs, the burden of testing shouldn't become prohibitive. With the number of PRs and commits being generated every day, tests are running more often.

Not all of those tests always need to be run to validate the code.

As an example, this is Datadog Test Impact Analysis.

With Test Impact Analysis, we select the tests that are relevant to a given code change and skip tests that aren't relevant to the code change happening on that PR.

This can help save time.

Without Test Impact Analysis, in this case we have some splitting and parallelization happening, but it's still taking about four minutes to get through this test job.

We're blocked by this first node, which takes three minutes and 50 seconds. We're going to be stuck waiting for that to finish.

With Test Impact Analysis, you'll see a significant difference.

We're getting down to two minutes and 30 seconds here because we're skipping tests that aren't relevant to this PR.

If I click in, I can see these are the tests that are running. They're running and passing, with no issues there.

These tests are all being skipped because the code they actually test has not changed. They're not testing changed code in this PR, so they're not relevant to judging the quality of the PR. We can skip those and get through the testing process more efficiently.

So, 48 passed, 192 skipped, and we're done in two minutes.

Test Parallelization and Worker Allocation

Rohin Chandra: You may notice that even with Test Impact Analysis, we're still splitting the work unevenly.

We have two minutes and 30 seconds on node zero here. Everything else is taking 30 seconds. This first node is doing a lot more work than anything else, and that's slowing us down.

This is where test parallelization comes in: the ability to split tests by duration.

Instead of splitting tests by number, split them by duration so that each worker can finish at roughly the same time.

To give you an example, this is how it would look with test parallelization.

There's a planning step here. It's going to take about 30 seconds to understand which tests we actually need to run, which tests we're skipping, how long those tests take, how many workers we need, and what the split should be between those workers.

In this case, we were actually able to reduce the number of workers we needed based on the expected duration and the tests we were skipping.

We realized we only needed two workers to get through this test job, compared with the four that would be used without test optimization in Datadog.

Overall, this is taking us two minutes to get through instead of four minutes.

Again, what's happening here is a planning step to understand which tests we're skipping, how long each test we're actually going to run takes, and then select the number of workers that provides an efficient way to get through the workload.

We're not only saving time here; we're also saving some cost because we're using less compute.

These are the kinds of strategies you'll need to keep up with what's happening with AI-assisted development.

With the number of PRs being produced and the number of tests being written, especially tests being written by AI agents, running tests as efficiently as possible can help keep CI pipelines moving smoothly and ultimately deliver that impact to customers.

That's everything we had for you today. I'll hand it back over to you, Max.

Q&A

Max Crampton-Thomas: Thank you, Eric and Rohin. That was a great look at how teams can keep their CI pipelines running efficiently even as AI helps developers produce more code.

We've had some great questions come in from the audience, so I want to take a few minutes to address those.

For the first one: Where should a team start if developers say CI is slow, but nobody agrees on the cause?

Rohin Chandra: That's a great question.

The first thing to understand when developers say CI is slow is: Do we have a reliability problem, or do we have a performance problem? If we have one of those problems, where is it coming from?

On the reliability front, I would start with how often we're retrying CI. How often do we need multiple runs to get a green build?

For the performance problem, I would look at how long we're spending waiting for jobs to be picked up in our queue versus how long the jobs are actually running.

If we're waiting for jobs to be picked up in our queue, potentially we need to look at optimizing our infrastructure.

If jobs are simply running for a very long time, then it's more about optimizing your workflows and understanding how you can reduce the duration of those jobs.

Max Crampton-Thomas: Absolutely. For the next question: How can teams tell whether jobs are waiting for runners or simply running slowly?

Rohin Chandra: With waiting for runners, you need visibility into your queue-time metrics.

You need to understand, at the job level or pipeline level, how much of your time is queue time, either in aggregate or for specific pipelines you care about, versus how much is execution time.

Being able to separate queue time from execution time is really how you would tell.

Max Crampton-Thomas: This one runs right in line with that: How does running only relevant tests work on a normal PR?

Rohin Chandra: There are a few approaches to this.

With Datadog and what I demonstrated with Test Impact Analysis, the way we do it is by coverage.

We understand, for every test, which files that test covers. If we see that those files are unchanged and the test previously passed on those unchanged files, we know the code change in question isn't changing something relevant to that test.

Therefore, we can skip it.

If we see that the files covered by that test have changed, then that's when we'd run the test.

Max Crampton-Thomas: I believe we have time for maybe one more question. Which improvement would teams notice first?

Rohin Chandra: I think the biggest improvement teams would notice first would be test selection.

Those are pretty immediate things to see on a PR. You're getting feedback much faster. As soon as you're pushing, you're seeing tests run faster and getting the feedback you need to keep going.

That's the first thing I think teams would notice.

Closing Remarks

Max Crampton-Thomas: Absolutely.

I want to thank you both again for your time and for sharing your insights today.

As we heard, keeping CI running efficiently is becoming even more important as AI speeds up software development. Teams don't necessarily need more resources to keep up. A better understanding of where time and compute are being spent can go a long way toward improving performance and controlling costs.

If you'd like to learn more, be sure to check out the resources shared during today's session.

Eric and Rohin, before we wrap up, I'd love to hand it back to you to share how attendees can learn more about Datadog CI/CD Optimization.

Eric Metaj: Thanks, Max, and thanks to everyone for taking some time out of your day to join us.

To learn more about CI/CD Optimization, I highly recommend checking out the resources on the screen right now.

On the left, you have a QR code to help you get started with the product. On the right, we have a blog that Rohin and I wrote that goes into a little more detail about everything you heard today.

Max Crampton-Thomas: Absolutely. Again, thank you to everyone who joined us today.

Keep an eye on your inbox for the on-demand recording, and we hope to see you at a future DZone webinar. Have a wonderful day, everybody.

Presenters:

Presenter Avatar

Eric Metaj

Product Marketing Manager, Datadog

Presenter Avatar

Rohin Chandra

Product Manager, Datadog

Join Now for More Content & Events

For event and sponsorship inquiries, please email: [email protected]

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook