Java “Tomcat 7 JDBC 连接池”是否足以用于生产?与 BoneCP 相比如何?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20955875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 05:32:52  来源:igfitidea点击:

Is "Tomcat 7 JDBC Connection Pool" good enough for production? And how is it compare to BoneCP?

javaconnection-poolingbonecpjdbc-poolhikaricp

提问by BigFatSea

Our site get roughly 1M pv/day, and we use Tomcat for sure.

我们的网站每天大约获得 100 万次访问,我们肯定使用 Tomcat。

I couldn't find much information about jdbc-pool, not sure if it's stable enough for production. Anyone got experience on it? and any configuration/tuning stuff for reference?

我找不到关于jdbc-pool 的太多信息,不确定它是否足够稳定以进行生产。有人有这方面的经验吗?和任何配置/调整的东西供参考?

As someone mentioned, BoneCPmight be another choice. But seems it's discontinued (so sad...). Would it be a better choice?

正如有人提到的,BoneCP可能是另一种选择。但似乎已经停产了(太伤心了......)。会是更好的选择吗?

btw, HikariCPis too young, I would keep an eye on it as it's the latest/fastest CP so far I found.

顺便说一句,HikariCP太年轻了,我会密切关注它,因为它是迄今为止我发现的最新/最快的 CP。

Thanks for any advice.

感谢您的任何建议。

采纳答案by brettw

I'm one of the authors of HikariCP. That said, the "new" Tomcat pool is among the best we've tested. It has a lot of options, so if you plan to use it in production make sure you understand them to get a reliable configuration.

我是 HikariCP 的作者之一。也就是说,“新”Tomcat 池是我们测试过的最好的池之一。它有很多选项,因此如果您计划在生产中使用它,请确保您了解它们以获得可靠的配置。

Do not confuse the new Tomcat pool with Apache DBCP, which I would avoid.

不要将新的 Tomcat 池与 Apache DBCP 混淆,我会避免这样做。

We are starting the process of abuse testing various pools, including HikariCP, with tests such as bouncing the DB underneath the pool and measuring the resulting recovery. Check out site for results in the coming weeks.

我们正在开始对包括 HikariCP 在内的各种池进行滥用测试的过程,其中包括在池下弹跳数据库并测量由此产生的恢复等测试。在接下来的几周内查看网站以获取结果。

EDIT: Re: HikariCP being too young. Young though it may be it has had several billion transactions run through it. As with anything, I would suggest you try it in a pre-production environment before deployment. But the same goes for any pool you might choose.

编辑:回复:HikariCP 太年轻了。尽管可能很年轻,但它已经处理了数十亿笔交易。与任何事情一样,我建议您在部署之前在预生产环境中尝试它。但是对于您可能选择的任何池也是如此。

UPDATE 2015-06-01: I want to revise my statement above somewhat, it seems that Apache Commons DBCP is active once again, and has taken over for the dedicated/forked Tomcat DBCP. The refactors in Commons DBCP appear at first glance to be significant, and positive. However, due to their magnitude and despite being under the old Commons DBCP banner, I would characterize the pool as less mature than HikariCP at this point.

2015 年 6 月 1 日更新:我想稍微修改一下我上面的声明,似乎 Apache Commons DBCP 再次处于活动状态,并且已经接管了专用/分叉的 Tomcat DBCP。Commons DBCP 中的重构乍一看似乎很重要,而且是积极的。然而,由于它们的规模,尽管在旧的 Commons DBCP 旗帜下,我认为这个池在这一点上不如 HikariCP 成熟。

回答by PaulJWilliams

Tomcat DBCP is production ready - its simply an evolution of commons DBCP.

Tomcat DBCP 是生产就绪的——它只是公共 DBCP 的演变。

DB conn pools are pretty simple beasts - I wouldnt regard its use as being particularly risky.

DB conn 池是非常简单的野兽 - 我不会认为它的使用特别危险。

回答by RyNo

That's what the company I'm working for is using and we haven't had any problem with it.

这就是我工作的公司正在使用的,我们没有遇到任何问题。

We've been more limited by our web server's connection to our various data servers than the speed of Tomcat's connection pool, so unless speed is very important, it's probably not something you should be concerned about. As far as reliability goes, it hasn't dropped a connection yet in any of our testing, nor have we heard about it happening on our production site.

与 Tomcat 连接池的速度相比,我们受到 Web 服务器与各种数据服务器的连接的更多限制,因此除非速度非常重要,否则您可能不应该关心它。就可靠性而言,它在我们的任何测试中都没有断开连接,我们也没有听说过它发生在我们的生产现场。

I doubt you'll have a problem if you use Tomcat's connection pool.

如果您使用 Tomcat 的连接池,我怀疑您会遇到问题。

回答by wwadge

BoneCP is not discontinued, but consider it @Deprecated now that HikariCP is around; there's little point contributing significant resources to it now that something radically better is on the horizon. This is open-source, so let's all work collectively towards the best solution. Source: me (BoneCP author)

BoneCP 没有停产,但现在考虑它@Deprecated,因为 HikariCP 已经存在;既然更好的东西即将出现,那么为它贡献大量资源就没有什么意义了。这是开源的,所以让我们共同努力寻找最佳解决方案。来源:我(BoneCP 作者)

回答by geoand

Where I work we have a couple of systems running on the Tomcat pool.

在我工作的地方,我们有几个系统在 Tomcat 池上运行。

I must say that initially it was sort of a pain to get a good understanding of all the options it provides and how their values actually impact performance and reliability.

我必须说,最初要很好地理解它提供的所有选项以及它们的值如何实际影响性能和可靠性是一种痛苦。

After performing an initial trial and error phase, I have to admit that the Tomcat connection pool fits our needs perfectly. It seems robust and also have not caused any performance problems whatsoever.

在执行了初始试错阶段之后,我不得不承认 Tomcat 连接池非常适合我们的需求。它看起来很健壮,也没有造成任何性能问题。

With that said, I will definitely give HikariCP a try in my next project

话虽如此,我肯定会在我的下一个项目中尝试 HikariCP