• 1. 温绍锦(温高铁) http://weibo.com/wengaotie
  • 2. Druid数据库连接池的特点稳定 高效率 可扩展 可监控 可动态配置 防SQL注入
  • 3. 稳定阿里巴巴大规模部署 应用超过500个 部署实例超过3000 最大集群超过60台 我们大规模使用中,开源连接池只有两个是稳定的: Druid DataSource Jboss DataSource (历史原因还在使用)
  • 4. 稳定的特性-ExceptionSorter当连接产生不可恢复的异常时,需要及时从连接池中清除,否则会产生大量错误。这个功能也称为ExceptionSorter,只有JBossDataSource和DruidDataSource实现了这个功能。
  • 5. Oracle Fatal ExcetionError Code28Session has been killed600Internal oracle error1012Not logged on1014Oracle shutdown in progress1033Oracle initialization or shutdown in progress1034Oracle not available1035ORACLE only available to users with RESTRICTED SESSION privilege1089Immediate shutdown in progres – no operations are permitted1090Shutdown in progress – no operations are permitted1092ORACLE instance terminated. Disconnection forced1094ALTER DATABASE CLOSE in progress. Connections not permitted…
  • 6. MySql Fatal ExceptionError Code1040ER_CON_COUNT_EEROR1042ER_BAD_HOST_ERRROR1043ER_HANDSHAKE_ERROR1047ER_UNKOWN_COM_ERROR1081ER_IPSOCK_ERROR1029ER_HOST_IS_BLOCKED1030ER_HOST_NOT_PRIVILEGED1045ER_ACCESS_DENIED_ERROR1004ER_CANT_CREATE_FILE1005ER_CANT_CREAT_TABLE1015ER_CANT_LOCK1021ER_DISK_FULL…
  • 7. 高性能1 线程2 线程5 线程10 线程20线程50线程Druid1,1021,5091,8891,9042,0071,977Tomcat-jdbc1,3991,3782,2572,2892,3052,503DBCP3,1443,8346,2766,4086,5636,783BoneCP4,3273,5983,8005,2429,40219,066Jboss-Datasource4,9123,0496,8686,51240,14643,748C3P018,57019,46715,27019,29428,19566,677Proxool16,22114,45524,68838,90548,087 (Error)58,238 (Error)详细测试信息: https://github.com/alibaba/druid/wiki/%E5%90%84%E7%A7%8D%E8%BF%9E%E6%8E%A5%E6%B1%A0%E6%80%A7%E8%83%BD%E5%AF%B9%E6%AF%94%E6%B5%8B%E8%AF%95 Druid是目前性能最好的数据库连接池
  • 8. (本页无文本内容)
  • 9. SQL ParserParser基本概念 词法分析 Token 语法分析 抽象语法树 表达式 语句
  • 10. 手写Parser的性能Cobar的SQL Parser,从Antlr生成的parser修改为Druid Parser之后,大约提升6倍的性能。 Druid Parser最近再次大幅度提升性能(50%) SQL Parser的关键在于词法 词法分析要支持预测
  • 11. 监控
  • 12. Spring关联监控
  • 13. Web关联监控
  • 14. 查看SQL执行明细配置filters=log4j2013-07-12 16:10:17,966 [DEBUG] Connection:132 - {conn-10001} connected 2013-07-12 16:10:17,970 [DEBUG] Connection:132 - {conn-10001} commited 2013-07-12 16:10:17,970 [DEBUG] Connection:132 - {conn 10001} rollback 2013-07-12 16:10:17,983 [DEBUG] Statement:137 - {conn-10001, stmt-20000} created 2013-07-12 16:10:17,986 [DEBUG] Statement:137 - {conn-10001, stmt-20000} executed. 0.052501 millis. SELECT 1 2013-07-12 16:10:17,986 [DEBUG] Statement:137 - {conn-10001, stmt-20000} batch executed. 0.041842 millis. SELECT 1 2013-07-12 16:10:18,205 [DEBUG] Statement:137 - {conn-10001, stmt-20000, rs-50000} query executed. 219.082247 millis. SELECT 1 2013-07-12 16:10:18,205 [DEBUG] ResultSet:142 - {conn-10001, stmt-20000, rs-50000} open 2013-07-12 16:10:18,206 [DEBUG] ResultSet:142 - {conn-10001, stmt-20000, rs-50000} Header: [null] 2013-07-12 16:10:18,206 [DEBUG] Statement:137 - {conn-10001, stmt-20000} update executed. effort 0. 0.019343 millis. SELECT 1 2013-07-12 16:10:18,223 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} created. SELECT 1 2013-07-12 16:10:18,260 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} Parameters : [null, null, null, null, com.alibaba.druid.mock.MockBlob@34aee875, 1, [B@471f7458, null, com.alibaba.druid.mock.MockClob@620f61e2, null, 1.0, 1, 1, null, com.alibaba.druid.mock.MockNClob@5fe36eb9, null, null, null, com.alibaba.druid.mock.MockRef@4c7a64dd, com.alibaba.druid.mock.MockRowId@77741064, 1, com.alibaba.druid.mock.MockSQLXML@64e05280, , null, null, null, null] 2013-07-12 16:10:18,260 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} Types : [ARRAY, OTHER, DECIMAL, OTHER, BLOB, TINYINT, OTHER, OTHER, CLOB, DATE, FLOAT, INTEGER, BIGINT, OTHER, NCLOB, NVARCHAR, VARCHAR, OTHER, REF, ROWID, SMALLINT, SQLXML, VARCHAR, TIME, TIMESTAMP, OTHER, OTHER] 2013-07-12 16:10:18,260 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} executed. 0.564872 millis. SELECT 1 2013-07-12 16:10:18,260 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} batch executed. 0.0075 millis. SELECT 1 2013-07-12 16:10:18,260 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} Parameters : [null, null, null, null, com.alibaba.druid.mock.MockBlob@34aee875, 1, [B@471f7458, null, com.alibaba.druid.mock.MockClob@620f61e2, null, 1.0, 1, 1, null, com.alibaba.druid.mock.MockNClob@5fe36eb9, null, null, null, com.alibaba.druid.mock.MockRef@4c7a64dd, com.alibaba.druid.mock.MockRowId@77741064, 1, com.alibaba.druid.mock.MockSQLXML@64e05280, , null, null, null, null] 2013-07-12 16:10:18,262 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} Types : [ARRAY, OTHER, DECIMAL, OTHER, BLOB, TINYINT, OTHER, OTHER, CLOB, DATE, FLOAT, INTEGER, BIGINT, OTHER, NCLOB, NVARCHAR, VARCHAR, OTHER, REF, ROWID, SMALLINT, SQLXML, VARCHAR, TIME, TIMESTAMP, OTHER, OTHER] 2013-07-12 16:10:18,262 [DEBUG] Statement:137 - {conn-10001, pstmt-20001, rs-50001} query executed. 1.805932 millis. SELECT 1 2013-07-12 16:10:18,262 [DEBUG] ResultSet:142 - {conn-10001, pstmt-20001, rs-50001} open 2013-07-12 16:10:18,263 [DEBUG] ResultSet:142 - {conn-10001, pstmt-20001, rs-50001} Header: [null] 2013-07-12 16:10:18,263 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} Parameters : [null, null, null, null, com.alibaba.druid.mock.MockBlob@34aee875, 1, [B@471f7458, null, com.alibaba.druid.mock.MockClob@620f61e2, null, 1.0, 1, 1, null, com.alibaba.druid.mock.MockNClob@5fe36eb9, null, null, null, com.alibaba.druid.mock.MockRef@4c7a64dd, com.alibaba.druid.mock.MockRowId@77741064, 1, com.alibaba.druid.mock.MockSQLXML@64e05280, , null, null, null, null] 2013-07-12 16:10:18,263 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} Types : [ARRAY, OTHER, DECIMAL, OTHER, BLOB, TINYINT, OTHER, OTHER, CLOB, DATE, FLOAT, INTEGER, BIGINT, OTHER, NCLOB, NVARCHAR, VARCHAR, OTHER, REF, ROWID, SMALLINT, SQLXML, VARCHAR, TIME, TIMESTAMP, OTHER, OTHER] 2013-07-12 16:10:18,263 [DEBUG] Statement:137 - {conn-10001, pstmt-20001} update executed. effort 0. 0.287765 millis. SELECT 1 2013-07-12 16:10:18,274 [DEBUG] Statement:137 - {conn-10001, cstmt-20002} created. SELECT 1 2013-07-12 16:10:18,274 [DEBUG] Statement:137 - {conn-10001, stmt-20000, rs-50002} query executed. 0.081711 millis. SELECT 1 2013-07-12 16:10:18,274 [DEBUG] ResultSet:142 - {conn-10001, stmt-20000, rs-50002} open 2013-07-12 16:10:18,274 [DEBUG] ResultSet:142 - {conn-10001, stmt-20000, rs-50002} Header: [null] 2013-07-12 16:10:18,275 [DEBUG] ResultSet:142 - {conn-10001, stmt-20000, rs-50002} Result: [1]
  • 15. 防御SQL注入配置filters=“wall” 智能拦截永真条件 智能拦截系统函数调用 智能拦截系统表访问
  • 16. 集中配置、动态配置filters=“config” 支持数据库密码加密 支持从本地或者http远程读取配置文件