Efficient way to check if the Device Server is running
|
|
---|---|
Dear Dancers, I want to find the most efficient solution for getting a notification when a particular device server starts or stops. Setup comprises of multiple Tango facilities. Underlying assumption is that theres is no network disconnection. I can think of below solutions: Solution #1: Create a DeviceProxy to the Tango Device exported by the Tango Device Server. Periodically (lets say every 10 mins) invoke ping command on the created DeviceProxy. If the ping command is successful, then the Tango Device Server is running. If the ping command is not successful, then the Tango Device Server is not running. Store the result of ping command execution (true for success and false for failure) in a boolean attribute. Notification is send when the value of the attribute changes. Con: The solution is more processor and network intensive. Solution #2: Device Table of the Tango database contains the exported status of Tango devices registered in the facility. When a Tango Device Server is running, the value of Exported field for the device exported by that Tango Device Server is true. This field can be checked to detect whether the Tango Device Server is running or not. Notification is send when the value of this field changes. Con: If the Tango Device server dies accidentally (core dump, kill -9, etc.) the 'exported' field in the database is not updated to false. So in such cases it is not possible to detect that Tango Device Server is not running. Source: Tango Forum Post by Jyotin Ranpura. Solution #3: Starter can be used to identify whether a particular device server is running. Periodically get the list of running device servers from Starter. Check for the presence of the device server in the list of running servers. Store the result (true and false for the presence and absence of device server respectively in the list of the running process) in a boolean attribute. Notification is send when the value of the attribute changes. Other alternative is to modify the starter code to send an event when a particular device server starts or stops. Con: Hostname of the system on which the Tango Device Server is going to run needs to be known beforehand. Solution #2 seems to get ruled out as it does not address all the possible scenario. I am finding it difficult to determine the most efficient solution. It would be helpful to hear your opinion or experiences to implement the said functionality. All the possible solutions are welcome, incase if I missed any. If there's any misunderstanding in any of my solutions, please let me know. Regards, Vatsal Trivedi |
|
|
---|---|
Hi, I think in most cases, we rely on the Starter. For specific cases, we can add a ping on the device on the init_device, but it's more occasional. Setting up a DNS is not a difficult ;) |
|
|
---|---|
Hi, I would use the Starter too. The Starter's job is exactly this. It can send you events when a server dies or restarts. I don't know what events are supported by I am sure Pascal could tell us. Let us know if you see any drawbacks with using the Starter. Andy |
|
|
---|---|
Hi The Starter has an attribute called "Servers" containing the list of controlled servers with their status and controlled levels. If this list, one status or one level changes a ChangeEvent is sent. Pascal |
|
|
---|---|
Dear Experts, Thanks for the advise. I'll implement the solution using the Starter as suggested and will get back if I get stuck. Vatsal |