Hi,
I have a Google Cloud Run service running with Django under the hood. Usually, I would use celery to carry out long background tasks but as I have learnt, this is not possible in Google Cloud Run. So, I decided to use Cloud Tasks. Let me give you an overview of the setup I have currently:
- The docker image which runs Django through Gunicorn runs a entrypoint command
“gunicorn wsgi:application --bind 0.0.0.0:8080 --workers 4 --threads 32 --timeout 0”
-
My Cloud Run service is configured in such a way that each container has 8 GB of memory and has 4 vCPUs. So, I am spawning 1 worker per core and 8 threads per core.
-
Now, I have a cloud scheduler scheduled every hour which calls the cloud run service api which then creates several google cloud tasks (almost 3000 to be precise.)
-
I have the task queue to dispatch 1 task every second and max concurrent dispatches to 60.
With all the above setup, when I try to run the google cloud tasks, I find that the Cloud Run service slows down even though I have multiple workers and threads spawned.
If you could help me out in suggesting how I can replicate the behaviour of celery in Cloud Run service. If I cannot replicate the behaviour, how can I solve the above issue I am facing?