使用c3p0连接池时,MySQL的最佳最大连接设置是什么(What is the best maximum connections setting for MySQL when using c3p0 connection pooling)
作为问题,我将描述我们当前的生产环境。
- 每个客户端都获得了Spring / Hibernate应用程序的部署
- 每个部署都有自己的数据库。
- 现在我们的服务器上有超过300个客户端
我已将c3p0配置为最小连接池大小为1,增量值为3,最多为20个连接。 所以我的问题是,我与MySQL的最大连接应该是什么? 它应该是最大池大小乘以客户端数量(20 * 300 = 6000)吗? 还是应该少一点? 如果c3p0已经说过,3个连接已经尝试获取另一个并且MySQL处于最大值,那么会发生错误吗?
我不认为所有客户端都需要同时使用它们的最大数量,但我确实希望防止在发生边缘情况时发生任何错误。
To being the question, I will describe our current production environment.
- Each client gets a deployment of our Spring/Hibernate application
- Each deployment gets it's own database.
- There are upwards of 300 clients on our server now
I have configured c3p0 with a minimum connection pool size of 1 with an increment value of 3 and a maximum of 20 connections. So my question is, what should my maximum connections to MySQL be? Should it be the max pool size times the number of clients (20 * 300 = 6000)? Or should it be less? Will an error occur if c3p0 has say, 3 connections already and tries to obtain another and MySQL is at it's max?
I do not think that all clients will need their maximum number all at the same time, but I do want to prevent any errors from happening if a fringe case occurs.