备忘 - DBCP属性说明

initialSize :连接池启动时创建的初始化连接数量(默认值为0)

maxActive :连接池中可同时连接的最大的连接数(默认值为8,调整为20,高峰单机器在20并发左右,自己根据应用场景定)

maxIdle:连接池中最大的空闲的连接数,超过的空闲连接将被释放,如果设置为负数表示不限制(默认为8个,maxIdle不能设置太小,因为假如在高负载的情况下,连接的打开时间比关闭的时间快,会引起连接池中idle的个数 上升超过maxIdle,而造成频繁连接销毁和创建,类似于jvm参数中的Xmx设置)

minIdle:连接池中最小的空闲的连接数,低于这个数量会被创建新的连接(默认为0,调整为5,该参数越接近maxIdle,性能越好,因为连接的创建和销毁,都是需要消耗资源的;但是不能太大,因为在机器很空闲的时候,也会创建低于minidle个数的连接,类似于jvm参数中的Xmn设置)

maxWait  :最大等待时间,当没有可用连接时,连接池等待连接释放的最大时间,超过该时间限制会抛出异常,如果设置-1表示无限等待(默认为无限,调整为60000ms,避免因线程池不够用,而导致请求被无限制挂起)

poolPreparedStatements:开启池的prepared(默认是false,未调整,经过测试,开启后的性能没有关闭的好。) 

maxOpenPreparedStatements:开启池的prepared 后的同时最大连接数(默认无限制,同上,未配置) 

minEvictableIdleTimeMillis  :连接池中连接,在时间段内一直空闲, 被逐出连接池的时间(默认为30分钟,可以适当做调整,需要和后端服务端的策略配置相关) 

removeAbandonedTimeout  :超过时间限制,回收没有用(废弃)的连接(默认为 300秒,调整为180) 

removeAbandoned  :超过removeAbandonedTimeout时间后,是否进 行没用连接(废弃)的回收(默认为false,调整为true) 

------------------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">

<bean id="parentDataSourceMysql" class="org.apache.commons.dbcp.BasicDataSource" abstract="true">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="defaultAutoCommit" value="true"/>
<!--initialSize: 初始化连接-->
<property name="initialSize" value="#{dburlProps[‘mysql.task.initialSize‘]}"/>
<!--maxIdle: 最大空闲连接-->

</beans> 
<property name="maxIdle" value="#{dburlProps[‘mysql.task.maxIdle‘]}"/>
<!--minIdle: 最小空闲连接-->
<property name="minIdle" value="#{dburlProps[‘mysql.task.minIdle‘]}"/>
<!--maxActive: 最大连接数量-->
<property name="maxActive" value="#{dburlProps[‘mysql.task.maxActive‘]}"/>
<!--maxWait: 超时等待时间以毫秒为单位 -->
<property name="maxWait" value="#{dburlProps[‘mysql.task.maxWait‘]}"/>
</bean>
<bean id="dataSourceMysql" parent="parentDataSourceMysql">
<property name="url" value="#{dburlProps[‘mysql.url‘]}"/>
<property name="username" value="#{dbProps[‘mysql.username‘]}" />
<property name="password" value="#{dbProps[‘mysql.password‘]}" />
</bean>

<bean id="sqlSessionFactoryMysql" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis-config-mysql.xml" />
<property name="dataSource" ref="dataSourceMysql" />
</bean>

<bean id="mapperScannerConfigurerTask" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactory" ref="sqlSessionFactoryMysql"/>
<property name="basePackage" value="dao目录" />
</bean>

时间: 2024-09-20 15:23:21

备忘 - DBCP属性说明的相关文章

Table view 备忘

Table view 备忘 本篇会以备忘为主,主要是一些基础的代理方法和数据源方法具体的优化好点子会后续跟上. Table view的数据源方法 必须实现的数据源方法 // 返回每一行的cell,可以做缓存处理,同样也可能会造成复用问题. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { // tableview 和 cell 都是在s

linux下常用命令备忘

转自:Linux 命令集锦 linux下查看监听端口对应的进程 # lsof -i:9000 # lsof -Pnl +M -i4 如果退格键变成了:"^h". 终端连接unix删除退格键,按住CTL键同时按delete Linux搜索 # find / -name "xxx.conf" 查看linux是32位还是64位的命令 #file /sbin/init #getconf LONG_BIT #getconf -a 在Linux和Windows下都可以用nslo

Colletion View 简单的备忘

UIColletionView 这篇只是做UIColletionView的常用属性.代理方法和数据源方法的备忘,之后做一些自定义布局,增加删除动画等. UIColletionViewFlowLayout的常用属性和UIColletionView的常用属性方法 // 创建布局类 let layout = UICollectionViewFlowLayout() layout.itemSize = CGSizeMake(50.0, 50.0) layout.headerReferenceSize =

P2.JS之触碰材质(ContactMaterial)备忘

关键代码: 1 boxShape.material = new p2.Material(); 2 platformShape.material = new p2.Material(); 3 4 var material = new p2.ContactMaterial(boxShape.material, platformShape.material, { 5 surfaceVelocity: -50, 6 restitution: 0.5, 7 friction: 0.3, 8 stiffne

VS2008 Lua 编程环境搭建(初学备忘)

在VS 2008 中,导入 lua.h 之类的头文件后,编译含有Lua函数的时候,可能会出现如下错误: 1>main.obj : error LNK2019: 无法解析的外部符号_luaL_checkinteger,该符号在函数"int __cdecl add(struct lua_State *)" ([email protected]@[email protected]@@Z) 中被引用 1>main.obj : error LNK2019: 无法解析的外部符号_lua

备忘:CSS术语词汇表——张鑫旭

一.叨点什么 写文章的时候经常用到一些CSS方面的专业词汇.但是毕竟芳华年少不在,脑袋有点秀逗了,很多名词都记不住,这种感觉比厕所便秘还难受.比如今天居然记不起来公司公认脸蛋最pp的同事的名字,没想到我会记不住美女的名字.我觉得我背后一阵萧瑟的秋风吹起,自己俨然成了漫画里面的程序猿—— 某天闲逛到nimbupani,发现有专门展示CSS术语的文章,哇咔咔,感觉好像咬到一口正宗的高邮咸鸭蛋一样,不过人家的是英文,所以我还要本地化润饰处理,然后,就可以留给自己备忘的哈,的说. 二.CSS词汇我来也

移动端开发备忘

这是一些移动端开发的备忘记录. <meta> 元素 <meta name=“viewport” content=“width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no”/> width:宽度(数值 / device-width)(范围从200 到10,000,默认为980 像素) height:高度(数值 / device-height)(范围从223 到10,000) initial-s

Objective-C教程备忘单

终极版本的Objective-C教程备忘单帮助你进行iOS开发. 想开始创建你的第一个iOS应用程序么?那么看一下这篇很棒的教程吧:Create your first iOS 7 Hello World Application 注:这篇文章我写了三天,可能在一些必要的地方使用了编辑和说明,所以如果有任何疑问和修改建议请在下方评论. 这不是一个初学者指南,也不是关于Objective-C的详细讨论,这是关于常见的和高水平的论题的快速索引. 如果这里有些问题没有涉及到,你也可以查阅以下文章: Obj

ExtJs4常用配置方法备忘

viewport布局常用属性 new Ext.Viewport({ layout: "border", renderTo: Ext.getBody(), defaults: { bodyStyle: "background-color: #FFFFFF;", frame: true }, //split为true,即可达到上下左右拉伸效果 //layout:fit,填满布局 //collapsible:true,north模块被收缩到最上面 items: [{ re