The short version of the story is that there were about 10 different things wrong with the server. Some of those things were configuration issues, and some of them were database tables getting out of hand.
We tweaked file system caching, we tweaked file system journaling, we tweaked the mariadb connection timeout, we tweaked mariadb memory allocation, we tweaked a couple Drupal modules, we fixed an out-of-control spam problem that was elsewhere on the server, and I'm sure we did some other things that I'm not remembering at the moment.