Skip to content

fix(perf): Store subway status in ETS, rather than a GenServer's state#3296

Merged
joshlarson merged 2 commits into
mainfrom
jdl/fix/store-subway-status-in-ets
Jun 30, 2026
Merged

fix(perf): Store subway status in ETS, rather than a GenServer's state#3296
joshlarson merged 2 commits into
mainfrom
jdl/fix/store-subway-status-in-ets

Conversation

@joshlarson

Copy link
Copy Markdown
Contributor

Scope

Turns out - having every consumer request subway status from the SubwayCache GenServer raises the possibility of overwhelming the GenServer, since GenServers are a single thread.

This change has the homepage controller process reach directly into an ETS table instead (well, through the SubwayCache module, but at least it doesn't use GenServer.call).

Asana Ticket: 📈 Don't interact with SystemStatus.SubwayCache per page load

Implementation

  • Store subway status in an ETS table, rather than GenServer state.
  • SystemStatus.SubwayCache still alerts consumers when there's been an update.

Screenshots

No visible change.

How to test

Observe that subway status still works as usual, and even that the subway alerts page still live-updates!

@joshlarson joshlarson requested a review from a team as a code owner June 29, 2026 21:15
@joshlarson joshlarson requested a review from lvachon1 June 29, 2026 21:15
Comment thread lib/dotcom/system_status/subway_cache.ex Outdated
@joshlarson joshlarson enabled auto-merge (squash) June 30, 2026 14:13

@lvachon1 lvachon1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

TIL about ETS, neat!

@joshlarson joshlarson merged commit 76c39fb into main Jun 30, 2026
18 checks passed
@joshlarson joshlarson deleted the jdl/fix/store-subway-status-in-ets branch June 30, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants