简体   繁体   中英

How many server workers per microservice - Gunicorn with Uvicorn in FastAPI

I'm not sure how many workers should I declare per every FastAPI based microservice. Some information I found here: gunicorn - how many unicorn workers do I have to have in production

As I understand number of workers should be:

number_of_workers = number_of_cores x num_of_threads_per_core + 1

So if I have 4 services based on FastAPI and my processor have 4 cores and 8 threads I should divide workers per service? Like for example:

number_of_workers = 4 x 8 + 1
number_of_workers = 33

fastapi_service_1 - 9 workers
fastapi_service_2 - 8 workers
fastapi_service_3 - 8 workers
fastapi_service_4 - 8 workers

fastapi_service - in this case, 4 workers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM