Hi I am starting to learn about docker swarm so I have a simple question
If I run a single instance of MLFlow in docker swarm with the docker container setup as follows: CMD ["mlflow", "server", "--no-serve-artifacts", "--host", "0.0.0.0", "--workers", "4"]
is that the "same" as running a 4 instances with CMD ["mlflow", "server", "--no-serve-artifacts", "--host", "0.0.0.0", "--workers", "1"] ?
That depends entirely on how MLFlow is used and how it manages its workers.
If you ask Docker Swarm to create 4 instances of the mflow service, it should distribute those instances over your swarms nodes (if you have more than one). This will give you horizontal scalability.
If you tell MFLow to use "4" workers, then each instance will be able to handle 4 requests at a time.
Docker will load balance requests to instances - assuming that server connections last for one request - in a round robin fashion. Which is usually good enough but if some tasks are quick and others long this could cause under-utilised nodes to be skipped over and new requests to be delivered to busy nodes.
On a single node, MLFlow with multiple workers will probably be better at ensuring a request gets picked up by an available worker, so on a multi node swarm you probably will achieve the best results by using a combination of setting workers > 1 to achieve vertical scaling and instances > 1 to achieve horizontal scaling.