数据库连接汇集是否重要? [英] Is DB connection pooling all that important?

查看:173
本文介绍了数据库连接汇集是否重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java世界中,应用服务器汇集昂贵资源(如数据库连接)是非常标准的。另一方面,在动态语言中,大多数堆栈与池化资源(尤其是数据库连接)几乎没有关系。

In the Java world it is pretty standard for app servers to pool "expensive" resources, like DB connections. On the other hand in dynamic languages, most stacks have little to do with pooled resources and especially DB connections.

例如。对于流行的PHP + MySQL组合,我很少看到它用于持久连接,这可以被认为是穷人合并的连接。

E.g. for the popular PHP+MySQL combo, I've rarely seen it used with persistent connection, which can be considered poor-mans pooled connections.

如果汇集数据库的概念连接并没有被广泛实现,这是否意味着在实际部署中性能/可伸缩性增益可能并不那么重要?

If the concept of pooling DB connections is not that widely implemented, does this mean that the performance/scalability gains might not be all that important, in real-life deployments?

推荐答案

连接池的主要原因是在第一个实例中建立连接的开销。我已经看到这在过去需要0.5秒。

The main reason for connection pooling is the overhead in establishing the connection in the first instance. I have seen this take up to 0.5 seconds in the past.

在高事务环境中,能够保持连接打开,并在连接中发送多个请求,一个接一个地节省了大量资金。因此,您可能看不到低事务数据库中的收益,但是如果忽略这种有用的模式,您的应用程序也不会扩展。

In a high transactional environment, the ability to keep a connection open, and send multiple requests down the connection, one after the other have significant savings. Therefore, you may not see the gains in a low transactional database, but your application is not going to scale as well, if you ignore this useful pattern.

它也有帮助以更清晰的方式管理开放连接的数量。

It also helps to managed the number of open connections in a much clearer way.

这篇关于数据库连接汇集是否重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆