New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alibaba/druid pool analysis #232
Comments
A quick run of the benchmark on my desktop PC yielded the following:
So, at least in our benchmark, Druid was the slowest for obtaining and returning connections, and the third fastest for creating and closing statements. Druid was configured with similar settings to other pools in the benchmark: druid.setInitialSize(0);
druid.setMinIdle(0);
druid.setMaxActive(32);
druid.setMaxWait(5000);
druid.setValidationQuery("SELECT 1");
druid.setTestOnBorrow(true);
druid.setDefaultAutoCommit(false);
druid.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); The benchmark page in their wiki does not show what settings they ran with, but I suspect that they disabled test-on-borrow. While I won't say that is "cheating", it is not how I would run a production pool. They also do not provide the source code to their test, as far as I can tell. |
druid was designed to focus on monitor and data access behavior enhance(like automatically database slice). it provides an SQL parser to analyze user's SQL query and delegate most JDBC class to collect metrics. |
@bobwenx It is a valid point. I will point out that New Relic is also supported by HikariCP through the DropWizard Metrics integration, but the metrics provided are "pool-level" metrics and not specific to query execution time, etc. |
If you configure maxWait property, druid pool use "fair mode ReentrantLock", it's bad performance. public void setMaxWait(long maxWaitMillis) {
if (maxWaitMillis == this.maxWait) {
return;
}
if (maxWaitMillis > 0 && useUnfairLock == null && !this.inited) {
final ReentrantLock lock = this.lock;
lock.lock();
try {
if ((!this.inited) && (!lock.isFair())) {
this.lock = new ReentrantLock(true);
this.notEmpty = this.lock.newCondition();
this.empty = this.lock.newCondition();
}
} finally {
lock.unlock();
}
}
if (inited) {
LOG.error("maxWait changed : " + this.maxWait + " -> " + maxWaitMillis);
}
this.maxWait = maxWaitMillis;
} This is by design, because we had some problems in the production environment. Here are the relevant documents, but I'm sorry, it is in Chinese. Druid of PreparedStatementCache optimized, this is very important to enhance the mysql 5.5 & oracle & sqlserver & db2 performance. Druid has very stable ExceptionSorter, including Oracle / MySql / Alibaba Oceanbase etc. In Taobao large-scale high concurrency environment, only two connection pools to work very well, druid and jboss connection pool. Druid is not just a connection pool, he can do a very good extension, similar to Filter-Chain extension. Built-in Filter include WallFilter, StatFilter, LogFilter. Which can WallFilter defense SQL injection, StatFilter can do performance monitoring, LogFilter can output SQL logs. Druid built very strong monitoring support. demo: http://198.11.179.104/druid/index.html |
温少不能忍了,哈哈哈 |
Hmmm I only see it claims as "the best" DB pool in Java, instead of the fast... 😕 Anyway I am glad to see more positive comparisons between HikariCP and Druid... |
Does wenshao or brettwooldridge can do the benchmark test according to druid characteristic and brettwooldridge's HikariCP benchmark source code? I think most people want to get a conclusion who is interesting in the performance of connection pool. |
I choose durid. the best and faster and the filters .... |
final result was??? |
Are you asking HikariCP? Benchmark results were in the first reply. |
Benchmark (jdbcUrl) (maxPoolSize) (pool) Mode Cnt Score Error Units Seems tomcat got higher performace in StatementBench test |
See the footnotes on the main project page. Tomcat only scores higher because we have to disable the StatementFinalizer, otherwise Tomcat fails to complete the benchmarks with an out of memory error. To be a fair test the StatementFinalizer should be enabled. |
druid有阿里大数据量的验证,而HikariCP没有 |
What validation? |
长期的使用,有阿里长期的大数据量的使用的验证 |
HikariCP is one of the most widely used connection pools in the world, used by some of the largest companies, serving literally billions of users per day. Druid is rarely seen outside of China. |
used by some of the largest companies?serving literally billions of users per day? |
Wix.com by itself, for example hosts over 109 million websites and serves over 1 Billion requests per day. Atlassian has millions of customers for its products -- no published numbers exists for daily usage. HikariCP is the default pool for every application built with the Play framework, Slick, JOOS, and is now the default pool for Spring Boot. HikariCP is resolved from the central maven repository over 300,000 times per month. |
To be honest, I prefer HikariCP 👍 |
我认为2个组件专注的方向不一样,各有特色和优点,不是组件如何,要看使用组件的人如何考虑,综合自己的需求选用,druid非常大一部分是为了监控和运维 |
I come here to learn tech instead of the difference of "capitalistic" tool and "communistic" tool.I think it's the performance and application scenario that count. And developers should help users to resolve that. |
it's very intersting druid and HikariCP are competing with each other ,and useful for users to use better tools in the future. |
一个印度小哥引发的口水战? |
This issue was marked as closed over 3 years ago. GitHub is not the correct place for general discussion. If there are specific other issues, please open a new issue. |
😂好无聊的事情。 |
Hi, I find your analysis on Java DB pools very informative. I happen to come across this 'druid' pool from Alibaba: https://github.com/alibaba/druid/wiki/FAQ (claims as the fastest DB pool in Java!).
From my very quick glance, seems it has some cool features. Any thoughts on this. Thanks.
The text was updated successfully, but these errors were encountered: