当数据库不可用时 dbcp 返回连接时出现问题

发布于 2024-08-25 10:33:05 字数 603 浏览 1 评论 0 原文

我找到了埃里克森于 2009 年 1 月 29 日发布的以下链接:

DBCP(Apache Commons 数据库连接池)仍然相关吗?

“DBCP 有严重的缺陷,它不适合生产应用程序,尤其是当如此多的驱动程序本身支持数据源中的池化时

。就我而言,压垮骆驼的最后一根稻草是当我发现在对数据库进行新连接尝试的整个过程中整个池都被锁定,因此,如果您的数据库发生了导致连接缓慢或超时的情况,其他线程在尝试将连接返回到池时会被阻塞 - 即使它们是使用数据库完成的。”

我想知道自这篇文章以来 dbcp 是否发生了很大的变化或改进。我在我的生产系统中看到了这个确切的问题。

有人有 dbcp 的替代品吗?我在数据库连接框架中使用它......基本上,我继承了一个框架,工程师认为重写 hibernate 会很有趣。别问……这是一个漫长而肮脏的故事。无论如何,当数据库缓慢/缓慢时,我在将连接返回到池时遇到这些问题。有什么想法、建议、替代方案吗?

I found the following link by erickson dated jan 29, 2009:

Is DBCP (Apache Commons Database Connection Pooling) still relevant?

"DBCP has serious flaws. I don't think it's appropriate for a production application, especially when so many drivers support pooling in their DataSource natively.

The straw that broke the camel's back, in my case, was when I found that the entire pool was locked the whole time a new connection attempt is made to the database. So, if something happens to your database that results in slow connections or timeouts, other threads are blocked when they try to return a connection to the pool—even though they are done using a database."

I was wondering if much had changed or improved with dbcp since this post. I am seeing this EXACT problem in my production system.

Does anyone have any alternatives to dbcp? I use it in a database connection framework...basically, I inherited a framework where the engineers thought it would be fun to rewrite hibernate. don't ask...it's a long and sordid tale. Anyway, I'm having these problems returning connections to the pool when the database is slow/down. Any ideas, suggestions, alternatives?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫弦 2024-09-01 10:33:05

尝试 BoneCP: http://jolbox.com

对于您的情况,它具有发布帮助线程,该线程将负责发布连接缓慢或其他什么。

Try BoneCP: http://jolbox.com

For your case, it has release helper threads that will take care of releasing a connection slowly or whatever.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文