Server hangs for 30+ seconds, streams unpause by themselves

Alright! I solved this.

The library is giving a new random value to X-Plex-Client-Identifier on every request fresh connection, which has happened every minute for the last five years because I run a cron job against the status endpoint. The server hits the period of degradation only sometimes, and only when it’s a client identifier it hasn’t seen before. This was why I couldn’t reproduce with cURL, because I was replaying previous requests and not generating new identifiers. Once I told PlexAPI to always use the same identifier, the problem seems to have gone away.

So this is clearly a problem on the server side, but that’s closed source, so I’m not sure how to proceed. Is there a way to flag this to the server team? I suspect that blasting a bunch of requests to / with varying X-Plex-Client-Identifier will reproduce the issue.

edit: I suspect this may also be causing the DB slowness, I probably have a few million unique client IDs stored up somewhere

edit2: also reported to client lib Random X-Plex-Client-Identifier Causes Performance Issues on PMS · Issue #1532 · pushingkarmaorg/python-plexapi · GitHub