networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
1.99k stars 349 forks source link

Asynchronous client communication #98

Open aquette opened 10 years ago

aquette commented 10 years ago

NUT clients currently have to poll upsd to get data.

To gain in SW power efficiency, we should implement asynchronous (event based) communication, from the drivers up to the client. This includes:

Notes from clepple:

jimklimov commented 10 years ago

A note for posterity: I was worried that this issue, as formulated, might concern itself with removal of polling in favor of messaging and/or pushing - this would be a step back in terms of reliability. And so I found there is nothing to worry about here ;)

Arnaud confirmed that indeed this feature is not planned as a replacement for polling, but rather as an addition: while the system is in non-critical states, async messaging (including broadcasts) and/or pushing would reduce the network loads and allow otherwise idling systems to stay throttled-down for longer stretches of time. Polling will be used, but with much lower frequency than is required today.

To quote: JIM>> ...As an example of polling as a good thing, I might remind of the upsmon behavior (IIRC) in case that an UPS is on-battery and suddenly there are no more replies to polls from a (remote) upsd: we assume that some networking gear’s source of power has already died due to the blackout, so the monitoring localhost should assume the worst and speedily shut down, even though the last known state was not low-battery. Abandoning polls completely would lose the ability to detect connection losses or driver problems (or new problems in new pieces of the complex stack, like the MQ service) - the clients would be fooled into thinking that nothing happens since they get no notifications.

AQU> For sure, it’s not a complete abandon: the dead-man sig (or heartbeat sig) is still part of the game, for the rationales you mentioned above. The base idea was that going through MQ allows both async (publish / subscribe) and sync (request / reply), and limit polling drastically, while not killing the system.