首页 技术 正文
技术 2022年11月19日
0 收藏 344 点赞 4,225 浏览 1326 个字

1.spring-petclinic介绍 
spring-petclinic是spring官方做的一个宠物商店,结合了spring和其他一些框架的最佳实践。

架构如下: 
1)前端 
Thymeleaf做HTML模板引擎或纯JSP加Tag 
CSS采用Bootstrap 
webjars用来管理客户端依赖 
Dandelion做表格

2)后端 
Controller,用Spring MVC, Bean Validation 
Service, 用Spring事务,加上ehcache缓存 
Repository,写了3套,spring data jpa, jpa, jdbc,供大家自由选择 
异常处理,统一交给SimpleMappingExceptionResolver处理,导向一个页面exception.jsp

2.性能调优 
有专家对这个示例做了一些性能调优实战,使得性能从285 req/sec提升到了1225 req/sec。

性能调优实战一共分5天,对应5篇文章。

第1天,搭建jmeter测试环境,写jmeter脚本,测试一开始的性能是285 req/sec 
第2天,用yourkit剖析问题,抓出元凶Dandelion,并解决性能问题,性能提升到560 req/sec。 
随后去session化,性能变为532 req/sec。 
再使用tomcat新的NIO connector,性能提升到867 req/sec 
第3天,找到Commons DBCP乃又一元凶,改用tomcat dbcp,性能提升到910 req/sec。 
Webjars也有损性能,所以去掉,性能提升到942 req/sec 
去掉人为的monitoring AOP,性能提升到959 req/sec 
第4天,测试发现spring data jpa, jpa, jdbc三种性能差别不大。 
使用延迟加载和Open Session In View(要小心,有陷阱),性能提升到1066 req/sec 
第5天,增加一个cache,用来缓存JpaOwnerRepositoryImpl.findByLastName(),性能提升到1225 req/sec

3.链接 
官方原版petclinic 
专家优化版petclinic

5篇优化文章,对应5天优化历程 
Improving the performance of the Spring-Petclinic sample application (part 1 of 5) 
Improving the performance of the Spring-Petclinic sample application (part 2 of 5) 
Improving the performance of the Spring-Petclinic sample application (part 3 of 5) 
Improving the performance of the Spring-Petclinic sample application (part 4 of 5) 
Improving the performance of the Spring-Petclinic sample application (part 5 of 5)

原文链接:https://xpenxpen.iteye.com/blog/2146465

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,104
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,581
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,428
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,835
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,918