How to know how to set uvicorn parameters given kubernetes resource limitations

Viewed 144

I have a kubernetes cluster that, let's say, has a given resource limitation:

                            request_cpu: "1000m",
                            request_mem: "1Gi",
                            limit_cpu  : "4000m",
                            limit_mem  : "3Gi",
                            replicas   : "3"

On that cluster I would like to run an uvicorn web server (and python application in it). How to know the best configuration parameters for the uvicorn?

At the moment I tried several combinations with various values for the number of workers and limit_concurrency. Like this:

if __name__ == "__main__":
    uvicorn.run("start:app", host="0.0.0.0", port=8080, reload=True, workers=4, limit_concurrency=20)

Is it generally true that the limit_concurrency should be very high? How would this setting influence the python application that takes 10s to complete when single request is posted?

0 Answers
Related