mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
Reduce the worst-case concurrent ClickHouse memory of the internal platform-analytics route (all 17 CH queries fire in one Promise.all on the shared admin user, against a 9 GB per-user cap). - Use sipHash64(user_id) as the distinct key in the uniqExact/uniqExactIf aggregates (dauSeries, sparkByProject, mauProjects, activeByProject). Exact at this scale (64-bit, negligible collision prob over 1M users), verified byte-identical; -40% to -61% peak memory per query. - Sample the new/retained/reactivated activity split at 1-in-4 users (consistent cityHash bucket on both subqueries, counts scaled x4). The split's window function + all-history scan made it the heaviest query (~1.3 GiB at 1M users / 50M events); sampling cuts it ~78% for a ~0.4% mean error. Dashboard chart now notes it is a sampled estimate. Adds the benchmark/optimization harnesses used to validate these changes (seed isolated bench_pa DBs, measure peak memory, verify result equality). |
||
|---|---|---|
| .. | ||
| verify-data-integrity | ||
| backfill-internal-free-plans.ts | ||
| benchmark-internal-metrics.ts | ||
| benchmark-platform-analytics.ts | ||
| bulldozer-payments-init.ts | ||
| clickhouse-migrations.ts | ||
| db-migrations.ts | ||
| db-migrations.tsdown.config.ts | ||
| generate-keys.ts | ||
| generate-migration-imports.ts | ||
| generate-openapi-fumadocs.ts | ||
| generate-private-sign-up-risk-engine.ts | ||
| generate-route-info.ts | ||
| optimize-platform-analytics.ts | ||
| optimize-split.ts | ||
| regen-internal-subscriptions-to-latest.ts | ||
| run-bulldozer-studio.ts | ||
| run-cron-jobs.ts | ||
| run-email-queue.ts | ||