Plex on Synology Painfully Slow

i installed Plex on my Synology DS214se, DSM 6.1-15047 Update 1. My Plex instance is 1.4.3.3433-03e4cfa35. The install went fine but when trying to watch on my Samsung TV using the Plex app in Samsung app store, the movies wont fully load. I see the squares where they should be but images don’t show up and when I try to play one, it just spins and spins and never plays. I went through the FAQ post here and confirmed I have settings correct but it was already set as you described.

Ideas?

i’m also getting this a lot when i load plex screen on my browser from Synology drive.

1 Like

This one the telltale sign of a fragmented database. What’s happening is the PMS modules (each with elapsed time limits waiting for others) are running out of time because they were waiting for the database to become accessible.

The way to confirm this is to look at your Plex Media Server log files (Plex share -> Library/Application Support/Plex Media Server/Logs).
If you don’t see the Plex share in FileStation, let me know and I’ll help you change that >:)

If you see SLOW QUERY, then the database needs to be optimized. It’s normally done in Scheduled Tasks (if enabled).

If you do confirm database fragmentation, now we need to go around the GUI and invoke it via command line.

If all this is a bit daunting and/or you don’t see SLOW QUERY, while still in FileStation, go back up one directory level, right click on Logs and select Compress to Logs.zip and use the document attach feature of the forums ^^ to attach here and I’ll take a more detailed look at what’s happening.

Thank you Chuck. Do you mean go to File Station in Synology? I don’t see anything on Plex in there. I was able to go to Package Center and View Log under the Log section of the Plex install but it won’t let me copy and paste it.

Yes, use Synology’s “FileStation” app.

If you don’t see the Plex share listed on the left side, this is how we change that.

from your computer with ssh or putty, ssh -l admin ip.of.synology.nas or equivalent with putty and admin user
Log in as root

sudo -su root Elevate to root
synoshare --setbrowse plex 1

exit from the ssh session.

Refresh File Station. You’ll now see the Plex share.

ok so forgive me but I am a ssh idiot. I followed these steps and it appears it worked but no real confirmation so i exited putty and then went and launched File Station and i dont see anything. See attached screenshot.

I am sure I am doing something wrong here so feel free to set me straight.

Thanks
Scott

Ok… For SOME reason, yours is being fussy.

Shall we get a bigger hammer? :slight_smile:

please open the ssh session again and elevate to root

It will look like this:

admin@moesern:~$ sudo -su root
sh-4.3# synoshare --get Plex
SYNOSHARE data dump:
	 Name .......[Plex]
	 Comment ....[]
	 Path .......[/volume1/Plex]
	 Deny list ..[]
	 RW list ....[]
	 RO list ....[]
	 fType ......[2]
	 fBrowseable [yes]
	 FTPPrivilege[0]
	 Status .....[0x1C80]
	 WinShare .....[yes]
	 ACL ..........[yes]
	 Skip smb perm.[yes]
	 Permit .......[yes]
	 RecycleBin....[no]
	 RecycleBinAdminOnly....[no]
	 HideUnreadable ........[yes]
	 Snapshot browsing .....[no]
sh-4.3# 

Notice it shows fBrowseable [yes]. This tells us we can see it.

If it still says [no], hit it again :slight_smile:

sh-4.3# synoshare --setbrowse Plex 1
sh-4.3# synoshare --setbrowse plex 1

Go back to the browser session, Close FileStation.
Now Reopen FileStation again.

Edit
As additional info: You did go to Control Panel and give your username R/W access to the Plex share? That will also hide it.

Really appreciate all your help so far. :slight_smile:
I got part way through. see attached.

i see what i did wrong in your instructions and missed a space. after plex and 1. Completed those steps. I reopened File Station but it showing the same thing. Can you tell me where i should look? in some specific folder?

I’m not entirely clear on your question here -
Edit
As additional info: You did go to Control Panel and give your username R/W access to the Plex share? That will also hide it.

i figured that out too and now see Plex! Attached are my logs. Phew!

@scotty1234 said:

I’m not entirely clear on your question here -
Edit
As additional info: You did go to Control Panel and give your username R/W access to the Plex share? That will also hide it.

I apologize. The hour was late and I was a ‘bit crispy’ so the wording may not have been optimal.

With Synology’s new ‘security enhancements’ in DSM 6.1, it is possible to completely hide shares which you don’t have access to from FileStation.
If your normal (non-admin) username on the NAS (doesn’t have R/W permission to the share, FileStation will hide it.

The combination of changes we made a) Give yourself (username) R/W and b) the --setbrowse Plex 1 mode change are what make it visible.

To the matter at hand. “Painfully slow”

This is the issue I speak of.

Dec 15, 2015 17:59:53 [0x47aed400] WARN - SLOW QUERY: It took 450.000000 ms to retrieve 1 items.
Dec 15, 2015 17:59:53 [0x47aed400] DEBUG - Computed media url for item 3608: http://127.0.0.1:40419/system/agents/media/get?guid=com%2Eplexapp%2Eagents%2Eimdb%3A%2F%2Ftt1638355%3Flang%3Den&mediaType=1&url=metadata%3A%2F%2Fposters%2Fcom%2Eplexapp%2Eagents%2Ethemoviedb_52a1fb1e853f1312c31eb1dfac05dd7015ca99c7

You will clearly see “SLOW QUERY”. Nearly 1/2 second to retrieve a single item from the database is not acceptable. 3ms to retrieve 450 items is better :slight_smile:

Please click the ellipsis next to Libraries and it will expose the “Optimize Database” option. Please click it. It will optimize the database (make each table contiguous internally again) for you.

hmm. am i missing something? I dont see anything to click for optimize database.

No, you are ok. I was 1 step ahead of myself.

Now that we see the Plex share, We will need the critical piece of information from it.

In File Station, navigate down through the Plex share until you see Preferences.xml.
Right click on it and open in the Synology text editor. (you may not have this installed but it is a very small package and VERY helpful for anything. I do not know why they unbundled it from the default).

In your Preferences.xml file, you will see the

PlexOnlineToken="xxxxxxxxxxxxxxxxx"

Now slide this to the side for a moment.

SSH again into the NAS. We are going to invoke the optimization from the command line.

sudo -su root
curl --request PUT 'http://127.0.0.1:32400/library/optimize?async=1&X-Plex-Token=xxxxxxxxxxxxxxxxx'

The xxxxxxxxxxxxxxxxx string is the same set of characters you found above in your preferences file. This is the PMS admin token.

As example, using my test machine,

curl --request PUT 'http://127.0.0.1:32400/library/optimize?async=1&X-Plex-Token=q14zKM3qmy3AAoyaxuRL'

After this completes, You may go to the Logs directory, look at Plex Media Server.log and you will see where the database has been optimized.

Please let me know your results.

Mar 16, 2017 13:00:11.915 [0x4a3ed400] DEBUG - Database optimization: Optimizing database. Starting by capturing all sessions.
Mar 16, 2017 13:00:11.916 [0x4a3ed400] DEBUG - Activity: updated activity 72413631-3646-4cab-a1ad-4506003176d5 - completed 0% - Optimizing database
Mar 16, 2017 13:00:11.916 [0x4a3ed400] DEBUG - Captured session 0.
Mar 16, 2017 13:00:11.917 [0x4a3ed400] DEBUG - Captured session 1.
Mar 16, 2017 13:00:11.917 [0x4a3ed400] DEBUG - Captured session 2.
Mar 16, 2017 13:00:11.917 [0x4a3ed400] DEBUG - Captured session 3.
Mar 16, 2017 13:00:11.918 [0x4a3ed400] DEBUG - Captured session 4.
Mar 16, 2017 13:00:11.918 [0x4a3ed400] DEBUG - Captured session 5.
Mar 16, 2017 13:00:11.918 [0x4a3ed400] DEBUG - Captured session 6.
Mar 16, 2017 13:00:11.919 [0x4a3ed400] DEBUG - Captured session 7.
Mar 16, 2017 13:00:11.919 [0x4a3ed400] DEBUG - Captured session 8.
Mar 16, 2017 13:00:11.920 [0x4a3ed400] DEBUG - Captured session 9.
Mar 16, 2017 13:00:11.920 [0x4a3ed400] DEBUG - Captured session 10.
Mar 16, 2017 13:00:11.921 [0x4a3ed400] DEBUG - Captured session 11.
Mar 16, 2017 13:00:11.921 [0x4a3ed400] DEBUG - Captured session 12.
Mar 16, 2017 13:00:11.921 [0x4a3ed400] DEBUG - Captured session 13.
Mar 16, 2017 13:00:11.922 [0x4a3ed400] DEBUG - Captured session 14.
Mar 16, 2017 13:00:11.922 [0x4a3ed400] DEBUG - Captured session 15.
Mar 16, 2017 13:00:11.922 [0x4a3ed400] DEBUG - Captured session 16.
Mar 16, 2017 13:00:11.923 [0x4a3ed400] DEBUG - Captured session 17.
Mar 16, 2017 13:00:11.923 [0x4a3ed400] DEBUG - Captured session 18.
Mar 16, 2017 13:00:11.924 [0x4a3ed400] DEBUG - Captured session 19.
Mar 16, 2017 13:00:11.924 [0x4a3ed400] DEBUG - Database optimization: Rebuilding full text search tables.
Mar 16, 2017 13:00:11.924 [0x4a3ed400] DEBUG - Activity: updated activity 72413631-3646-4cab-a1ad-4506003176d5 - completed 10% - Optimizing database
Mar 16, 2017 13:00:13.302 [0x4bfc9400] DEBUG - HTTP 200 response from GET https://plex.tv/servers/bf2567af55f6ff560d688d2a6eaa6ae7e2fa9fb3/access_tokens.xml?auth_token=xxxxxxxxxxxxxxxxxxxx&includeProfiles=1&includeProviders=1
Mar 16, 2017 13:00:13.436 [0x4bfc9400] DEBUG - MyPlex: updating with 7 access tokens
Mar 16, 2017 13:00:16.644 [0x4a3ed400] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:17): 3.520000 seconds
Mar 16, 2017 13:00:21.476 [0x4a3ed400] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:27): 3.550000 seconds
Mar 16, 2017 13:00:37.203 [0x4a3ed400] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:38): 13.170000 seconds
Mar 16, 2017 13:00:46.561 [0x4a3ed400] WARN - Held transaction for too long (…/Library/FullTextSearch.cpp:48): 7.620000 seconds
Mar 16, 2017 13:00:46.647 [0x4a3ed400] DEBUG - Database optimization: starting.
Mar 16, 2017 13:00:46.648 [0x4a3ed400] DEBUG - Activity: updated activity 72413631-3646-4cab-a1ad-4506003176d5 - completed 25% - Optimizing database
Mar 16, 2017 13:01:14.011 [0x4a3ed400] DEBUG - Database optimization: complete.
Mar 16, 2017 13:01:14.013 [0x4a3ed400] DEBUG - Activity: updated activity 72413631-3646-4cab-a1ad-4506003176d5 - completed 75% - Optimizing database
Mar 16, 2017 13:01:14.013 [0x4a3ed400] DEBUG - Running database fix-ups.
Mar 16, 2017 13:01:15.644 [0x4a3ed400] WARN - Held transaction for too long (…/Library/DatabaseFixups.cpp:169): 0.940000 seconds
Mar 16, 2017 13:01:15.645 [0x4a3ed400] DEBUG - Running database fix-ups completed in 0.9 seconds.
Mar 16, 2017 13:01:15.646 [0x4a3ed400] DEBUG - Activity: Ended activity 72413631-3646-4cab-a1ad-4506003176d5.
Mar 16, 2017 13:01:15.702 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:15.761 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:15.800 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:15.842 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:15.884 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:15.993 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.065 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.126 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.223 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.306 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.420 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.515 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.584 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.622 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.688 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.744 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.793 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.831 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.871 [0x4a3ed400] INFO - SQLITE3:(nil), 17, statement aborts at 57: [select * from metadata_items limit 1] database schema has changed
Mar 16, 2017 13:01:16.907 [0x4bfc9400] DEBUG - Statistics: Flushing 1 expired bandwidth entries, 0 expired media entries.

Perfect. That is normal operation.

  1. Export the Database tables
  2. Import the database tables back into a fresh DB
  3. Run the database fixups
  4. Have it ‘abort’ while it recreates the new index tables
1 Like

i’m sorry. lost again. How do i do all that?

This is all correct behavior, just as it should be.

How does PMS respond for you now?

If you wish, you can stop and restart it. It will come up ‘clean’.

2 Likes

i finally got a chance to try this out on my tv and things are working great. Thank you so much for all your help! :slight_smile:

Thank you for your help.
This fixed my Plex not working (slowwwwwwwwwwwwwww) on my DS416Play just now.

less Preferences.xml
curl --request PUT ‘http://127.0.0.1:32400/library/optimize?async=1&X-Plex-Token=xxxxxxxxxxxxxxxxx