Codebuild service usage optimization

1

Hello,

Is there a way to optimize the usage of CodeBuild? We are using the CodeBuild a lot these days, and at times QUEUED phase duration is too high, which may be the reason. Is there a way to reduce this duration, because it is causing huge charges for us? I am open to any suggestions to reduce the billing on CodeBuild compute usage.

Thank you in advance.

VK
已提问 5 个月前2030 查看次数
1 回答
1
已接受的回答

CodeBuild has an on-demand fleet, which scales based on incoming customer volume. If capacity is not immediately available, CodeBuild tries to queue the builds for additional capacity to be available in the build fleet. So, QUEUED time is vary based on the resources availability with respect to availability of resources in region. Unfortunately, we do not have any option to reduce Code Build QUEUED phase duration. As said, it is subject to availability and allocation of resources to provision build container in particular region. More importantly, CodeBuild charges are applicable from PROVISIONING phase and QUEUED phase duration not calculated towards billing.

The following are some additional options for cost optimization in relation to CodeBuild.

  • Rightsize your compute resources. CodeBuild allows you to choose from different compute types like BUILD_GENERAL1_SMALL to BUILD_GENERAL3_LARGE. Choosing an appropriately sized instance based on your build workload can help reduce costs.

  • Use AWS Graviton processors where possible. Graviton processors on EC2 instances offer better price performance compared to x86 based instances and can lower your CodeBuild costs.

  • Keep build durations short. CodeBuild charges per minute, so optimizing builds to complete faster helps minimize costs. Some ways to do this include only running necessary steps, using caching, and addressing inefficiencies.

  • Leverage build caching. Caching dependencies, artifacts, and previous build steps can avoid unnecessary recompilation and testing, speeding up builds.

Additionally, I would suggest to verify the compute environments selected and analyze the past month usage metrics Memory and CPU. Based on that data, check the feasibility in selecting lower compute environments to reduce the cost. [+] Monitoring CodeBuild resource utilization metrics: https://docs.aws.amazon.com/codebuild/latest/userguide/monitoring-utilization-metrics.html [+] Build environment compute modes and types: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html#environment.types

profile pictureAWS
已回答 5 个月前
  • Thank you for replying and detailed information about optimization.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则