The same binary hack can be made to the Windows exe. Sed exists for windows, and there are lots of other binary-friendly editors.
Note that a larger page_size will itself increase the amount of memory used for cache. Page size is the single biggest help anyway. Plus it doesn’t need to be performed for each upgrade.
Plex offers server downloads for Windows, macOS, FreeBSD, and Linux. I decided to test them all with fresh installs of 1.27.0.5849-99e933842 (Update: I skipped FreeBSD after finding consistent results on the other operating systems). All values below are for “PRAGMA page_size”.
And unless Plex is doing something really surprising, every other platform too.
If they don’t exist when Plex starts, the active database files are cloned from the distribution template file Resources/com.plexapp.plugins.library.db, which is 1024.
Sorry for the confusion, it was 4096 because I changed it a few year ago after a reddit post made the same discovery and sugjested changing the value.
I’m confortable enough to edit the database, but not to alter the binaries, Plex have enough crash cases already, if i do change something in the binaries everytime it will have a problem I will be wundering if it was my fault
I have never actually gone beyond page sizes of 4k or 8k (with the block size of the filesystem at 4k), since at that point it starts slowing down writes enough to not be worth it anymore.
I would think the ideal value of page_size should be the same (or at most 2x of the value) as the block size of the filesystem without unduly effecting writes.
useful if you are storing somewhat large blobs in your database and might not be good for other
projects where rows are small. For writing queries SQLite will always only replace whole pages, so
this increases the overhead of write queries.
Increasing cache_size to 512M or even 1024M, on the other hand, should give a significant improvement.
As a reminder for anyone else that decides to try this, the value for cache_size is in kibibytes.
512MB = 500000 KiB
EDIT: As mentioned, a positive value defines total page count. A negative value defines a target size of cache. The old default was 2000 pages which it appears Plex has simply never updated.
*Backwards compatibility note:* The behavior of cache_size with a negative N was different prior to [version 3.7.10](https://www.sqlite.org/releaselog/3_7_10.html) (2012-01-16). In earlier versions, the number of pages in the cache was set to the absolute value of N.
The default changed in 2012 to -2000 to define cache_size as 2000KiB instead of 2000 pages. However, since Plex is still using a positive integer, the cache size will be pages (2000) * page_size (default of 1024). This has been stated several times by @Volts. If you crank up cache_size to 9999 and increase the page_size to the SQLite recommended default of 4096, you have increased your memory footprint to a whopping 40M. A max setting of 9999 * 65536 will still only consume ~655MB.
Not sure if this is a “if you don’t know, don’t do it” type of thing, but I’ve managed to change my page size, just unsure of where the cache_size portion needs to be executed from? /usr/lib/plexmediaserver/ ?
Thank you in advance, this thread has been a great read!
It won’t be possible to try this right now with binary editing since the number of characters need to be same while replacing so the most you can try is 9999 (positive value means pages) or -999 (negative meaning kibibytes).
So far it looks like the changes have been surviving updates. I run a pragma check after every update and the page size has stayed at 65536 each time. I’ve only ever had to run the tweaks once when I first did it.
Overall client performance has been great, items on pages load almost instantly!
Following this with great interest, anything that boosts performance is great in my book… At least my 64 GB will get some usage out of them!
Although, I jumped in rather too quick, and found out I can’t edit the settings from the .db in windows, and this sed tool isn’t exactly self explanatory, is there a way to use this on Windows (Server) and to set those values there?
edit: managed to edit in the new cache_size, although most PRAGMA values can’t be adapted/changes/refuse to save :\
I’ve tried the sqlitebrowser, changing the PRAGMA values mentioned above is impossible, it refuses to save and returns to default values when I re-open the program.