Performance Issue
What happened:
When the app has not been used for a while,
the first API request (login or loading todos)
takes 3-5 seconds longer than normal.
Root cause:
Google Cloud Run is set to min-instances=0.
This means the container shuts down when idle.
When a request comes in, Cloud Run must
start the container first (called "cold start").
This adds 3-5 seconds to the first request.
Expected behavior:
API should always respond within 500ms.
Solutions:
Option 1 (Recommended for production):
Set min-instances=1 in Cloud Run.
Command:
gcloud run services update todo-backend
--region=asia-south1 --min-instances=1
Cost: approximately $5-10/month
Option 2 (Free solution):
Add a warmup ping from frontend.
When frontend loads, immediately call /health
to wake up the backend before user tries to login.
Acceptance Criteria:
Performance Issue
What happened:
When the app has not been used for a while,
the first API request (login or loading todos)
takes 3-5 seconds longer than normal.
Root cause:
Google Cloud Run is set to min-instances=0.
This means the container shuts down when idle.
When a request comes in, Cloud Run must
start the container first (called "cold start").
This adds 3-5 seconds to the first request.
Expected behavior:
API should always respond within 500ms.
Solutions:
Option 1 (Recommended for production):
Set min-instances=1 in Cloud Run.
Command:
gcloud run services update todo-backend
--region=asia-south1 --min-instances=1
Cost: approximately $5-10/month
Option 2 (Free solution):
Add a warmup ping from frontend.
When frontend loads, immediately call /health
to wake up the backend before user tries to login.
Acceptance Criteria: