What is difference between MysqlDataSource and MysqlConnectionPoolDataSource?

微笑、不失礼 提交于 2019-12-04 12:17:00

MysqlDataSource is a Java Native Database Interface that returns a connection to a database defined in the connection params. MysqlConnectionPoolDataSource is a subclass of MysqlDataSource that returns a pooled connection resource. The difference is whether your connection resource is pooled or the target of the connection is pooled. This usually is determined by Hard resources and number of expected connections. If you have many users connecting at once you would want to pool as many of those users into one connection as your hard resources like memory would allow. Therefore you would limit the number of Instances of a driver running in memory and allow the driver to manage as many threads as it can manage internally.

Think of a network hub vs a network switch. A Switch is always faster but is never realized until the volume of traffic is large enough to matter. The same is true for your question in that a pooled connection will increase performance if the number of users reaches a potential enveloped by memory and CPU.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!