Skip to content

Home screen and Latest rail are slow and don't scale under concurrent load #293

Closed

Description

@CoffeeKnyte

Summary

The home screen and the Jellyfin-compat "Latest" rail get slow — sometimes very
slow — for users with large libraries or a lot of watch history. Worse, the cost
scales with the number of concurrent users rather than with the amount of
content, because the same shared lists are rebuilt from scratch on every request
for every person.

Symptoms (what users and operators see)

The same shared rows are rebuilt per user, per request. Rows like "Recently
Added", genre rails, "Trending on this server", "Most Watched", "New to Library",
editorial/featured, and admin-curated lists are identical for everyone who can
see the same libraries
— only the watched checkmarks and play position are
personal. Yet each request recomputes the whole list against the database. On a
busy server the database does the same expensive work over and over.

Continue Watching can hang for tens of seconds. For heavy watchers, producing
an exact "total items" count made the server read an entire watch history (worst
observed ~36s), especially when most recent in-progress items are dismissed so
the visible list stays sparse and the scan keeps going.

The "Latest" rail is slow for heavy watchers with multiple libraries. Hiding
already-watched titles pushed the server off its fast lane onto a whole-catalog
scan (~0.8–1.6s). This is one of the most frequently loaded endpoints
(~10k/day).

Large home screens fill too slowly. A 32-row layout resolved only a few rows
at a time, so the screen took several build "waves" to populate.

Detail-heavy rows do redundant per-item work. Building a 50-item row looked up
each item's watch status one at a time — roughly 100 tiny database round-trips per
page.

Why it matters

  • Latency is directly user-visible on the most-used screen in the product.
  • Database load grows with concurrent users × rows, not with distinct content,
    so the home screen degrades exactly when the server is busiest.

Scope

Server-side only (internal/sections, internal/jellycompat). No client changes
are required. Two accepted trade-offs: the Continue Watching total becomes an
approximate lower bound beyond a cap, and newly scanned content can appear in the
shared rails up to ~15 minutes late (the shared lists are cached with background
refresh).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions