Review Each Job for Improvement Opportunities: Opportunities for Jobs with High Duration

1) Resource Allocation

Optimizing the resource classes of your jobs is an easy way to ensure credits aren’t being wasted. Each job has a resource tab in the UI showing the resource usage throughout the job, which is useful while reviewing jobs individually. CircleCI’s Insights UI offers a view of historical usage for every job in a workflow which is more helpful when doing a config review.

A good rule of thumb is a job should be using 50% - 75% of its resources. If a job is outside of that band try out one of the other resource classes for the execution environment being used.

NOTE: Increasing resource class size does not guarantee a job’s duration will be reduced.

2) Caching

Jobs that install dependencies should cache those dependencies to speed up install time for future jobs. Caches are project wide so multiple jobs and multiple workflows can share them.

Most dependencies support using a fallback cache key to allow for a partial cache match. Implementing a fallback cache key can help reduce duration when making changes on a new branch.

Review how specific any current cache keys are and if they need to be more or less specific.

3) Test splitting

Jobs that run tests can most likely be split. Test splitting runs multiple instances of the job in parallel and splits the tests among them, with splitting by timing being the more optimized approach. The parallelism of the job should be set to balance dependency setup time versus test suite duration. The Timing tab in each job’s UI is helpful when reviewing that balance.

4) Docker Layer Caching

Jobs that build docker images can typically benefit from enabling Docker Layer Caching. DLC caches individual docker image layers so they can be used in future jobs.

Next Step: Review Each Workflow for Improvement Opportunities

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.