Hi,
Today I tried to separate the database and webserver. I thought it would be an easy thing, but...
The first issue was I had to enable a persistent connection to the DB. Otherwise, the web server was returning ~60% 502 errors because "unix:/run/php/php8.0-revive.sock failed (11: Resource temporarily unavailable)".
Now I have a separate nginx + PHP and MySQL. It works, but the DB server has very high IO wait time because of the hard drive and in the peak hours, web server returns 502. When I had it all in one server, the disk writes were less than 1MB/s. Now the database server alone has 25MB/s. Is there any chance that must be done in order to make it work with external database? I'm using the filecache (not Memcached).
What I did is simple:
Set up two new servers with private IPs.
One is a nginx with PHP and I copied the PHP files there.
Second one is database, where I run MySQL and I imported the old DB there.
I changed the DB connection details to the new one in the config file and I enabled the persistent connection.
I get the high disk writes as a result.
They are connected on a private network with about 0.02ms latency, so there should be no issue.