At midnight server time for about a minute you might notice:
Kyaa!
Come back in a minute please! Doing some daily maintenance.
I've consolidated a few daily maintenance scripts to run while the site is now taken offline. This should allow maintenance to be completed more quickly without the bottleneck lag spikes that had been occurring previously.
The bottleneck problem I had been struggling to find a solution to for the past few months turned out to be one of those cases where "the problem is not where you are looking". I was so convinced some legacy MyISAM table was locking, or some query was holding everything up - yet nothing ever showed up in my slow query log.
When I started work consolidating the daily maintenance scripts, I noticed one of those worked on a separate database system. Originally I designed it to be a lightweight, fast, efficient no cost replacement to PHP sessions. Except at midnight, when it purges old records ..... apparently scanning a 151MB block of data can take some time. And while it is doing that, a little chunk of code blocks EVERYTHING.
A while back I implemented a circuit breaker that would test the number of active MySQL connections and serve a 503 and terminate before the connection limit is hit. Except before it can do that, it needs to connect to the database. And after connected it does my SS code which I assumed had no cost. With that blocking, it never reached the code to check if the connection limit had been reached, and thus managed to exceed the limit that it was coded not to exceed. lol Once again proving having the right code is meaningless when it is not in the right order. ≻≺ Another problem for another day.