swingmx / swingmusic

Swing Music is a beautiful, self-hosted music player for your local audio files. Like a cooler Spotify ... but bring your own music.
https://swingmx.com
MIT License
678 stars 41 forks source link

Frontend CPU usage too high #144

Closed kja999 closed 9 months ago

kja999 commented 10 months ago

Hi, Happy to have this disputed as it's been hard to clarify. I use swing to play music on my TV, and very rapidly the frontend becomes unusable and unresponsive. Typical actions, browse to album, play, browse back to main folder (10k tracks in folders by artist), go to album. Navigate back to folders and everything locks up.

I run the backend on docker, and can see there is no specific increase in the server load. Running the client on a laptop though shows significant CPU usage at the point where everything locks up (i5-8265 hits 26% usage). I think this is the issue on a frontend where the CPU isn't so powerful (like a TV).

Is there a way to lower the impact ?

cwilvx commented 10 months ago

Hello @kja999

Thanks for opening this issue. There was a bug in the artist page that caused it to fetch all artist albums instead of only enough to fit the viewport. If an artist has a lot of albums, the page you navigate to next, will be slow. I fixed this bug in the upcoming release v1.3.0.

If you want to test out the beta, you can pull this docker image tag created just for you. Please provide feedback on the new release.

docker pull geoffrey45/swingmusic.v1.3.0.beta:kja999
docker run --name swingmusicv130beta -p 1970:1970 \
  -v /path/to/music:/music \
  -v /path/to/config:/config \
  --restart unless-stopped \
  geoffrey45/swingmusic.v1.3.0.beta:kja999

Replace /path/to/music with your music folder path and /path/to/config with where the config folder should be created.

Let me know whether this makes things better.

kja999 commented 9 months ago

Hi, I had a try through yesterday but no improvement. All seems well for the first 10 minutes but slowly stops responding. This time I also notice the play timer also stops when it runs slow (music keeps playing), so a sudden jump from 0:03 to 0:43 for example. Possibly the resources required are just too high for non-pc hardware

cwilvx commented 9 months ago

@kja999

I checked the memory usage on the browser and it seems like the usage is normal ~100mb. The CPU usage spikes ups sometimes but I don't think there's anything we can do at the moment.

kja999 commented 9 months ago

Thanks. I'll keep trying to work out if there is anything I can find too. It's only an issue on TV, not other devices