[Issue]: Reduce the number of queries #3566

Closed
opened 2026-02-06 23:30:02 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @jaysonsantos on GitHub (Jan 22, 2022).

Please describe your bug

Hi there, first thank you all for this amazing project, I really want to see Jellyfin as a 1st grade product :).
I'd like to open this issue in order to propose query reduction per routes, so this could make more effective usage of the disk when sqlite has to fetch data from it.
To try and measure the pain points of the app, I started a branch to instrumentate the code with opentelemetry (if it is something you would like to have upstream, let me know).
Here you can see an average of time per route, note that my local server uses HDD, so any random read would suffer.
image
Then you can see on the details, that many queries will be issued (a bit hard to see here, but i can share the dashboard with whoever wants to see it).
image

The effects of this is that you can also see that it seems to be locked in a transaction because other threads/tasks are using the db for a longer period.
image

What do you say? Do you see this as an improvement to be made?
I see slow endpoints even when running from my dev machine with nvme, so I guess that the locks are the ones affecting its performance.

Jellyfin Version

Other

if other:

master branch

Environment

- OS: Ubuntu 20.04
- Virtualization: Bare metal
- Clients: Browser, Android, Fire TV Cube, Android TV, iOS
- Browser: Chrome
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- Plugins: trakt
- Reverse Proxy: direct connection
- Base URL: /
- Networking: host
- Storage: nfs

Jellyfin logs

No response

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @jaysonsantos on GitHub (Jan 22, 2022). ### Please describe your bug Hi there, first thank you all for this amazing project, I really want to see Jellyfin as a 1st grade product :). I'd like to open this issue in order to propose query reduction per routes, so this could make more effective usage of the disk when sqlite has to fetch data from it. To try and measure the pain points of the app, I started a branch to instrumentate the code with opentelemetry (if it is something you would like to have upstream, let me know). Here you can see an average of time per route, note that my local server uses HDD, so any random read would suffer. ![image](https://user-images.githubusercontent.com/51510/150653393-0f9d9909-96ef-451b-8568-912ab7c6b9db.png) Then you can see on the details, that many queries will be issued (a bit hard to see here, but i can share the dashboard with whoever wants to see it). ![image](https://user-images.githubusercontent.com/51510/150653452-31dc5dae-8045-46b7-be9a-36b976fc0b42.png) The effects of this is that you can also see that it seems to be locked in a transaction because other threads/tasks are using the db for a longer period. ![image](https://user-images.githubusercontent.com/51510/150653518-feb0da4b-cf83-47ec-a532-c358e54ea783.png) What do you say? Do you see this as an improvement to be made? I see slow endpoints even when running from my dev machine with nvme, so I guess that the locks are the ones affecting its performance. ### Jellyfin Version Other ### if other: master branch ### Environment ```markdown - OS: Ubuntu 20.04 - Virtualization: Bare metal - Clients: Browser, Android, Fire TV Cube, Android TV, iOS - Browser: Chrome - FFmpeg Version: - Playback Method: - Hardware Acceleration: - Plugins: trakt - Reverse Proxy: direct connection - Base URL: / - Networking: host - Storage: nfs ``` ### Jellyfin logs _No response_ ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here _No response_ ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
OVERLORD added the stale label 2026-02-06 23:30:02 +03:00
Author
Owner

@cvium commented on GitHub (Jan 22, 2022):

I would personally be interested in seeing how you did the instrumentation, but I'm not sure it's something we'd upstream.

@cvium commented on GitHub (Jan 22, 2022): I would personally be interested in seeing how you did the instrumentation, but I'm not sure it's something we'd upstream.
Author
Owner

@jaysonsantos commented on GitHub (Jan 23, 2022):

@cvium my current local patch you can find here https://gist.github.com/0ae616d0f3c73c577da8eff72707e1f6

@jaysonsantos commented on GitHub (Jan 23, 2022): @cvium my current local patch you can find here https://gist.github.com/0ae616d0f3c73c577da8eff72707e1f6
Author
Owner

@jaysonsantos commented on GitHub (Jan 23, 2022):

@cvium the cool thing is that it could be upstreamed without additional "weight" on standar installations because it only reports for subscribers of the ActivitySource's, and it could be only activated if provided a collector's url, i guess this would help observe patterns where the app is being slow

@jaysonsantos commented on GitHub (Jan 23, 2022): @cvium the cool thing is that it could be upstreamed without additional "weight" on standar installations because it only reports for subscribers of the ActivitySource's, and it could be only activated if provided a collector's url, i guess this would help observe patterns where the app is being slow
Author
Owner

@jellyfin-bot commented on GitHub (May 23, 2022):

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

@jellyfin-bot commented on GitHub (May 23, 2022): This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments. If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label. This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on [Matrix or Social Media](https://docs.jellyfin.org/general/getting-help.html).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#3566