Hmm in my case I used Postgresql rather than MariaDB. When I originally did it I kept on hitting connection issues and found out that PHP doesn’t really do “connection pooling” like I am used to in Java land.
In which case I modified my architecture to have PgBouncer to handle the connection pooling. I wonder if MariaDB/MySQL has something similar otherwise you just have to increase the capacity of the database.