exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 140 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 140
Topic #: 1
[All Professional Cloud Developer Questions]

You are configuring a continuous integration pipeline using Cloud Build to automate the deployment of new container images to Google Kubernetes Engine (GKE). The pipeline builds the application from its source code, runs unit and integration tests in separate steps, and pushes the container to Container Registry. The application runs on a Python web server.

The Dockerfile is as follows:


FROM python:3.7-alpine -

COPY . /app -

WORKDIR /app -
RUN pip install -r requirements.txt
CMD [ "gunicorn", "-w 4", "main:app" ]

You notice that Cloud Build runs are taking longer than expected to complete. You want to decrease the build time. What should you do? (Choose two.)

  • A. Select a virtual machine (VM) size with higher CPU for Cloud Build runs.
  • B. Deploy a Container Registry on a Compute Engine VM in a VPC, and use it to store the final images.
  • C. Cache the Docker image for subsequent builds using the -- cache-from argument in your build config file.
  • D. Change the base image in the Dockerfile to ubuntu:latest, and install Python 3.7 using a package manager utility.
  • E. Store application source code on Cloud Storage, and configure the pipeline to use gsutil to download the source code.
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
__rajan__
7 months, 1 week ago
Selected Answer: AC
AC is correct.
upvoted 1 times
...
purushi
8 months, 3 weeks ago
Selected Answer: AC
Apart from A and C, one more good option would be to copy the app directory only after RUN pip install so that we can avoid this copying part repeatedly after each layer build.
upvoted 1 times
...
telp
1 year, 3 months ago
Selected Answer: AC
A is correct because a high-CPU virtual machine type can increase the speed of your build. B is not correct because a Container Registry on a VM will not speed up the build. C is correct because the same container is used in subsequent steps for testing and to be pushed to the registry. D is not correct because an ubuntu container image will be significantly larger than the python:3.7-alpine image. E is not correct because storing the application source code on Cloud Storage does not decrease the time to build the application.
upvoted 2 times
...
omermahgoub
1 year, 3 months ago
Selected Answer: AC
https://cloud.google.com/build/docs/optimize-builds/increase-vcpu-for-builds https://cloud.google.com/build/docs/optimize-builds/building-leaner-containers#building_leaner_containers Yes, answer A and C are both valid solutions based on the articles you linked. Increasing the number of vCPUs allocated to the Cloud Build VM can help to decrease build time because it provides the build environment with more CPU resources to use, which can help to speed up the build process. This can be achieved by selecting a VM size with higher CPU for Cloud Build runs. as mentioned, caching the Docker image for subsequent builds can also help to decrease build time by reusing previously built image layers. This can be achieved by adding the --cache-from argument to the build command in the build config file, which tells Cloud Build to use the specified images as a cache source.
upvoted 1 times
omermahgoub
1 year, 3 months ago
Option E Storing application source code on Cloud Storage and configuring the pipeline to use gsutil to download the source code can also be a good way to optimize the pipeline. However, it may be less effective than option A and C, so it may be less beneficial to be chosen as a single solution. In summary, option A and C are the best solutions that can help to optimize the CI/CD pipeline in this scenario as they directly impact the build process and it also depend on the current infrastructure and requirements of your pipeline if you consider using other options.
upvoted 1 times
...
...
TNT87
1 year, 4 months ago
https://cloud.google.com/build/docs/optimize-builds/increase-vcpu-for-builds Answer A https://cloud.google.com/build/docs/optimize-builds/building-leaner-containers#building_leaner_containers Answer C
upvoted 2 times
...
zellck
1 year, 4 months ago
Selected Answer: AC
AC is the answer. https://cloud.google.com/build/docs/optimize-builds/increase-vcpu-for-builds By default, Cloud Build runs your builds on a standard virtual machine (VM). In addition to the standard VM, Cloud Build provides several high-CPU VM types to run builds. To increase the speed of your build, select a machine with a higher vCPU to run builds. Keep in mind that although selecting a high vCPU machine increases your build speed, it may also increase the startup time of your build as Cloud Build only starts non-standard machines on demand. https://cloud.google.com/build/docs/optimize-builds/speeding-up-builds#using_a_cached_docker_image The easiest way to increase the speed of your Docker image build is by specifying a cached image that can be used for subsequent builds. You can specify the cached image by adding the --cache-from argument in your build config file, which will instruct Docker to build using that image as a cache source.
upvoted 1 times
...
sharath25
1 year, 4 months ago
Selected Answer: AC
A and C are correct
upvoted 1 times
...
test010101
1 year, 4 months ago
why don't I see community voted progress bar?
upvoted 1 times
...
gardislan18
1 year, 4 months ago
Selected Answer: AC
IMHO D - alpine is a much smaller distro B and E - does not make sense https://cloud.google.com/build/docs/optimize-builds/increase-vcpu-for-builds https://cloud.google.com/build/docs/optimize-builds/speeding-up-builds
upvoted 4 times
test010101
1 year, 4 months ago
thank you so much
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago