Skip to main content
05

Design a real-time monitoring dashboard with a large data table

MediumReal-timeSSEWebSocketsData tables

Design a real-time monitoring dashboard: summary cards with key metrics, charts over time, a live feed of alerts, and a table of tens of thousands of findings that users filter, sort and drill into.

A typical framing: "Operations teams keep this dashboard open all day. New findings and score changes should show up within seconds, without a page refresh. The findings table can hold 50,000 rows. Different users see different data depending on their permissions."

TL;DR

Treat the dashboard as server-driven: the server filters, sorts, aggregates and paginates. The client never downloads 50,000 rows. Keep the view state (filters, sort, time range) in the URL, and the fetched data in a query cache keyed by that state.

For freshness, choose the transport by direction and frequency. Updates flow server to client and are fairly rare, so SSE is the simple default. WebSocket is worth it for very frequent updates, many dynamic subscriptions, or when you already run WebSocket infrastructure. Polling is fine when a minute of delay is acceptable. GraphQL subscriptions are a protocol on top of one of these, not a separate option.

Prefer pushing small change events ("findings changed") and letting the client refetch what's on screen, over pushing full data. That keeps filtering, permissions and caching in one place. Render the table with virtualization, never reorder rows under the user's cursor, and pause live updates when the tab is hidden.

1. Requirements

Questions worth asking:

  • How fresh must the data be: a second, ten seconds, a minute?
  • How many rows, and how often do they change? Do users need to see every change or just the latest state?
  • Which interactions: filter, sort, full-text search, bulk actions, export?
  • How many users keep it open at once? (Thousands of always-open tabs means thousands of open connections.)
  • Are permissions per row (multi-tenant, per team)?

Functional

  • Summary cards (score, counts by severity) and trend charts over a selectable time range.
  • A live alert feed.
  • A findings table with server-side filters, sort, search, a details panel, bulk actions and CSV export.
  • Shareable views: a link reproduces the exact filters.

Non-functional

  • Freshness within seconds, with no full refresh.
  • Performance: smooth scrolling and filtering, even on large datasets.
  • Stability: live updates don't make the UI jump around while someone is reading it.
  • Efficiency: hundreds of open tabs don't overload the backend.
  • Security: permissions enforced on the server for every query and every event.

2. Architecture

Loading diagram...
  • URL as the source of truth for the view: ?severity=high,critical&status=open&sort=-lastSeen&range=7d. Back and forward work, and views can be bookmarked and shared.
  • Query cache (TanStack Query, Apollo, RTK Query): each widget's data is cached under a key built from the URL state. It handles loading states, deduping, retries and background refetching.
  • Live connection: one per tab, carrying small events that tell the cache what is stale.
  • API / BFF: does the heavy lifting: filtering, sorting, aggregation and permission checks.

3. Data model

ts
type Severity = 'low' | 'medium' | 'high' | 'critical'

type Finding = {
  id: string
  title: string
  severity: Severity
  status: 'open' | 'in_progress' | 'resolved'
  resourceId: string
  firstSeen: string
  lastSeen: string
  /** Increases on every change. Lets the client ignore stale updates. */
  version: number
}

type FindingsQuery = {
  filters: { severity?: Severity[]; status?: string[]; search?: string }
  sort: { field: keyof Finding; direction: 'asc' | 'desc' }
  cursor?: string
}

/** What the live channel carries: small facts, not data. */
type LiveEvent =
  | { type: 'findings.changed'; ids: string[]; at: string }
  | { type: 'summary.changed' }
  | { type: 'alert.created'; alert: { id: string; title: string; severity: Severity } }

4. Interface (API)

http
GET /api/summary?range=7d
GET /api/findings?severity=high,critical&status=open&sort=-lastSeen&cursor=...&limit=100
GET /api/findings/:id
POST /api/findings/bulk        { ids, action: 'resolve' }
POST /api/exports              { query }  -> { exportId }   // async job, download when ready
GET  /api/events               (text/event-stream)

The responses carry total counts (or an estimate for very large sets) so the table can show "1-100 of ~48,200" and size its scrollbar.

5. Optimizations and deep dives

Choosing the real-time transport

OptionDirectionGood fitWatch out for
Polling (every N s)Client asksFreshness of 30-60 s is fine, simple infrastructureWasted requests, delay up to N seconds
Long pollingServer holds the requestFallback where streaming is blockedOne request per update, more overhead
SSEServer to clientRare-to-moderate server updates, a dashboard's normal caseOne-way (client actions go over regular HTTP). Under HTTP/1.1, about 6 connections per domain shared by all tabs
WebSocketBoth waysVery frequent updates, clients changing subscriptions all the time, collaborationIts own protocol: auth, reconnects, load balancing and proxies all need extra work
GraphQL subscriptions(runs over WS or SSE)You already use GraphQL and want typed eventsNot a transport: you still pick WS or SSE underneath

A dashboard mostly receives. User actions (resolve, assign) are ordinary HTTP requests, so the bidirectional power of WebSocket usually goes unused. SSE reuses everything HTTP already has (cookies, auth middleware, HTTP/2 multiplexing, standard load balancers) and the browser's EventSource reconnects by itself and resumes with Last-Event-ID.

Pick WebSocket when the dashboard is closer to a trading screen: dozens of updates per second, per-widget subscriptions that change as the user scrolls, or live collaboration on the same view.

Push data, or push "something changed"?

  • Push the data: the event contains the updated finding. Fast, but now the client has to decide whether the row matches the current filters and sort, which page it belongs on, and whether this user is even allowed to see it. That logic is duplicated from the server and easy to get wrong.
  • Push an invalidation: the event says "findings X, Y changed". The client marks the matching cache keys stale and refetches only what's on screen. The server stays the single source of truth for filtering, sorting and permissions.

Invalidation is the safer default. Push full data only for append-only, high-value streams like the alert feed.

Don't move things under the user

  • Coalesce bursts: 300 changes in two seconds should be one refetch, not 300. Batch events over a short window (e.g. 1-2 s).
  • If a refetch would reorder or insert rows above what the user is looking at, show "12 new findings, click to refresh" instead of applying it immediately. Apply updates to rows already in view in place, with a brief highlight.
  • Never refetch while the user is typing in a filter or has a row's menu open.

Large table

  • Server-side filtering, sorting and pagination (cursor-based). The client only holds the pages it has loaded.
  • Virtualize rows (and columns, if there are many), so the DOM holds ~50 rows no matter how many are loaded. Load more pages as the user scrolls, or use classic page numbers when users need to jump around.
  • Debounce search input, cancel outdated requests, and keep showing the previous results while new ones load (no flashing skeletons).
  • Memoize rows by id and version, so one changed row doesn't re-render the whole table.
  • Accessibility: a real <table> or the ARIA grid pattern with keyboard navigation, sortable headers announced with aria-sort.

Charts

Don't send 100,000 raw points to draw a 600-pixel-wide chart. The server downsamples (one bucket per few pixels, or an algorithm like LTTB that keeps the visual shape). Use Canvas for very dense series, and show times in the user's timezone.

Efficiency at scale

  • Pause or close the live connection when the tab is hidden (Page Visibility API), and catch up with one refetch when it's visible again.
  • Share one connection across tabs with a SharedWorker or BroadcastChannel.
  • Reconnect with exponential backoff and jitter, so a server restart doesn't trigger a thundering herd.

Exports

A 50,000-row CSV shouldn't block the UI or a request thread. Start an async export job, show its progress, and offer the download (or an email) when it's ready. Exports respect the same permissions as the screen.

Common follow-ups

  • "What if the live connection drops?" Show a subtle "Live updates paused" indicator, keep the cached data visible, reconnect with backoff, then refetch the visible queries to catch up.
  • "How do you avoid overloading the backend when 2,000 tabs refetch after one event?" Coalesce on the server, add jitter to client refetches, and serve the summary from a cache that's updated once per change, not once per viewer.
  • "How would this change for a stock-ticker-style screen?" Then push data over WebSocket, apply updates in a single requestAnimationFrame per frame, and keep the data in a mutable store outside React state to avoid re-rendering on every tick.

What interviewers look for

  • Server-driven querying, with the URL as the view state.
  • A reasoned transport choice (SSE, WebSocket, polling) based on direction and frequency, and knowing GraphQL subscriptions are a layer on top.
  • Invalidation vs. data push, and why invalidation keeps permissions and filters correct.
  • UX care: coalescing, no jumping rows, "new items" banners.
  • Virtualization, downsampled charts, async exports and backend efficiency.

Was this helpful?

Related questions