Distributed System

前端 未结 2 734
孤独总比滥情好
孤独总比滥情好 2021-01-07 08:27

I am looking to create a distributed framework in Java and need some help sorting out the implementation of a client/manager/worker situation as described in my pseudocode b

2条回答
  •  一向
    一向 (楼主)
    2021-01-07 09:08

    Q: The manager can accept multiple connections, each connection is run as a thread but how do I differentiate between a client connection and worker connection?

    I guess you can define some protocol, by which I mean the format/semantic of messages, msg type may help. Also, as for distributed system, the FIFO can not be vaulted, I guess you should use some mechanism as sequence num, logic clock to take care of the match between request and response.

    Q:How do I keep track of the number of workers currently connected?

    First, login and logout can be taken into account, however, not always possible, especially logout; second, connect error using timeout, as to crash after sending, there can be some threshold, or "getResult" message; third, as to a DS, I think you had better apply some election algorithm to make sure there is always worker.

提交回复
热议问题