You have an application that uses Cloud Spanner as a backend database. The application has a very predictable traffic pattern. You want to automatically scale up or down the number of Spanner nodes depending on traffic. What should you do?
A.
Create a cron job that runs on a scheduled basis to review Cloud Monitoring metrics, and then resize the Spanner instance accordingly.
B.
Create a Cloud Monitoring alerting policy to send an alert to oncall SRE emails when Cloud Spanner CPU exceeds the threshold. SREs would scale resources up or down accordingly.
C.
Create a Cloud Monitoring alerting policy to send an alert to Google Cloud Support email when Cloud Spanner CPU exceeds your threshold. Google support would scale resources up or down accordingly.
D.
Create a Cloud Monitoring alerting policy to send an alert to webhook when Cloud Spanner CPU is over or under your threshold. Create a Cloud Function that listens to HTTP and resizes Spanner resources accordingly.
D. Create a Cloud Monitoring alerting policy to send an alert to webhook when Cloud Spanner CPU is over or under your threshold. Create a Cloud Function that listens to HTTP and resizes Spanner resources accordingly.
Without knowing that much, you can discard easily B,C as they don't make any sense. Automation should be a key in this answer. Also you should discard "A" as with a CronJob you won't spann on time as it will be a fixed time checking. So the only one that is left is D, as just creating an alert and sending it to "something else" (in this case a webhook) in an automated way, should be the common sense way of handling this.
Crossed my mind too, but why check every time when you can trigger a response when it happens.
Predictability can also be used to determine the threshold.
The most suitable approach to automatically scale the number of Cloud Spanner nodes based on predictable traffic patterns is:
D. Create a Cloud Monitoring alerting policy to send an alert to a webhook when Cloud Spanner CPU is over or under your threshold. Create a Cloud Function that listens to HTTP and resizes Spanner resources accordingly.
This option utilizes Cloud Monitoring alerts and Cloud Functions to dynamically scale Cloud Spanner resources based on CPU thresholds, providing an automated and responsive solution.
Because even though the traffic has a clear pattern, if the traffic changes one day (like a special holiday for ecommerce websites), you wouldn't be able to serve accordingly. It's never a good practice use fixed jobs for time-based traffic issues.
It's a tricky question. The answer is 'A'.
Question says traffic pattern is predictable. This means you can schedule the scalability.
You can achieve this easily by using Cloud Spanner's API.
https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances/patch
Really tricky indeed...But if you think about it and you don't stick religiously to "traffic pattern is predictable" sentence (that sentence is to trick you), you would think that despite the pattern is very predictable, it could vary at some point in time. With a cron job you can schedule a job using a fixed starting point and a a fixed ending, can't you? Well, what would happen if the app traffic suddenly spikes before your cron job starts running? Or after?. At this point, I go for D, making scalability automatic thanks to Cloud Funtions.
I would say A also, as your explanation doesn't satisfy me, as the question is really clear that traffic is predictable. It doesn't mention any wiggle room.
Option D. There's an official repository that does something similar to provide autoscaling to Cloud Spanner. https://github.com/cloudspannerecosystem/autoscaler
"...and then resize the Spanner instance accordingly." I think the last sentence says that the resize action is done manually. If so, then D is still the right answer.
For the D option, "Create a Cloud Function that listens to HTTP and resizes Spanner resources accordingly." The listen and resize actions is done by Cloud Function.
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.
GCP_Student1
Highly Voted 3 years, 8 months agotheBestStudent
Highly Voted 2 years, 3 months agoFeaRoX
1 year, 10 months agospace_cadet
1 year, 9 months agoBuenaCloudDE
Most Recent 4 months, 1 week agocooldude26
1 year agoscanner2
1 year, 2 months agoCaptain1212
1 year, 2 months agotemppp
1 year, 11 months agojrisl1991
1 year, 10 months agoroaming_panda
1 year, 11 months agoabirroy
2 years, 4 months agoAzureDP900
2 years, 5 months agorsuresh27
2 years, 7 months agoalaahakim
3 years agoRicky_92
3 years agokukabura
3 years, 1 month agoankatsu2010
3 years, 1 month agoBobbyFlash
3 years, 1 month agokuracpalac
9 months, 2 weeks agoerikamrqz
3 years, 1 month agobubblegumbeach
3 years, 1 month agojcols
3 years, 6 months agozaxxon
3 years, 1 month agoryumada
2 years, 3 months agoryumada
2 years, 3 months ago