I have a large web application on a microservice architecture. The entire infrastructure works in Docker Swarm.
All microservices are worked to Python and run on a uvicorn server.
Uwsgi has its own workers which can be scaled.
In Docker Swarm, you can also scale the application by increasing the replicas of the service.
The question is how to scale the service better:
1) 100 (any other number) replicas of docker swarm - 1 uvicorn worker
2) 10 replicas of docker swarm - 10 uvicorn workers
3) 1 docker swarm replicator - 100 (any other number) uvicorn workers
This appears to be a question of vertical vs horizontal scaling. Docker Swarm will scale service tasks across nodes - allowing you to scale horizontally. Uwsgi is - as I understand it - going to scale vertically by increasing threads in a process, or processes in a vm. Either way, its scaling is restricted to a single node.
Consequently you want enough vertical scaling to reach a target usage on each node before you scale horizontally, otherwise you will have a lot of under-utilised cpu and memory, which most of the time, you pay for.