Docker Swarm 服务复制

huangapple go评论60阅读模式
英文:

Docker swarm service replication

问题

  1. 100(或其他任何数量)个Docker Swarm副本 - 1个uvicorn工作进程
  2. 10个Docker Swarm副本 - 10个uvicorn工作进程
  3. 1个Docker Swarm副本 - 100(或其他任何数量)个uvicorn工作进程
英文:

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

答案1

得分: 1

这似乎是一个关于纵向与横向扩展的问题。
Docker Swarm将服务任务分布在节点之间,允许您进行横向扩展。
据我理解,Uwsgi将通过增加进程中的线程或虚拟机中的进程来进行纵向扩展。无论哪种方式,它的扩展都受限于单个节点。

因此,在横向扩展之前,您需要足够的纵向扩展以达到每个节点上的目标使用率,否则您将有大量未充分利用的CPU和内存,而大多数时间都需要付费。

英文:

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.

huangapple
  • 本文由 发表于 2023年7月10日 14:57:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76651329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定