{
  "id": "cloud/gcp-cloud-run-cold-start-memory-overhead",
  "signature": "Cloud Run container instance startup latency due to memory overhead from sidecar logging agent",
  "signature_zh": "Cloud Run 容器实例因边车日志代理的内存开销导致启动延迟",
  "regex": "Container.*startup.*latency.*memory.*sidecar|Cloud Run.*OOM.*sidecar",
  "domain": "cloud",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A sidecar logging agent (e.g., Fluent Bit) running in Cloud Run consumes significant memory during cold start, causing the container to exceed its memory limit and restart multiple times before stabilizing.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Cloud Run 中运行的边车日志代理（例如 Fluent Bit）在冷启动期间消耗大量内存，导致容器超出其内存限制并在稳定前多次重启。",
  "versions": [
    {
      "version": "Cloud Run: gcloud CLI >= 400.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Fluent Bit: >= 1.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Google Cloud SDK: >= 350.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Blindly increasing memory may mask the issue but doesn't address the sidecar overhead; costs increase without guaranteed stability.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removing logging loses critical observability data; Cloud Run's built-in logging may not support custom log formats or destinations.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Cloud Run doesn't allow separate CPU allocation for startup; CPU and memory are coupled, so this isn't a valid configuration.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Configure the sidecar logging agent with a lower memory buffer and pre-allocate memory in the container startup command. Example for Fluent Bit: set 'storage.backlog.memory_limit' to 10M and 'storage.memory_buf_limit' to 5M in fluent-bit.conf.",
      "success_rate": 0.8,
      "how": "Configure the sidecar logging agent with a lower memory buffer and pre-allocate memory in the container startup command. Example for Fluent Bit: set 'storage.backlog.memory_limit' to 10M and 'storage.memory_buf_limit' to 5M in fluent-bit.conf.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use Cloud Run's built-in logging instead of a sidecar agent; forward logs via stdout/stderr and use Google Cloud Logging filters for parsing.",
      "success_rate": 0.85,
      "how": "Use Cloud Run's built-in logging instead of a sidecar agent; forward logs via stdout/stderr and use Google Cloud Logging filters for parsing.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement a startup probe in Cloud Run that delays traffic until the sidecar agent is ready, using a health check endpoint that verifies logging agent initialization.",
      "success_rate": 0.75,
      "how": "Implement a startup probe in Cloud Run that delays traffic until the sidecar agent is ready, using a health check endpoint that verifies logging agent initialization.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Configure the sidecar logging agent with a lower memory buffer and pre-allocate memory in the container startup command. Example for Fluent Bit: set 'storage.backlog.memory_limit' to 10M and 'storage.memory_buf_limit' to 5M in fluent-bit.conf.",
    "Use Cloud Run's built-in logging instead of a sidecar agent; forward logs via stdout/stderr and use Google Cloud Logging filters for parsing.",
    "Implement a startup probe in Cloud Run that delays traffic until the sidecar agent is ready, using a health check endpoint that verifies logging agent initialization."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cloud.google.com/run/docs/configuring/memory-limits",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}