How to efficiently detect the running status of DECService
?
#232
Replies: 2 comments 2 replies
-
About how the client detects the existence of service, in fact, belongs to a very common problem, is the client to the service of the specified event subscription mechanism, such as service start, key state change, in general can be the following two practices 1. Based on pollingThe client polls the service for a state based on a time interval. This is basically foolproof, but there are obvious disadvantages, such as the design of the polling interval, and the performance problems caused by frequent polling. 2. Based on sub-pub mechanismFrom the service's point of view, a better approach is to provide a |
Beta Was this translation helpful? Give feedback.
-
From a more general perspective, a subscribe-publish notification event system can be designed based on root-state and post-object Some key points of sub-pub should be these: PublisherInitiated by dec service, running on OOD SubscriberInitiated by each client of the dec, can support cross-zone, cross-dec ChannelThe publisher follows a predesigned root-state path, such as
Subscribe processThe client can subscribe to the channel of interest to the dec service In a complete sub-pub system, subscribers generally do not modify the root-state of OOD directly, but should call the interface of the dec service (via post-object) to perform operations such as subscribing and unsubscribing, which means that a set of API needs to be designed to better support the pub-sub service Publish processAfter the dec service starts or when the state changes, it reads all the subscriber information under the path of the channel that needs to be pub, either by using a list or enumeration mechanism, and then according to the subscription information, it generally includes the following key information
After the Dec service gets the above information, it constructs a channel-specific object and posts to the path, either serially or concurrently, and whether it needs to handle the subscriber's response, etc. |
Beta Was this translation helpful? Give feedback.
-
In most time, the client will run depend on the service, the service should also running always.
But, I can not ensure that the service will always run normally. the state will be changed frequently at least while the
App
is installing at least.So. I want to detect the state immediatly.
Currently, I usually provide a ping interface on the service. But there are several disadvantages:
Beta Was this translation helpful? Give feedback.
All reactions