
Master-Worker Architecture …
分布式系統中常見的架構。一個 Master 可以跟多個 Worker 溝通,Worker 之間也可以互相溝通。
It is a common architecture in distributed systems. One master can communicate with several workers and workers can communicate with each other.
How Master-Worker works …
In term of Master
1.
可以作為接口,接收外面的請求。
Master can be the entry and receive the requests.
2.
指定任務給 worker。
Assign tasks to workers.
3.
定期發訊息給 worker ,確保 worker 運作正常。
Periodically sends message to worker to ensure it is functional.
In term of Worker
1.
向 Master 註冊自己的訊息。
Register itself to master.
2.
接收來自 Master 的任務,並回傳結果。
Received tasks from master and reply to master.

Advantages …
1.
Master 可以協調 Worker 的工作量。
Master can coordinate workload of each worker.
2.
Master 定期訪問 Worker,若 Worker 失敗,可以重新分配任務。
By periodically pinging workers, master can monitor workers and reassign tasks if workers failed.
Disadvantages …
1.
需要大量的溝通。
There are amount of communication.
2.
確保一致姓。
Make sure the consistency.
3.
需要錯誤容忍 (如何處理 Master 跟 Worker 的錯誤)。
Needs Fault tolerance. (How to handle if master or worker failed.)
-MsHe