Server Version#: 1.29.2.6364
Player Version#: 4.87.2
I’ve noticed that when adding a lot of music, Plex Media Scanner is stuck on 100% CPU for a long time, and memory usage can get really high–to the point where systemd was killing and restarting PMS because of OOM.
So to test, I added 60 cds worth of music, which had 1219 tracks, totaling 16.8 gB in flac. All of those tracks were already filtered through MusicBrainz Picard, so the metadata on them should be been in good shape.
And yet, Plex Media Scanner took nearly 5 hours to finish. This ps output was within 1 minute of it exiting.
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
plex 528020 0.0 6.8 634004 571732 ? RNl 14:47 288:23 /usr/lib/plexmediaserver/Plex Media Scanner --match --type 8 --log-file-suffix Matcher --files @/tmp/3f46-f9d6-67bc-edc6.txt
It used a maximum of ~3.5 gb of ram, before dropping down ~15 mins before exiting:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
plex 528020 0.0 42.7 3646984 3584432 ? RNl 14:47 274:10 /usr/lib/plexmediaserver/Plex Media Scanner --match --type 8 --log-file-suffix Matcher --files @/tmp/3f46-f9d6-67bc-edc6.txt
All of the media was from NFS, so I could watch the network usage to get an idea of what’s being read. I watched the network usage and it only pulled 1-2 mB/s for the first 5-10 secs at the start of the scan, then dropped down to single digit kB/s the rest of the time–the same as would be used if nothing was going on, and it was just driving the terminal I was watching from.
So what the hell is that process doing? It’s working with at most 20 mB worth of metadata, and somehow it needs 5 hours and 3.5 gB of ram to do so? Whatever it is, it seems to be extremely inefficient.
PS. the web client also reports the wrong album being worked on while it’s stuck doing whatever the scanner was doing during that time–according to the files listed in that /tmp/file.