feat(infra): add cost optimization and performance variables for Cloud Run and Redis VPC connector - #209
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces configuration options for CPU idle mode and startup CPU boost for Cloud Run services (datacommons_services and ingestion_helper), as well as configurable scaling parameters (min_instances and max_instances) for the Redis VPC Access Connector. The review feedback highlights that the newly added cpu_idle and startup_cpu_boost variables in the ingestion_helper module are not threaded through the parent stack module, rendering them unconfigurable. Additionally, it is recommended to add Terraform validation blocks to both the root and module-level VPC connector instance variables to enforce GCP's strict limit requirements (minimum between 2 and 9, maximum between 3 and 10) during the planning phase.
|
Thank you @saurabh-google ! Were you able to test this in a live environment? |
I have tested it for a live deployment and I can see the Cloudrun > Revision History > Billing change to Request-based from Instance-based. |
…ional type to number
Motivation
Custom Data Commons setups already provide knobs like
cpu_idleto optimize infrastructure costs for dev and low-traffic environments. Bringing these same customization options to DCP enables teams to reduce baseline cloud spend while maintaining fine-grained control over performance.Summary
This PR exposes configurable Terraform variables to enable cost optimization and performance tuning for DCP (Data Commons Platform) deployments.
Changes
Cloud Run Resource Controls (
cpu_idle&startup_cpu_boost):cpu_idle(defaultfalse) andstartup_cpu_boost(defaulttrue) configurations todatacommons_servicesandingestion/helper_serviceCloud Run services.cpu_idle = trueallows CPU to only be allocated during request processing, reducing running costs for lower-traffic environments.startup_cpu_boostmitigates cold start latencies during container boots.Redis VPC Access Connector Scaling:
vpc_connector_min_instances(default2) andvpc_connector_max_instances(default10) in theredismodule.Templates & Variables:
terraform.tfvars.template.variables.tf,main.tf, and thestackmodule with backwards-compatible defaults.Testing