Skip to content

perf: the contest leaderboard response is uncacheable end to end #389

Description

@FlyM1ss

Surfaced reviewing #387, which points the landing hero at GET /api/v1/leaderboard?period=contest. That makes the highest-traffic anonymous surface in the product issue an uncached rebuild against the 512MB free-tier instance that also serves /app and the protocol surfaces.

Nothing on the path caches the response:

  • api/routers/leaderboard.py:30 sets no Cache-Control and no ETag.
  • dashboard/frontend/vercel.json forces Cache-Control: no-store on /(api|paper|backtest|runs|config|admin|ticker|health|compare)(/.*)?, so the Vercel edge cannot absorb any of it either.
  • The caches that do exist in domain/leaderboard/service.py (_cached_run_index, the skip cache) select which run to draw; they do not memoise the built response.

Per request that means all 12 configured entries get a _find_cached_run lookup plus a db.get_equity_curve, then align_equity_curves over the lot. Measured against a local backend on the committed seed DB: 12 entries x 162 points.

The contest window is fixed and historical, so this is the single most cacheable thing the backend produces. A short public, max-age=... on period=contest plus dropping no-store for that one path would remove the load.

Two things to keep in mind for whoever picks this up:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    funcNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions