What happens if we have a lot of users on our site at once?

I’m not too familiar with databases, but it seems like the max connection limit for MySQL is 151.


The link above just states the server requirements for handling increased traffic.

However, what if we have hundreds on our site at once - would I have to manually increase the max_connection limit?

Should I set this to a high number?



Disclaimer: I am not really that familiar with Databases and large Matomo instance, so take this with a grain of salt.

Yes, I think the max connection limit would mean that no more than 151 users can make the matomo.php request at the same time (or rather the part of the request, where the data is stored in the DB). But if we assume that the matomo.php request takes 100ms, then reaching 150 requests/100ms would mean more than 5 million requests in an hour, which is really a lot at which point you probably need to do more than just increase the connection limit.

Also keep in mind that another thing limiting your MySQL connections is the number of PHP workers handling the requests (assuming you use php-fpm). If you only have 10 workers who handle one request after another, you should never reach that many connections to the database.