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 238 discussion

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

You are a lead developer working on a new retail system that runs on Cloud Run and Firestore in Datastore mode. A web UI requirement is for the system to display a list of available products when users access the system and for the user to be able to browse through all products. You have implemented this requirement in the minimum viable product (MVP) phase by returning a list of all available products stored in Firestore.

A few months after go-live, you notice that Cloud Run instances are terminated with HTTP 500: Container instances are exceeding memory limits errors during busy times. This error coincides with spikes in the number of Datastore entity reads. You need to prevent Cloud Run from crashing and decrease the number of Datastore entity reads. You want to use a solution that optimizes system performance. What should you do?

  • A. Modify the query that returns the product list using integer offsets.
  • B. Modify the query that returns the product list using limits.
  • C. Modify the Cloud Run configuration to increase the memory limits.
  • D. Modify the query that returns the product list using cursors.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
wanrltw
10 months, 3 weeks ago
Selected Answer: D
https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets
upvoted 2 times
...
__rajan__
1 year, 1 month ago
Selected Answer: D
Cursors allow you to paginate through the results of a Firestore query. This can be useful for queries that return a large number of results, such as the query that returns the list of all available products.
upvoted 1 times
...
purushi
1 year, 2 months ago
Selected Answer: D
D is correct. Use pagination and return only results in batch/limits when querying for the list of products. This is called lazy loading.
upvoted 1 times
...
bober86
1 year, 8 months ago
Selected Answer: D
https://cloud.google.com/datastore/docs/best-practices#queries
upvoted 1 times
...
Pime13
1 year, 8 months ago
Selected Answer: A
Note: To conserve memory and improve performance, a query should, whenever possible, specify a limit on the number of results returned. https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets
upvoted 1 times
Pime13
1 year, 8 months ago
it's D, not a, wrongly selected
upvoted 1 times
Pime13
1 year, 8 months ago
Although Datastore mode databases support integer offsets, you should avoid using them. Instead, use cursors. Using an offset only avoids returning the skipped entities to your application, but these entities are still retrieved internally. The skipped entities do affect the latency of the query, and your application is billed for the read operations required to retrieve them. Using cursors instead of offsets lets you avoid all these costs
upvoted 1 times
...
...
...
mrvergara
1 year, 9 months ago
Selected Answer: D
While increasing the memory limits of Cloud Run instances could help alleviate the issue temporarily, it would not address the root cause of the problem, which is the high number of Datastore entity reads during busy times. Over time, as more products are added to the system, this problem would only become more severe, and you would have to continually increase the memory limits to prevent Cloud Run from crashing. Using cursors to paginate the results and retrieve a limited number of products at a time is a more sustainable solution as it reduces the amount of data that needs to be read from Datastore and decreases the memory usage of your Cloud Run instances. This way, you can maintain the performance of the system and prevent it from crashing, even as more products are added over time.
upvoted 4 times
...
TNT87
1 year, 9 months ago
Selected Answer: C
The issue is with the memory limits. https://cloud.google.com/run/docs/configuring/memory-limits#optimizing https://cloud.google.com/run/docs/configuring/memory-limits#optimizing
upvoted 1 times
mrvergara
1 year, 9 months ago
https://cloud.google.com/datastore/docs/concepts/queries#cursors Cursors allow you to paginate through query results efficiently, which can help reduce the number of Datastore entity reads and prevent Cloud Run instances from crashing due to exceeding memory limits. By using cursors, you can retrieve only a portion of the query results at a time, instead of retrieving all results in one go, which can help optimize system performance.
upvoted 4 times
mrvergara
1 year, 9 months ago
Option C, increasing the memory limits of Cloud Run, may provide a temporary solution to the issue, but it does not address the root cause of the problem. The root cause is that too many Datastore entities are being read in one go, which is causing Cloud Run instances to exceed their memory limits and crash. Increasing the memory limits simply allows the instances to handle more data in memory, but it does not address the issue of retrieving too much data in one go. Using cursors to paginate through query results, as in option D, is a better solution because it allows you to retrieve only the necessary data at a time, which can help reduce the number of Datastore entity reads and prevent Cloud Run instances from crashing.
upvoted 3 times
NewComer200
1 year, 6 months ago
I agree with Mr. mrvergara If I would image I'm actually creating the code for this program code, I would think current program isn't very good. I'll think I should improve this program better than now firstly. If it's possible, I wouldn't like to add resources.
upvoted 2 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