问题描述
我一直在研究新的Docker Swarm模式,它将在Docker 1.12中可用。在此视频中,他们创建了一个由单个Nginx容器组成的简单Nginx服务。在视频中,它们在Swarm群集中有4个节点。在扩展演示期间,他们将复制因子增加到10,从而在群集中的所有4台计算机上创建了10个Nginx容器副本。
I have been looking into the new Docker Swarm mode that will be available in Docker 1.12. In this Docker Swarm Mode Walkthrough video, they create a simple Nginx service that is composed of a single Nginx container. In the video, they have 4 nodes in the Swarm cluster. During the scaling demonstration, they increase the replication factor to 10, thus creating 10 copies of the Nginx container across all 4 machines in the cluster.
我知道视频是只是一个演示,但在现实世界中,与Swarm集群中的节点相比,创建更多容器(或服务)副本的意义何在?这似乎毫无意义,因为同一台机器上的两个容器无论如何将共享该机器有限的计算资源。我不明白这样做有什么好处。
I get that the video is just a demonstration, but in the real world, what is the point of creating more replicas of a container (or service) than there are nodes in the Swarm cluster? It seems to be pointless since two containers on the same machine would be sharing that machines finite computing resources anyway. I don't get what the benefit is.
所以我的问题是,复制Docker服务或容器是否超出了节点数,在现实世界中是否有好处?集群?
So my question is, is there any real world benefit to replicating a Docker service or container beyond the number of nodes in the Swarm cluster?
谢谢
推荐答案
这取决于应用程序的方式处理线程和多个请求。单线程应用程序或一次仅处理一个请求的作业可能会使用一部分OS资源,并受益于在单个主机上运行多个实例。调整为可以同时处理请求并且充分利用操作系统的应用程序将看不到任何好处,并且实际上会受到占用资源以运行该应用程序的多个实例的惩罚。
It depends on how the application handles threading and multiple requests. A single threaded application, or job that only handles one request at a time, may use a fraction of the OS resources and benefit from running multiple instances on a single host. An application that's been tuned to process requests concurrently and which fully utilizes the OS will see no benefit and will in fact incur a penalty of taking away resources to run multiple instances of the application.
这篇关于在Docker Swarm模式下,复制服务是否比可用主机数更多?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!