DS216J - Plex Media Scan CPU Usage

Hi Guys,

Been searching through the forums here and on Synologys site to try and get an answer to this, but I’ve not been able to solve it yet so thought I’d just ask you guys direct.

Been running Plex server on my mac for about 6 months with no issue and finally wanted to get a dedicated box that did a few things and didn’t require me to have the Mac running 24/7 to be able to access Plex, so started researching Plex compatible NAS’s. Picked up a DS216j as it seemed to tick all the boxes and have been setting it up over the last few weeks.

My setup when I had the Plex server running on my Mac was to have Plex look at my iTunes TV Shows and movie folders. I’m an apple guy and want to keep using iTunes to manage the films and it worked perfectly. Add a film to iTunes, Plex picks it up, shows up on everything else - Xbox, iOS apps etc. Perfect.

When I was setting up the NAS I copied my iTunes folder structure from and library over to the NAS and then pointed iTunes on the mac at the network drive that was storing it. Essentially using iTunes on the mac as a front end for the library on the NAS. Not a supported use case for iTunes but as long as the mac and NAS are talking to each other it hasn’t been an issue.

On the NAS I installed the latest version of PMS from the Plex site and set all my libraries up, pointing at the same folders on the NAS as they had been set up on my mac.

All has been working flawlessly EXCEPT for one thing. After a few hours/days of Plex happily running on the NAS it will start to have a runaway Plex Media Scan process on the NAS that uses 30-50% of the CPU.

I’ve told Plex not to generate thumbnails in the Library settings and have also told it to not scan folders for incremental changes in case that was causing the issue but I still can’t seem to solve it. A restart of the NAS will see everything go back to normal and it will happily run without issue for some time before I notice that the process is stuck again. Manually asking Plex to do a library update won’t cause the process to spike the CPU either.

Reading the forums here made me think that the scanner was getting stuck on a particular file but I’ve been through the logs and can’t spot anything. I’ve uploaded the logs to here: https://dl.dropboxusercontent.com/u/4877406/Scan%20Logs.zip in case anyway wants to have a look and try and spot something that I’ve missed.

I’m so close to having the perfect setup with this NAS so any help anyone can give is much appreciated!

Since you’re using iTunes, I will presume you have music involved. If music is part of what’s being scanned, and you have a lot of it, this will substantially add to the work PMS has to do. To get a handle on it, do a ‘total pieces of media’ count. This way, it doesn’t matter if movie, television episode, or individual song. It will make more sense to you becase PMS works at that Media_Item level in all it does.

Since you’re seeing activity at specific times, there are two function settings which directly control when library maintenance gets done.

Settings - Server - Library: What is included and how often/under what conditions the library is scanned
Settings - Server - Scheduled Tasks: When the Butler does the big scan and what tasks it does during its maintenance run.

Hi ChuckPa,

Thanks for answering.

Music isn’t included within my flex setup because I already store it all in the cloud with iTunes Match. No requirement to have local copies of it and I wouldn’t use Plex to serve it to other places.

Only worrying about TV Shows and Movies in the iTunes folder structure.

Unsure of how I check ‘total pieces of media’?

In terms of the current scheduled activity:
Server > Library = Update every 6 hours, empty trash after library update and run tasks at a lower priority (only just started testing this but doesn’t seem to have made a difference). Everything else is off.

Server > Scheduled Tasks = Start at 2am, stop at 5am. Backup database every three days, Optimise each week, remove old bundles each week, remove old cache each week. Everything else is off.

If your library is otherwise stable, I suggest.

enable Automatic update when changes detected.
enable Run partial scan
increase the time factor to 12 or 24 hours.

The nice part of Automatic update is the iNotify function in PMS will see a new movie or episode coming in and grab it anyway. For me, as Sonarr drops in episodes, PMS has them already in the series lineup before I actually get the notification its been downloaded by DownloadStation.

To get total pieces of media… File Station -> click item -> right click -> properties

Just changed those library update settings to your suggestions, although worth me saying that these were enabled previously when i first noticed the problem so I don’t anticipate them suddenly solving it.

Total media is not massive:

Movies - 483
TV Shows - 640

Just to follow up on this:

After changing those settings and leaving the NAS/Plex to run as normal for a few hours/days I’ve just logged in to the box and the problem is still there.

Plex Media Scan at around 40-50% cpu using about 140mb RAM. Only way to fix it is to restart the NAS.

Anyone else got any bright ideas?

@marlow-john : exactly same here…
I’m very interested by a solution !
Please Pex Team, any idea ?

Glad I’m not the only one with this issue!

Same setup as me?

DS214 running PMS for months without problem…
Since one of the last update (1.x ??), CPU process stay at 50% until a restart. It’s ok for few hours than increase to 50%.
I’ve tried all options in library with no chance.

Any idea to stop this process ?

Sounds identical to my issue then.

If anyone else has any bright ideas then I think me and PPE44 would be very appreciative!

@marlow.john said:
Just to follow up on this:

After changing those settings and leaving the NAS/Plex to run as normal for a few hours/days I’ve just logged in to the box and the problem is still there.

Plex Media Scan at around 40-50% cpu using about 140mb RAM. Only way to fix it is to restart the NAS.

Anyone else got any bright ideas?

Sorry for the delay. I’ve been busy writing software.

From the logs:

Adding subdirectory for scanner: /volume1/Music/iTunes/iTunes Media/Movies/Moon/@eaDir

EVERY time the Synology indexer runs, it’s going to update every subdirectory you have with these things. It’s going to put its own subdirectories underneath it.

To stop it from drilling down unncessarily through all that crap, create .plexignore at the top of your media directory (e.g. /volume1/movies or /volume1/music, etc)

In it, put:

# Ignore Synology's @eaDir indexing stuff
@eaDir/*

For further reading and details. https://support.plex.tv/hc/en-us/articles/201375253-Excluding-New-Content-with-plexignore

I will ALSO point out in passing, Having movies under the music library will cause entries to be put in Plex’s database which it will continue to try to match.

Mixing Media types, in this case what appears to be Music and Movies, will always be unpredictable

Adding file for scanner: /volume1/Music/iTunes/iTunes Media/Movies/Rango/Rango (1080p HD).m4v

ChuckPa - Thanks again for your help. Much appreciated.

I’m away from my NAS until Monday, but will give this a spin then and will update the topic with my findings.

Another update.

I followed the suggestion around the .plexignore file and included a copy in each of the media directories (Movies and TV Shows in this instance)

Plex server also got an update yesterday which I manually installed through DSM. I’m now on version 1.0.3.2461

I kept an eye on the CPU usage of the NAS throughout yesterday and all was fine when I went to bed around 1am.

Woke up at 7am and the server was pegged at around 60% CPU usage again, with Plex Media Scan being the culprit.

I’ve dug through the logs again and what was different this time was that the logs were named Plex Media Scanner Deep analysis. First time I’ve seen the logs labelled this way. Not sure if this is related to the server update.

Looking through the Plex Media Server log it looks like the system woke up at 2am (as per the server settings for scheduled tasks) and decided to perform Deep Media Analysis on around 20 files (for reasons unknown). The other scanner logs show details of that analysis taking place but only for around 5 or 6 of those files. Instead of rebooting the NAS I’ve left that process running today in the hope that it might actually complete the job it’s trying to do at some point on the remainder of those files, but I have specified that Plex finish scheduled tasks at 5am so it should really have stopped itself.

Any further thoughts? Latest logs available to download here: https://dl.dropboxusercontent.com/u/4877406/Scan%20Logs%202.zip

Again, any help, from anyone, is much appreciated!

PS. ChuckPA - For the avoidance of doubt, your comment around mixing media types is valid, but the folder structure I’m using is easily misleading. Although it looks like the ‘Movie’ and ‘TV Shows’ folders are part of a broader ‘Music’ folder, which would be easy to assume was filled with music, they are most definitely separate.

That folder naming convention is just a hangover from the way OSX structures the iTunes folder. The ‘Movies’ and ‘TV Shows’ folders that I’m pointing Plex at ONLY have that type of content in them and music is stored somewhere entirely separate in a folder called ‘Music’ within the ‘iTunes Media’ folder. Clear as mud!

Having just helped another DS2xx user who said it was PMS on the DS2xx when it actually the names, and having cited your movie Rango (1080p), I can only suspect your names are equally inconsistent. To point, PMS format is Name (year) [optional resolution]. The resolution is no longer needed so it can be reduced to Name (Year). This is the accepted standard.

I advise you to review your media, find all the ‘unmatched’ items because PMS will continuously try to match it. This is the single most cause of a high CPU utilization scanner process. It should be I/O bound. When Analysis begins, you will see the spike of both CPU and I/O. Both will then finish together.

If you have a lot of films which need to be reviewed / renamed, I suggest FileBot. It does the trick VERY easily. I did almost 900 videos for a user in 40 minutes. When done, the names were correct and internet-verified. PMS sucked them in easily. Overnight CPU utilization was zero unless other maintenance was running.

Webtools points you to “Find Unmatched”. This will show you what PMS is hanging up on trying to match. There is also a Synology easy-installer. In WebTools, add the PMS Plug-in “Find Unmatched”

https://forums.plex.tv/discussion/126254/rel-webtools-2-0 scroll down and you will find the github link, get the Synology installer (SPK) and install normally via Package Center

Once you have WebTools installed, you can install it directly given the URL listed in the Find Unmatched thread.

ChuckPA - Thanks again for your help.

I’ve spent the last few days following your instructions to see if it solved the problem and it doesn’t look like it has, but we’re getting there.

I installed WebTools first and checked to see if Plex was complaining about any unmatched files. It said that there were zero movies or tv shows that were unmatched.

I then removed both libraries from Plex as I figured if I was going to go to the trouble of renaming everything then I may as well start with a clean slate. I also removed iTunes from the equation for now (as it has a bad habit of renaming files) by removing all movies and TV Shows from my iTunes library.

I then downloaded Filebot, checked the naming Syntax against Plex recommendations, and let it go to work on my Movie library. It was able to match every film except two - a student film from University and a Cycling documentary from Vimeo.

I then setup the Movies library again using the newly renamed files and let Plex sort itself out. Everything looked fine and for the two unmatched films Plex successfully read the embedded metadata.

I left the NAS to run overnight just with films and yesterday morning everything had worked as expected. The NAS had woken up at 2am, Plex had done it’s maintenance, then shut down at 5am. No high CPU usage. Brilliant

For TV Shows I went through the same process and Filebot was largely successful at matching everything. There were a few edge cases - One TV show I have, Long Way Round, is an extended DVD version with a couple of extra episodes and TVDB only has the normal version on file, and a few obscure documentaries that TVDB never seems to find - but otherwise it went well.

Setup the tv shows library in Plex, let it grab all metadata etc. All looked fine, with only those couple of obscure shows not being perfectly matched and requiring my input to help setup a poster etc.

Let it run last night and woke this morning to find the same problem as before. Plex media scan high CPU usage. At least we now know it’s related to something in the TV shows library. Again, WebTools is saying that there are zero unmatched files.

Looking through the logs suggests that all the Scanning activity, either normal or ‘deep’ scanning, finishes up at around 3am, and you can see in the Plex Media Server log that the system tells itself to stop any media analysis at 5am, as it should, but it’s clearly getting hung up on something.

Latest logs from this morning are here - https://dl.dropboxusercontent.com/u/4877406/Plex%20Logs%2005.08.zip

Any further thoughts?

Thanks again for your help in advance.

John,
The logs show a great deal. It shows the deep analysis running and finishing at 5am.

Please point out to me what it’s hung up on? I’m not following you yet.

(sorry for the delay… busy day here)

Sorry, think my wording was misleading.

The fact that the process keeps spiking the CPU indicates that it’s stuck trying to do something, but the logs give me no indication of exactly what it’s struggling with.

I’ve just checked the NAS and for the second night in a row it’s got the same issue.

So frustrating!

Doing a bit more searching and I wonder if I’m seeing the same issue as these two?


Simple spikes are the PMS butler doing its normal job by invoking the scanner Look at your preferences and see if you’ve set it to periodically update/refresh your metadata & analysis. This is the usual cause of the spikes meaning it’s normal activity and not really an issue / broken. It may not be configured how to want but that’s easily fixed :smiley:

Sorry @ChuckPa but I agree with @marlow.john. Two days ago I reorganize my library (erase accents, rename all with Filbot, stop sync indexing and add .plexignore file).
First night, no problem. I’m happy and think problem solved… This night problem came back again
:frowning:
I will try to stop update/refresh metadata & analysis but i’m really sure than there is some problem with deep analysis… than only plex team can correct.