Java Oracle 通用连接池 (UCP) 有多好
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2423490/
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
How good is Oracle Universal Connection Pool (UCP)
提问by Andrey Ashikhmin
Does anybody have experience with using Oracle UCP under real production load? Does it handle database reconnects well? Are there any multi-threading issues? Has anybody compared it with C3P0 or Apache DBCP?
有人有在实际生产负载下使用 Oracle UCP 的经验吗?它是否可以很好地处理数据库重新连接?是否存在多线程问题?有没有人将它与 C3P0 或 Apache DBCP 进行比较?
回答by murali
by using the connection pooling(IBM RAD) to oracle i am getting faster results.when compared to the normal programming concept.in the connection pooling properties, by defaults the max no.of connections is 10,and the ideal time out is 180 sec.
通过使用连接池(IBM RAD)到oracle,我得到了更快的结果。与正常的编程概念相比。在连接池属性中,默认情况下最大连接数为10,理想的超时时间为180秒.
here we can set up the max.of users users access at a time....
在这里我们可以设置用户一次访问的最大用户数....
回答by bconneen
I've seen multiple customers using UCP in production. I've seen none of the issues you are concerned about. It performs quite well under load. And can handle reconnects. The reconnect policy is configurable. It also supports RAC quite well.
我见过多个客户在生产中使用 UCP。我没有看到你关心的问题。它在负载下表现非常好。并且可以处理重新连接。重新连接策略是可配置的。它还很好地支持RAC。
But the real upside to using a commercial connection pool is that someone is responsible for any problems you have. You would be surprised how many people try to develop and maintain their own connection pool.
但是使用商业连接池的真正好处是有人负责您遇到的任何问题。您会惊讶于有多少人尝试开发和维护自己的连接池。
回答by oluies
I have used UCP in a system with around 10 transactions per seconds (mean) and 360 transactions per seconds peak, and no problems yet. (Number is per app server with 8 servers)
我已经在一个系统中使用了 UCP,每秒大约有 10 个事务(平均)和每秒 360 个事务的峰值,而且还没有问题。(数量是每个应用服务器有 8 个服务器)
However the main benefits you get from UCP is when you are using Oracle RAC and the TAF/FAN functionality, UCP with Dataguardor if you are running something outsidean appserver.
但是,您从 UCP 获得的主要好处是,当您使用 Oracle RAC 和TAF/FAN 功能、带有 Dataguard 的 UCP或者您在应用程序服务器之外运行某些东西时。
回答by MRalwasser
I evaluated UCP 11.2.0.1as a replacement for our legacy connection pool and I cannot recommend it:
我评估了 UCP 11.2.0.1作为我们旧连接池的替代品,我不能推荐它:
- it does not fully support jdk 6/ ojdbc6.jar. For example the use of statement caching and jmx-support does not work with java 6 and throws exceptions.
- no internal statement cache- it relies on the jdbc driver's statement cache (
setPoolable()
) - I submitted both issues to oracle, they confirmed it and will probably fix it when oracle 12.0 will be released. But even that's not for sure.
- Too few releases(2 releases in 3 years), too less community support.
- Not Open-Source
- Hardly extensible.Only a few callbacks with an horrible interface design.
Example: You want to be notified when a Connection exceeds its TTL? Prepare for a wrapper DataSource and a mass usage of internal/proprietary UCP APIs. The official documentation (last update: 2008) remains silent how to achive this. - Fat design(almost a 0,5 MB jar) - many classes with similar names/function (e.g. there's a
PoolDataSource
and aConnectionPool
- both are related but invoked differently and provide slightly different functionality.) - java.util.loggingonly
- 它不完全支持 jdk 6/ ojdbc6.jar。例如,语句缓存和 jmx-support 的使用不适用于 java 6 并引发异常。
- 没有内部语句缓存- 它依赖于 jdbc 驱动程序的语句缓存 (
setPoolable()
) - 我向 oracle 提交了两个问题,他们确认了它,并且可能会在 oracle 12.0 发布时修复它。但即使这样也不确定。
- 版本太少(3 年内发布2 个版本),社区支持太少。
- 不开源
- 很难扩展。只有少数具有可怕界面设计的回调。
示例:您想在连接超过其 TTL 时收到通知吗?准备包装数据源和大量使用内部/专有 UCP API。官方文档(上次更新:2008 年)对如何实现这一点保持沉默。 - 胖设计(几乎是一个 0.5 MB 的 jar)-许多具有相似名称/功能的类(例如,有 a
PoolDataSource
和 aConnectionPool
- 两者都是相关的,但调用方式不同,并提供略有不同的功能。) - 仅java.util.logging
UPDATE 1 (April 2014):
Although slightly off-topic: As a result of my evaluation I decided to go with the new tomcat jdbc-pool- and it is working almost perfectly since a year in several production systems. It's very well designed, updated regularly, extensible and the apache tomcat team does a good job in responding to questions/fixing issues.
更新 1(2014 年 4 月):
虽然有点偏离主题:根据我的评估,我决定使用新的tomcat jdbc-pool- 一年以来它在几个生产系统中几乎完美运行。它的设计非常好,定期更新,可扩展,apache tomcat 团队在回答问题/修复问题方面做得很好。
UPDATE 2 (July 2016):
I can now highly recommend HikariCPwhich I'm currently favoring over all other connection pools.
Its architecture, focus on correctness and performance is just amazing.
更新 2(2016 年 7 月):
我现在可以强烈推荐HikariCP,我目前比所有其他连接池更喜欢它。
它的架构,对正确性和性能的关注令人惊叹。
回答by Brett Okken
I have described the performance/scalability issues I have observed with UCP compared to implicit connection caching here: https://stackoverflow.com/a/27512252/676877
我已经描述了我在 UCP 中观察到的与隐式连接缓存相比的性能/可扩展性问题:https: //stackoverflow.com/a/27512252/676877
回答by TomWolk
I have just tried UCP with our Eclipse Link based application and I run into ORA-0100: Maximum open cursors exceeded every time. I have set the parameter MaxStatements to 10 but that had no effect. I have inspected the Heap and there were hundreds of T4CPreparedStatement objects alive but less than 10 wrapped statements. So there is a huge statement cache somewhere that I can not control.
我刚刚使用基于 Eclipse Link 的应用程序尝试了 UCP,但遇到了 ORA-0100:每次都超出最大打开游标数。我已将参数 MaxStatements 设置为 10,但这没有效果。我检查了堆,发现有数百个 T4CPreparedStatement 对象活着,但只有不到 10 个包装语句。所以有一个我无法控制的巨大语句缓存。
Tomcat jdbc pool works like a charm.
Tomcat jdbc 池就像一个魅力。