Hi everyone, so I have a local running Fastapi app that upon receiving a request, starts a background task (using Fastapi background tasks) and upon completion writes the response to the database. This works well when the app is running locally when I start multiple background tasks around the same time with my requests and it successfully writes to my cloud/supabase database. However, when I deploy this same app to my cloud run (Note I use 'cpu always allocated' instance with a 6cpu and 6 gb ram) 1 background task seem to be running okay, but when I start multiple tasks simultaneously with requests, it seems to stop processing after a while and nothing seems to be happening, ultimately the cloud run container shuts down and database is also not populated. I looked at my container usage and my cpu and ram are sufficient enough for this, and even if not I expected it to start multiple instances to process. Also note I don't see any logs in my Cloud run console.
Hi @knet, thanks for your response. This got resolved for me by adjusting the concurrency settings and increasing on some resources for my container.