心跳机制,一般指的就是一个检测包,检测对方或者自己是否还活着?一般心跳机制在哪些地方应用啊?具体是如何使用的?比如在zookeeper中,当服务提供方的注册地址发生改变时,它是怎么通知到服务适用房的呢?平时的话,怎么知道服务的使用方是否与zookeeper有连接呢????
天蓬老师2017-04-18 09:48:42
The service provider and the service user are independent. The service provider cannot sense the existence of the service user, but coordinates service turnover through zookeeper
When the service provider’s registration address changes, the service user has two options to detect this change
Go to zookeeper every time to get the service provider list, which is obviously perceptible, but not efficient
Use the watch
primitive of zookeeperd to monitor a certain znode. Zookeeper will actively notify if there are changes
In fact, to put it bluntly, one is pulling and the other is pushing