{"action":"created","issue":{"url":"https://api.github.com/repos/alibaba/druid/issues/2594","repository_url":"https://api.github.com/repos/alibaba/druid","labels_url":"https://api.github.com/repos/alibaba/druid/issues/2594/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/druid/issues/2594/comments","events_url":"https://api.github.com/repos/alibaba/druid/issues/2594/events","html_url":"https://github.com/alibaba/druid/issues/2594","id":326448522,"number":2594,"title":"连接池占用大量活跃连接，不释放。","user":{"login":"jieyisoft","id":33505806,"avatar_url":"https://avatars2.githubusercontent.com/u/33505806?v=4","gravatar_id":"","url":"https://api.github.com/users/jieyisoft","html_url":"https://github.com/jieyisoft","followers_url":"https://api.github.com/users/jieyisoft/followers","following_url":"https://api.github.com/users/jieyisoft/following{/other_user}","gists_url":"https://api.github.com/users/jieyisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/jieyisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jieyisoft/subscriptions","organizations_url":"https://api.github.com/users/jieyisoft/orgs","repos_url":"https://api.github.com/users/jieyisoft/repos","events_url":"https://api.github.com/users/jieyisoft/events{/privacy}","received_events_url":"https://api.github.com/users/jieyisoft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-25T09:30:14Z","updated_at":"2018-05-25T14:13:11Z","closed_at":null,"author_association":"NONE","body":"环境\r\n1. druid版本：1.1.9，mybatis3.4.6+spring4.3.14\r\n2. DB环境：oracle12c RAC 2结点环境\r\n3. 应用环境：6个应用结点部署在6个独立虚拟化主机上，每个虚拟化主机配置都保持一致。应用结点的业务负责读5-6张表数据，没有事务，每张表数据量不大【1万-50万】\r\n\r\n问题：\r\n压力测试1000并发，通过F5负载至这6台应用主机，每个结点数据库初始连接50。发现6台机器，随机会有1台主机连接数会不断增长。查询druid监控界面的其他5台，活跃连接数都低于50，但出现问题的机器活跃连接数会逐渐增长到200（最大连接数）。后续将最大连接数放到600，连接数也一样吃完。查询代码都是通过mybatis mapper来进行调用，所以不存在手动打开连接但没关闭连接的问题，服务器压力比较大，负载在80%左右。\r\n但将应用的druid连接池换成 Hikari3.1.0连接池，6台应用结点都稳定保持活跃连接50以下，没有出现上面问题。\r\n\r\n比较奇怪的问题，@wenshao，望大神分析下。如下为druid配置。\r\n\r\ndruid 配置文件：\r\n\r\n`<property` name=\"name\" value=\"oracle-acq\" />  \r\n`<property name=\"url\" value=\"${jdbc.url}\" /> \r\n`<property name=\"driverClassName\" value=\"${jdbc.driver}\" /> \r\n`<property name=\"username\" value=\"${jdbc.username}\" />  \r\n`<property name=\"password\" value=\"${jdbc.password}\" />  \r\n`<property name=\"initialSize\" value=\"50\" />  \r\n`<property name=\"minIdle\" value=\"50\" />   \r\n`<property name=\"maxActive\" value=\"200\" />  \r\n`<property name=\"maxWait\" value=\"10000\" />  \r\n`<property name=\"timeBetweenEvictionRunsMillis\" value=\"30000\" />  \r\n`<property name=\"minEvictableIdleTimeMillis\" value=\"300000\" />  \r\n`<property name=\"validationQuery\" value=\"select 1 from dual\" />\r\n`<property name=\"testWhileIdle\" value=\"true\" />  \r\n`<property name=\"testOnBorrow\" value=\"false\" />  \r\n`<property name=\"testOnReturn\" value=\"false\" />  \r\n`<property name=\"poolPreparedStatements\" value=\"true\" />  \r\n`<property name=\"maxPoolPreparedStatementPerConnectionSize\" value=\"50\" />  \r\n`<property name=\"filters\" value=\"stat,wall\" />   \r\n`<property name=\"timeBetweenLogStatsMillis\" value=\"300000\" />\r\n"},"comment":{"url":"https://api.github.com/repos/alibaba/druid/issues/comments/392070988","html_url":"https://github.com/alibaba/druid/issues/2594#issuecomment-392070988","issue_url":"https://api.github.com/repos/alibaba/druid/issues/2594","id":392070988,"user":{"login":"jieyisoft","id":33505806,"avatar_url":"https://avatars2.githubusercontent.com/u/33505806?v=4","gravatar_id":"","url":"https://api.github.com/users/jieyisoft","html_url":"https://github.com/jieyisoft","followers_url":"https://api.github.com/users/jieyisoft/followers","following_url":"https://api.github.com/users/jieyisoft/following{/other_user}","gists_url":"https://api.github.com/users/jieyisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/jieyisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jieyisoft/subscriptions","organizations_url":"https://api.github.com/users/jieyisoft/orgs","repos_url":"https://api.github.com/users/jieyisoft/repos","events_url":"https://api.github.com/users/jieyisoft/events{/privacy}","received_events_url":"https://api.github.com/users/jieyisoft/received_events","type":"User","site_admin":false},"created_at":"2018-05-25T14:13:11Z","updated_at":"2018-05-25T14:13:11Z","author_association":"NONE","body":"`<property` name=\"poolPreparedStatements\" value=\"false\" />\r\n`<property` name=\"maxPoolPreparedStatementPerConnectionSize\" value=\"0\" />  修改成这样的、问题依旧。\r\n\r\n然后跟踪那台有问题的JVM堆栈信息，发现50%的CPU消耗在DruidDataSource.pollLast上、20%消耗在DruidDataSource.recycle、20%消耗在DruidDataSource.getConnectionInternal 上。但其他5台堆栈里面这些完全没有。这台有问题的应用主机CPU比其他5台负载都高，非常奇怪，@wenshao。\r\n\r\n\t   "}}
{"actor":{"display_login":"jieyisoft"}}