Commit 481dc1c
committed
avoid to send empty stats to the GUI (server)
By default, every second we send to the GUI the collected statistics by
the daemon: metrics + events (connections).
This call has a hard-coded timeout of one second, and if it reaches the
deadline, a warning message is printed to the log.
After several timeouts, the daemon closes the connection and tries to
reconnect again.
The daemon invokes this call even if there're no statistics to send.
With one daemon and one GUI, it's not much of a problem. But if there're
n nodes, the GUI will receive a minimum of n connections every second.
In many scenarios, these empty calls are unnecessary.
So, in order to optimize this behaviour, if the daemon has not collected
new statistics, we won't invoke this call. This will slightly reduce the
load on the GUI (server) when managing multiple nodes, and will save
some CPU cycles on the daemon side.
The connection status between the daemon and the GUI is managed with the
following gRPC options:
- The server and the daemon configures a 5-seconds keepalive to keep
the channel open:
'grpc.keepalive_time_ms', 5000
- If after 5 seconds the keepalive msg is not received, then after 20
seconds the connection with the daemon will be closed if the server
doesn't receive a response:
'grpc.keepalive_timeout_ms', 20000
So after about 30 seconds, if the daemon can't communicate with the GUI
(server), it'll close the connection and retry it every second.1 parent f2e2e52 commit 481dc1c
2 files changed
+17
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
| 232 | + | |
| 233 | + | |
229 | 234 | | |
230 | 235 | | |
231 | 236 | | |
| |||
246 | 251 | | |
247 | 252 | | |
248 | 253 | | |
| 254 | + | |
249 | 255 | | |
250 | 256 | | |
251 | 257 | | |
| |||
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
260 | 270 | | |
261 | 271 | | |
262 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
330 | 334 | | |
| 335 | + | |
331 | 336 | | |
332 | 337 | | |
333 | | - | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
336 | 341 | | |
| |||
0 commit comments