设为首页 收藏本站
查看: 1462|回复: 0

[经验分享] weblogic数据库连接池相关参数说明

[复制链接]

尚未签到

发表于 2017-2-17 10:25:48 | 显示全部楼层 |阅读模式
  比较容易混淆的参数解释
  1:Inactive Connection Timeout
  这个参数很重要,是10以后的版本新加的,9版本没有,一般情况建议不要开启该参数,即使开启也尽可能要把数值设置大些,比如1800秒等。这个字段的具体官方解释在10.3.0.0的版本如下,在XX系统中实际反映的情况是,如果该参数设置为30(即:30S)的话,在大并发下会出现weblogic认为的leaked的连接,而且这时weblogic就会强制关闭这些连接回收,导致后续的应用获取连接时报connection has alreadly been closed的异常,但如果把该参数禁用(设为0s),用同样的大并发测试则一切正常,当连接池连接都被用时,连接请求会等待,超时会报取不到连接的异常,这些都是正常连接池的表现,这时在monitor中也没有出现显示Leaked 的连接。所以猜测Inactive Connection Timeout参数如果开启的话应该会影响weblogic的Leaked连接数的判断方式,这个回头做下试验。。。
Automatically Recovering Leaked Connections
A leaked connection is a connection that was not properly returned to the connection pool in the data source. To automatically recover leaked connections, you can specify a value for Inactive Connection Timeout on the JDBC Data Source: Configuration: Connection Pool page in the Administration Console. When you set a value for Inactive Connection Timeout, WebLogic Server will forcibly return a connection to the data source when there is no activity on a reserved connection for the number of seconds that you specify. When set to 0(the default value), this feature is turned off.
See the JDBC Data Source: Configuration: Connection Pool page in the Administration Console or see “ JDBCConnectionPoolParamsBean” in the WebLogic Server MBean Reference for more details about this option.
Note that the actual timeout could exceed the configured value for Inactive Connection Timeout. The internal data source maintenance thread runs every 5 seconds. When it reaches the Inactive Connection Timeout (for example 30 seconds), it checks for inactive connections. To avoid timing out a connection that was reserved just before the current check or just after the previous check, the server gives an inactive connection a “second chance.” On the next check, if the connection is still inactive, the server times it out and forcibly returns it to the data source. On average, there could be a delay of 50% more than the configured value.
  2:connection reserve timeout
  注意这个参数不是连接从连接池里取出以后用来执行SQL等其它操作时的生命周期时间,而是当从连接池取连接时如果池里的连接目前都正在被使用且池里的连接数已经达到上限时,这个取连接动作的超时时间,在这个时间内会一直等着,超过这个时间就会报a Connection Unavailable SQL Exception,如果不设置这个时间,那么出现连接达到上限还要取连接时会立即报a Connection Unavailable SQL Exception。具体看下面官方文档的解释:
Enabling Connection Requests to Wait for a Connection
JDBC data sources have two attributes that you can set to enable connection requests to wait for a connection from a data source: Connection Reserve Timeout (ConnectionReserveTimeoutSeconds) and Maximum Waiting for Connection (HighestNumWaiters). You use these two attributes together to enable connection requests to wait for a connection without disabling your system by blocking too many threads.
See the JDBC Data Source: Configuration: Connection Pool page in the Administration Console or see “ JDBCConnectionPoolParamsBean” in the WebLogic Server MBean Reference for more details about these options.
Also see “ Enable connection requests to wait for a connection” in the Administration Console Online Help.
Connection Reserve Timeout
When an application requests a connection from a data source, if all connections in the data source are in use and if the data source has expanded to its maximum capacity, the application will get a Connection Unavailable SQL Exception. To avoid this, you can configure the Connection Reserve Timeout value (in seconds) so that connection requests will wait for a connection to become available. After the Connection Reserve Timeout has expired, if no connection becomes available, the request will fail and the application will get aPoolLimitSQLException exception.
If you set Connection Reserve Timeout to -1, a connection request will timeout immediately if there is no connection available. If you set Connection Reserve Timeout to 0, a connection request will wait indefinitely. The default value is 10 seconds.
See “ Enable connection requests to wait for a connection” in the Administration Console Online Help.
官方连接
http://docs.oracle.com/cd/E12840_01/wls/docs103/jdbc_admin/index.html
 
  --------------------------------------------------------------------------------------------------------------------------------
  相关文档链接
  http://middleware123.com/weblogic/docs100/perform/jdbctuning.html
  http://topic.csdn.net/u/20080528/10/41c3e928-fddf-442f-bb32-969579d02ce3.html
  Servers--JDBC--Data Sources--在右边点击相应的数据源--选择Configuration下面的Connection Pool选项卡(这里是该数据源的连接池具体配置)
  1.URL:
  这里配置的是数据库的连接字符串   如:jdbc:oracle:thin:@10.4.44.21:1521:airsm
  2.Drive Class Name:
  这里配置的是数据库的驱动类  如:oracle.jdbc.OracleDriver
  3.Properties:
  这里配的是哪一个用户使用该数据源 如:user=aires
  4.Initial Capacity:
  这里配的是初始化时的连接数(可配置如下:最小值: 0 ,最大值: 2147483647)
  5.Maximum Capacity:
  连接池中接点服务器连接的最大数目,不要设置连接池的Initial Capacity和Maximum Capacity为一样的数。这可能会导致出现两个Oracle的节点服务器,一个的CPU占用已经达到99%-100%,而另外一个服务器还是10%左右的情况(导致接点服务资源分配不均)
  6.Capacity Increment:
  连接池容量在最大容量限制范围内的增量(每次增加的连接数)(可配置如下:最小值0 最大值2147483647)
  7.Statement Cache Typeprepared statements:
  缓存的策略有如下两个选项:
  LRU:LRU算法在有新的语句到来时,将最不经常被用得语句调整出缓存
  FIXED:FIXED算法为先进先出的算法
  8.Statement Cache Size
  宏语句设定的静态缓存,大小由JDBC连接池配置时指定,调整这个数值的大小,有利于提高系统的效率(可配置如下:最小值0 最大值1024)
  下面还有一些高级配置:
  1.Test Table Name 
  这里是在我们配数据源的过程中weblogic自动给我们配上的默认为SQL SELECT 1 FROM DUAL作用是在每次连接前对该连接先进行测试,该选项可以不配置
  2.
  Seconds to Trust an Idle Pool Connection:
  该参数设置的是已经被使用的连接在多长时间内再次被使用不需要测试该连接(单位:秒)
  3.Inactive Connection Timeout: 
  当application取得connection后,在所设定的时间内没有执行任何的动作,则此connection会被归还到connection pool(单位为:秒)
  最小值: 0 最大值: 2147483647
  4.Maximum Waiting for Connection
  假如connection pool的connection都被application使用,当有新的request需要使用connection时,所等待connection的时间(单位为:秒)
  5.Connection Reserve Timeout:
  连接保留超时时间相当于session,如过在web.xml和weblogic中同时配置,服务器会以web.xml文件中的配置为准,忽略weblogic中同时配置,(单位为:秒)
  6.Statement Timeout:
  限制connection执行SQL statement的时间(最小:-1 最大:2147483647)(单位为:秒,为-1时则不受限制)
  7.Pinned-To-Thread(启用需谨慎,对于并发量大的不推荐)
  启用后:当application关闭connection后,connection并无会回到connection pool,而是被keep在thread里,因此假如application在同一个thread又需要使用connection时,可以马上取得
  特点:不受限' Maximum Capacity'参数
  启用前须确认系统可以承受大量的connection
  8.Remove Infected Connections Enabled
  启用后:当application关闭connection后,WebLogic Server会自动重新建立一个新的connection,并放回到connection pool
使用 Pinned-To-Thread 属性提高性能
要将应用程序保留数据源中数据库连接耗费的时间缩到最短,以及避免线程争用数据库连接,可将 Pinned-To-Thread 属性添加到数据源的“连接属性”列表中,然后将其值设置为 true。
启用 Pinned-To-Thread 后,在应用程序首次使用某个执行线程保留连接时,WebLogic Server 会将数据源中的一个数据库连接固定到此线程。应用程序使用完该连接并调用 connection.close()(此方法在其他情况下将把连接返回数据源)时,WebLogic Server 将把该连接留给执行线程,不会将其返回数据源。当应用程序随后使用同一执行线程请求连接时,WebLogic Server 将提供该线程已保留的连接。当多个线程尝试同时保留一个连接时,该数据源上不会发生锁定冲突,对于尝试保留有限个数的数据库连接中同一个连接的线程,也没有冲突。
  
注意:在此版本中,Pinned-To-Thread 功能对多数据源、Oracle RAC 和 IdentityPool 无效。如果出现连接故障,或连接标识不匹配,则这些功能依赖于将连接返回连接缓冲池后再重新将其获取的能力。
请参阅“管理控制台联机帮助”中的JDBC 数据源: 配置: 连接缓冲池

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-343346-1-1.html 上篇帖子: weblogic启动时怎么可以不输入用户名和密码,直接启动 下篇帖子: WAS与低版本WebLogic进行WebService通信问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表