jellyfin / jellyfin

The Free Software Media System
https://jellyfin.org
GNU General Public License v2.0
31.81k stars 2.91k forks source link

[Issue]: Next Up on home is extremely slow #11316

Closed pdf closed 2 months ago

pdf commented 3 months ago

Please describe your bug

I don't recall if this has always been a problem, I suspect it has but maybe I haven't noticed in the past, since I don't use the web UI often.

Upon loading the home page on the web interface, all widgets load on my dataset within a second or two, however the Next Up widget takes 15-20 seconds to load. During this time, the loading spinner remains overlaid on the display, which is an irritation.

As a quick and dirty test I added the following index on the library DB:

CREATE INDEX idx_test_UserDataLastPlayed on UserDatas (key, userId, lastPlayedDate);

With this index, query times dropped to about 600ms, a pretty drastic improvement. I'm not familiar enough with C# or this project to contribute a fix for this, but this seems like a pretty easy win.

Reproduction Steps

  1. With a moderately sized library, load the home page of the web interface
  2. Note response time is very long for Next Up HTTP request.

Jellyfin Version

10.8.13

if other:

No response

Environment

- OS: Ubuntu 20.04
- Linux Kernel: 5.4.0-148-generic
- Virtualization: LXC
- Clients: Browser
- Browser: Chromium
- FFmpeg Version: 5.1.4-3-focal
- Playback Method: N/A
- Hardware Acceleration: N/A
- GPU Model: N/A
- Plugins: N/A
- Reverse Proxy: traefik
- Base URL: /
- Networking: macvlan
- Storage: local

Jellyfin logs

[2024-04-08 18:04:36.432 +10:00] [WRN] Slow HTTP Response from "https://<hostname>/Shows/NextUp?Limit=24&Fields=PrimaryImageAspectRatio%2CDateCreated%2CBasicSyncInfo%2CPath%2CMediaSourceCount&UserId=<userid>&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&EnableTotalRecordCount=false&DisableFirstEpisode=false&NextUpDateCutoff=2023-04-09T08%3A04%3A15.879Z&EnableRewatching=false" to "<client-ip>" in 0:00:20.5455497 with Status Code 200

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

jellyfin-bot commented 3 months ago

Hi, it seems like your issue report has the following item(s) that need to be addressed:

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.