Google Professional Cloud Developer Question 262
Select 3Google Cloud PlatformYou are a developer working on a CI/CD pipeline in Google Cloud Build. Your team is experiencing long build times due to redundant steps and large container image sizes in the build process. Which strategies should you implement to optimize the build process and reduce build times?
- A
Use caching for build steps that don’t change frequently.
- B
Switch to a single large monolithic container image for all microservices.
- C
Configure Cloud Build to use parallel builds for independent steps.
- D
Optimize container base images by using minimal base images like
distroless. - E
Always rebuild all dependencies from scratch to ensure consistency.
Show answer and explanation
Correct answers: A, C, D
Explanation
To reduce build times, it is essential to focus on strategies like caching, parallelizing independent steps, and optimizing base images. Caching minimizes redundant work, parallel builds utilize available resources more efficiently, and lightweight container images reduce build, transfer, and deployment times. Avoid practices like unnecessarily rebuilding or creating large monolithic images, as they counteract optimization efforts.
- A. Correct.
Using caching for build steps reduces redundant work by reusing intermediate artifacts, which can significantly speed up the build process.
- B. Incorrect.
Switching to a single large monolithic container image is not optimal for microservice architectures, as it increases image size and reduces flexibility in deployments.
- C. Correct.
Configuring Cloud Build to use parallel builds for independent steps can reduce build time by running tasks concurrently, instead of sequentially.
- D. Correct.
Optimizing container base images by using minimal base images like
distrolessreduces image size, leading to faster builds and deployments. - E. Incorrect.
Rebuilding all dependencies from scratch is counterproductive for optimization, as it increases build time unnecessarily unless there are specific consistency issues.