hibernate性能优化记录
来源:互联网 发布:medusa windows 编辑:程序博客网 时间:2024/06/10 10:38
之前自己搭建的一个关于SSH(spring+springMVC+hibernate3)的框架,但是存在不完整的地方,项目在上线运行过程中存在访问速度慢的,时常存在页面卡顿的情况。 导致页面反应慢的原因: 1.项目框架搭建不够好; 2.数据库访问缓慢(安装在阿里云的mysql数据库所在服务器内存不够,直接使用navicat查询,也会存在卡顿)项目优化: 1.hibernate 添加连接池配置 上一篇记录application.xml文件关于hibernate配置 替换为
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <property name="hibernateProperties"> <props> <!-- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> --> <!-- 方言 --> <!--导入上面咱自定义的类--> <prop key="hibernate.dialect">com.MySQLExtendDialect</prop> <!-- <prop key="hibernate.hbm2ddl.auto">update</prop>--> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <!-- 开启二级缓存 开启二级缓存,实体对象文件*.hbm.xml中需在class后紧跟cache 如:<class name="com.entity.equipment.xxx" table="xxx"> <cache usage="read-write"/> 项目中涉及到修改 所以usage 使用的read-write 若只存在查询可使用read-only--> <prop key="hibernate.cache.use_second_level_cache">true</prop> <!-- 开启查询缓存 --> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop> <!--初始化连接数--> <prop key="initialPoolSize">30</prop> <!--最大连接数--> <prop key="hibernate.c3p0.max_size">60</prop> <!--最小连接数--> <prop key="hibernate.c3p0.min_size">10</prop> <!--连接超时时间--> <prop key="hibernate.c3p0.timeout">120</prop> <prop key="hibernate.c3p0.max_statements">100</prop> <prop key="hibernate.c3p0.idle_test_period">120</prop> <prop key="hibernate.c3p0.acquire_increment">2</prop> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <prop key="acquireIncrement">3</prop> <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> <prop key="acquireRetryAttempts">30</prop> </props> </property> <property name="mappingDirectoryLocations"> <value>classpath:mapper/</value> </property> </bean>
阅读全文
0 0
- hibernate性能优化记录
- hibernate查询性能优化
- Hibernate 性能优化技巧
- hibernate之性能优化
- Hibernate性能优化
- Hibernate性能优化
- Hibernate性能优化
- Hibernate性能优化问题
- hibernate性能优化
- Hibernate 性能优化技巧
- Hibernate性能优化
- Hibernate性能优化
- Hibernate性能优化
- Hibernate性能优化
- Hibernate性能优化策略
- hibernate性能优化
- Hibernate性能优化
- hibernate性能优化
- Caffe 中 BN(BatchNorm ) 层的参数均值、方差和滑动系数解读
- RESTful API设计指南
- [iOS]删除相册图片
- Python 文件夹遍历和文件查找
- 快速实现:删除和预览当前选择需要上传的图片
- hibernate性能优化记录
- Grails输出jdbc查询sql
- hibernate-提纲
- postman使用进阶
- Rstudio使用技巧:打开代码时中文乱码
- Kotlin初识
- python实现泊松图像融合
- Kotlin语法(三)
- 一般的加密技,数字证书,https以及其他