Design a Reactive Database (Live Queries), stage 1 of 9: model
What polling actually costs
Use the numbers in the scenario: 40,000 people online, five queries per screen, a poll every five seconds, 2,000 mutations a second.
System so far· 4 parts
Select a component to see what it is responsible for and which state it owns.
- 1Web and mobile apps → Sync servers: Subscribe and mutate
- 2Sync servers → Function runners: Run a function
- 3Function runners → Versioned store: Read at a snapshot
What you need to know
0 of 3 checks done
Polling and push put cost in different places:
- Polling costs (viewers × queries per screen ÷ interval), whether anything changed or not.
- Push costs (writes × queries each write affects), plus sending each new result to whoever watches it.
Which is cheaper depends on how often data changes compared with how often it's viewed. See Server push: polling, long polling, SSE, WebSockets.
Work it out
40,000 people online, 5 queries per screen, polling every 5 seconds. How many query runs a second?Work it out
To cut the delay to one second, polling every second. How many runs a second?Check
When is push dramatically cheaper than polling?