Menu

Node.js Polling Cost Explained for Device Presence (More Viewers, Event Fan-Out)
📰

Node.js Polling Cost Explained for Device Presence (More Viewers, Event Fan-Out)

DEV Community: node·ColbyHayes3521·1 day ago
#Tkgttmq7
#devtonodejs#devto#dev#device#state
Reading 0:00
15s threshold

A media operations dashboard has one unforgiving requirement: a device shown as online should actually be online. Once several people watch the same fleet, repeated polling spends reads to rediscover mostly unchanged state, while each viewer sees a different-age answer. I would calculate presence once on the server and push each change to connected dashboards. Polling still belongs in recovery and low-attention screens.

Short answer: pushing wins above a handful of viewers when viewers x polls per minute exceeds the real change rate plus the overhead of open connections. The threshold is not a universal head count. Presence accuracy, payload size, query cost, and event frequency decide it.

Why does pushing beat polling above a handful of viewers?

Imagine 12 encoders feeding a control-room dashboard. A viewer polling every five seconds creates 12 read opportunities per minute. Eight viewers create 96. That is a workload example, not a benchmark; replace both inputs with numbers from the actual system.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.