-
I’ve been struggling for months with a problem that takes down the mariadb.service database process, giving me the error message ‘Error establishing a database connection’.
This problem started sometime late last year when I was running the website on an unmanaged VPS with 16 CPU cores, 60GB RAM, and 2TB storage (Strato). After the VPS administrator moved on to something else, I had to (temporarily) migrate to shared hosting (24 CPU cores and 16GB) with Vimexx.
Theme:
Newspaper by tagdiv
Uses its own composer – td-composer and td-cloudlibrary plugins
Main (heavier) plugins:
Rank Math (SEO)
FS-Poster (autopost to Facebook)
WP Media Folder (wrapper for Media Library) + cloud add-on + gallery add-on
Other:
Askimet
AllAccessible
Cookie Notice & Consent
Health Check & Troubleshooting
Standard Featured Image
WP Consent API
WP Super Cache
WPS Hide Login
Query Monitor (for debugging database queries)
WordPress version: 6.8.2
PHP version: 8.4
PHP Memory limit: 256MIn wp-config:
wp-memory-limit = 256M
wp-max-memory-limit = 512M
Database: InnoDB
Size: 3.2GB, of which the postmeta table is 2.6GBThe website is a news site and dynamic, with 20+ new posts daily. Images are served from Google Drive via the WP Media Folder cloud add-on.
What goes wrong and when:
When new posts are published in the backend, the database service goes down 2 to 3 times a day. At Vimexx, it restarts within 20 seconds, but on the VPS, it had to be restarted via SSH. There wasn’t yet a script for autorestart of the mariadb service.I was using WP Rocket as a caching plugin, but the problem became increasingly worse with it. I first had to disable the caching plugin via FTP, and only then would the database work again. Currently, I’m temporarily using WP Super Cache, as advised by the theme, but it also caused issues. Only after disabling it via FTP does the site work again, and I can re-enable the plugin.
In the meantime, I’ve tried WP Rocket (paid version), WP Super Cache, WP Fastest Cache, and W3 Total Cache (separately, of course).
Also, independently of the plugins, or in combination with them, I’ve tried server-side OPcache, Varnish cache, and Redis Object Cache (including the plugin). All of them lead to the database connection breaking.
With Query Monitor, I’ve gained more insight into the number of DB queries. Due to some adjustments in plugins, the number of queries in the backend when creating a new post is 137. When opening a page in the backend, it’s 459.
The load of Rank Math seems resonable, but there are a lot of additional rules in postmeta and wp_otions.
I have written support tickets to all plugin developers (and now you) and the theme developer. The latter advised creating a staging site to test what else I can adjust.
Additional context:
The Newspaper theme is quite heavy.
The plugins WP Media Folder, FS-Poster, and Rank Math are also heavier.
With currently 50,000+ posts, I realize the database (especially postmeta) is enormous.
The postmeta table is filled with rows from various plugins.
Query Monitor also sometimes indicates duplicate queries (from 2 to even 1200).
I realize that I am presenting a specific and perhaps exceptional problem here wich might have nothing to do with your plugin, but after 8 months, I hope to receive pointers, directions, and possibly even solutions if you have any. Also posted this question on the Dutch WP forum.
All insights are welcome and appreciated, as are all (critical) questions and/or remarks.
You must be logged in to reply to this ticket.