Skip to content

rewrite(scaling): cost-per-user as a design constraint#2

Open
thedeutschmark wants to merge 1 commit into
mainfrom
rewrite/scaling-streaming-toolsets
Open

rewrite(scaling): cost-per-user as a design constraint#2
thedeutschmark wants to merge 1 commit into
mainfrom
rewrite/scaling-streaming-toolsets

Conversation

@thedeutschmark
Copy link
Copy Markdown
Owner

Summary

  • Rewrites scaling-streaming-toolsets/README.md around the framing "designed for the cliff from the start" instead of "naive vs deployed" delta tables
  • New title: Cost-Per-User as a Design Constraint: Per-User Real-Time on Cloudflare's Edge
  • New §1 "The constraint" sets up cost-per-user as a deliberate design lever before any architecture detail
  • New §2.1 documents auth.deutschmark.online as the platform's centralized session worker — per-product workers don't reimplement OAuth, the SSO cookie is scoped to .deutschmark.online, new surfaces inherit auth by being on the right domain
  • §4 "Cost shape" replaced: dropped the "naive vs deployed" −99.7% deltas; added "what this design actually costs to operate" + projection to user count anchored at the chosen architecture
  • New §6 "Cost model and funding shape" introduces the T(N) = \$6 + \$0.03·N model wired to the /support community-fund target
  • New pattern §3.4 "Centralized auth as a platform discipline"
  • The KV → DO migration is framed as planned ahead; the observability alarm provided the trigger to cut over on a calm day rather than under pressure
  • Updated index entry to match the new title

Test plan

  • Skim the post end-to-end on the PR diff
  • Confirm no "X% reduction" / "naive vs fixed" framing remains
  • Confirm auth.deutschmark.online is accurately characterized (SSO cookie, OAuth boundary)
  • Confirm the T(N) = \$6 + \$0.03·N cost model matches the current snapshot

Reframe the post around deliberate architecture for a flat cost-per-user
curve, not a before/after cleanup. Drops the "naive vs deployed" delta
tables in favor of "what this design actually costs to operate" +
projected user-count headroom. Adds auth.deutschmark.online as the
platform's centralized session worker (per-product workers don't
reimplement OAuth) and the T(N) = $6 + $0.03·N cost model wired to the
/support funding target. New title; updated index entry to match.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08608301be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

| 10 | ~500 | ~2,000 | 99.93% |
| 100 | ~5,000 | ~20,000 | 99.34% |
| 1,000 | ~50,000 | ~200,000 | 93% |
| 10,000 | ~500,000 | ~2M | 34% |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fix 10k-user headroom sign in cost table

Section 4.1 states the Workers Paid plan includes 10M Worker requests/month and 10M KV reads/month, but the 10,000-user row here is ~2M requests/day and ~500k KV reads/day (about 60M and 15M per month), which is already beyond those monthly included allotments. Labeling this as 34% headroom misstates capacity and can lead to materially wrong budgeting decisions; this row should indicate overage (or negative headroom), not remaining headroom.

Useful? React with 👍 / 👎.

- 1 read per overlay refetch triggered by a config-changed broadcast (rare; dashboard-driven)

The same logic does not transfer cleanly to WebSocket clients: they don't poll when hidden, but they do reconnect on transient network errors. A flapping WebSocket with exponential backoff topping at 30 s on a hidden tab costs ~2,880 KV reads/day per overlay if each reconnect resolves `wid → twitchId` against KV. The mitigation is in §4.
That sums to ~50 KV reads per user per session for the typical case, with the long tail driven by event volume (chat commands, EventSub callbacks). Worker requests follow the same shape — a handful per session, scaling with events rather than polls.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reconcile per-session KV sum with its breakdown

The five bullets in §4.2 enumerate roughly 1 + K(~8) + 5 + couple + rare KV reads, but this sentence says they “sum to ~50 KV reads” for a typical session. Because the explicit arithmetic in the listed components does not reach 50, the model is not reproducible and the projection in §4.3 becomes ambiguous; add the missing event-volume term to the breakdown or adjust the stated total.

Useful? React with 👍 / 👎.

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.

1 participant