-
-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about memory consumption #184
Comments
Navidrome itself does not cache anything in memory. The embedded assets should not use heap memory, but it is something worth of investigation. I think this is caused by SQLite, caching indexes in memory. And we have lots of indexes... In early days, I used LedisDB for persistence, and I remember it never going over 80MB, even after a full rescan. It also could be that the GC is not doing its job well, due to some reference being hold incorrectly. But if that was the case, we would see the memory going up... I'll check the embedded assets and see if this can be optimized. Thanks. |
Yeah, I also noticed that. That's why I introduced the image cache, so requests for already processed images would come straight from the filesystem, without any image conversion happening. Maybe I have to fine tune it... Not sure if just throttling the number of requests would help with that. Maybe a better (and more complicated) solution is to have a pool of image extractors, and a image request queue. But I still think the allocated memory for processing the images is not being released immediately. Maybe it is a Go's GC fine tuning.... |
To verify this approach, I just tried to throttle requests to verify with: |
Yeah, adding a request limiter is a good idea. Please keep me posted :) |
Hi, I have also installed the patched version from 0xERROR on my Raspberry Pi 4 and after that, i had no more problems with running out of memory/ressources when scrolling through my albums (around 1500, not all with covers). And the scrolling was noticeably faster than before. Btw.: Thanks for your work, it's really a cool music server. |
@0xERR0R Great! I think the first param should be something like: Can you please wrap this up in a PR? Thanks! |
Hey, I'm reopening this as I just realized that if we limit the number of requests to 2 or 3, we could have a bottleneck when you have more than one user streaming from the server, as the streaming requests take a few seconds or more to complete. I'll have to make some tests to be sure this is not a problem, but most probably it is. If that is the case, I'll introduce a flag to disable it or double the number of simultaneous requests, as streaming is mostly an I/O operation with lots of waiting. Maybe make this value also configurable. A more long term solution would be to take the stream/download endpoints off this catch-all throttling and have a separated, configurable throttling just for it. Also, I didn't see much difference in terms of in my setup (running on Docker AMD64)... Thoughts? By the way, are you in our Discord server? |
I think the setup makes the difference. Without throttling at least my Raspberry Pi4 with an samba mount on a Synology NAS and around 15.000 songs was overloaded. I'm sure, that a more powerful AMD64 with a local music library has no problem to handle the load. |
We could also enable throttle middleware only for "getCoverArt" endpoint. I think, this is the only one, which is potential "heavy" and will be called often. What do you think? |
@GitSchorsch It can definitely help with the load, for sure. I should have make myself cleat: What I'm saying is that I don't see difference in memory consumption. My instance (with ~40K songs) still uses the same amount of RAM as before the throttling. Don't worry, I'm not taking this away, just trying to fine tune its usage :) |
@0xERR0R , I agree that Having said that, if we don't come up with a better approach, I think this (throttling `getCoverArt only) may be the best way for now |
Short description about my test setup: pi3 with docker, samba mount with music, many flac files. Raspberry pi3 needs about 1-2 seconds to create one album cover (need to transfer flac with > 10 MB from NAS with max 100Mbit, keep this file in memory, convert on-thy-fly the image (in memory) and write it to cache). |
Perfect, reviewing it now. Thanks again |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I used navidrome for a couple of hours and I'm totaly excited. I observed the memory consumption (my Setup: pi3, navidrome as docker, memory consumption metrics the same as "docker stats").
I see memory peaks during index creation -> this is ok. I have also memory peaks while I browse album view via web client -> this is ok. The question is: is the avg memory consumption while music playback and while navidrome is idle of ca. 130 MB ok? Does navidrome use some caches or something similar? Or is it so huge amount because all web client content is embedded in the library? I though, the memory consumption of Go applications, should be < 50 MB.
This is no issue, the application runs well, I'm just trying to understand ;)
The text was updated successfully, but these errors were encountered: