AZ-400 Question 206
Select 2You manage an Azure Pipelines setup for a complex microservices application that builds and tests multiple projects with thousands of dependencies. The pipeline triggers automatically on every commit, and you�ve noticed that builds take a long time to complete, dependencies are downloaded repeatedly, and overall costs have increased due to frequent pipeline executions. Additionally, test environment capacity issues sometimes cause pipeline failures. You need to optimize the pipeline for cost, time, performance, and reliability without compromising code quality. Which two actions should you implement?
- A
Implement dependency caching within your build process to avoid downloading libraries for each run
- B
Enable performance tests to run on every commit in the production environment
- C
Limit pipeline triggers to important events (e.g., merges to main or pull requests) instead of every commit on all branches
- D
Increase the size of your hosted build agent to accommodate larger builds in a single job
Show answer and explanation
Correct answers: A, C
Explanation
Optimizing pipelines involves reducing repetitive work and focusing builds on critical code changes. Implementing caching prevents redownloading identical dependencies, drastically cutting build time and cost. Limiting triggers ensures that pipelines run only when necessary, reducing resource consumption and potentially improving reliability by decreasing load on testing environments. Refer to Microsoft documentation on Azure Pipelines caching, triggers, and best practices for further guidance.
- A. Correct.
Correct. Implementing caching, such as using Azure Pipelines Caching, significantly reduces redundant package downloads, thus improving performance and lowering costs. Documentation: https://docs.microsoft.com/azure/devops/pipelines/caching.
- B. Incorrect.
Incorrect. Running performance tests on every commit in production increases costs and puts production stability at risk. It is more efficient to schedule performance tests for select builds or specific stages.
- C. Correct.
Correct. Restricting triggers to only critical branches reduces unnecessary pipeline runs, saving both time and cost while maintaining sufficient reliability checks for production code. Documentation: https://docs.microsoft.com/azure/devops/pipelines/build/triggers.
- D. Incorrect.
Incorrect. Simply increasing the size of the build agent may help with performance if resource bottlenecks exist, but it does not address repeated dependency downloads or reduce the frequency of pipeline executions, thus not effectively optimizing cost and reliability.