spring-petclinic性能调优实战(转)

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/2146465git

相关文章
相关标签/搜索