`

Spring 2.5 Perfomance Improvements 200% 直逼 Guice

    博客分类:
  • Java
阅读更多
并发性能提升的原因之一是使用了 ConcurrentHashMap,原来的 Collections.synchronized(new HashMap()) 存在同步锁的性能瓶颈;

如果你是用JDK 5.0或以上的版本,就可以直接得到这个性能的提升的好处了。

或者下载 Emory concurrent utilities backport 加到 CLASSPATH 中
http://dcl.mathcs.emory.edu/util/backport-util-concurrent/

当然还要努力,越快越好啦。。。

引用

The upcoming Spring Framework version 2.5 will bring a 200% improvement for concurrent access over Spring 2.0.*. I used Crazy Bob's Semi Useless Benchmark ™ as a starting point. I fiddled with the code slightly to change the default behavior from "prototype" to "singleton", and I saw that spring 2.5 was faster than Guice for singletons.

Here are some benchmarks (there is variability based on the runs)

    * Spring 2.0 vs. guice 1.0:
          o Prototype: Single thread: Spring is 50-150X slower. Concurrent: Spring is 50-150X slower.
          o Singleton: Single thread: Spring 3X slower - 2X faster. Concurrent: Spring is 5-10X slower
    * Spring 2.0.6 vs. guice 1.0:
          o Prototype: Single thread: Spring is ~10X slower. Concurrent: Spring is 5X slower.
          o Singleton: Single thread: Spring 2X slower - 2X faster. Concurrent: Spring:Guice ~2:3
    * Spring 2.14m vs. guice 1.0:
          o Prototype: Single thread: Spring is 5-7X slower. Concurrent: Spring is 3-4X slower.
          o Singleton: Single thread: neck and neck. Concurrent: Spring is 1-1.5X faster
    * guice 1.0:
          o Prototype: Single thread vs. Concurrent: Concurrent might be a bit slower than single threaded
          o Singleton: Single thread vs. Concurrent: Concurrent is quite a bit faster than single threaded


详细请见这里
http://www.jroller.com/Solomon/entry/spring_2_5_perfomance_improvements
分享到:
评论
16 楼 lijun96 2007-11-27  
spring2.5有好几个类是jdk6的!!!!!!
15 楼 hantsy 2007-11-27  
很多还在用1.2.x。。。那个性能测试很片面,那篇blog下面都Bob Lee的回复。。。
Posted by Bob Lee  on October 09, 2007 at 01:08 PM EDT #
@Bob... I used your test that you provide at (http://google-guice.googlecode.com/svn/trunk/test/com/google/inject/PerformanceComparison.java) and added .in(Scopes.SINGLETON) to the three beans. I assume that's the correct way to configure singletons in Guice 1.0
14 楼 avi2 2007-10-26  
期待一下
13 楼 manmoon 2007-10-25  
哎,框架热潮是一波赶一波阿,最终会一切回归自然的。
12 楼 e3002 2007-10-25  
老不用。思想都快忘了!哈哈
11 楼 kenees 2007-10-18  
我TMD的是彻底落伍了,呵呵,跟不上节奏,只有思想在了
10 楼 pilot 2007-10-18  
我们用的版本我定的 2.0.7
9 楼 zdonking 2007-10-16  
我们1.2.6
8 楼 JerryZheng 2007-10-15  
我们公司还在用1.2.3。。。
7 楼 yueguangyuan 2007-10-15  
Spring 2.5  ……
果然是开源软件,升级有够快, 跟着链接的信息跟进去看Juergen大叔的博客,原来是2.1转过去的
但是公司还在用Spring-on-wls1.2.5 升级无望,只能看着众多新特性眼馋,不知道大家在实际项目中怎么用,我想用Spring1.2.8的应该不在少数吧?
6 楼 Allen 2007-10-14  
这个改进对于那些系统需要频繁而且大量进行IOC动作的系统来说是比较有意义的;而对于那些同一时刻总共不会超过1000个注入实例的系统来说,效果就不是很明显了。

Spring在IOC这个基础项目上的努力还是令人可喜的,它全面降低J2EE项目开发难度的事实正在得到不断巩固。
5 楼 ecsoftcn 2007-10-12  
版本跳的快,升级麻烦。
4 楼 DigitalSonic 2007-10-11  
版本号跳好快,一下2.5了,期待ing
3 楼 jimmy.shine 2007-10-11  
Spring2.5目前仍然没有开放下载吧!
2 楼 Tin 2007-10-11  
YuLimin 写道
并发性能提升的原因之一是使用了 ConcurrentHashMap,原来的 Collections.synchronized(new HashMap()) 存在同步锁的性能瓶颈;

如果你是用JDK 5.0或以上的版本,就可以直接得到这个性能的提升的好处了。

或者下载 Emory concurrent utilities backport 加到 CLASSPATH 中
http://dcl.mathcs.emory.edu/util/backport-util-concurrent/

当然还要努力,越快越好啦。。。

引用

The upcoming Spring Framework version 2.5 will bring a 200% improvement for concurrent access over Spring 2.0.*. I used Crazy Bob's Semi Useless Benchmark ™ as a starting point. I fiddled with the code slightly to change the default behavior from "prototype" to "singleton", and I saw that spring 2.5 was faster than Guice for singletons.

Here are some benchmarks (there is variability based on the runs)

    * Spring 2.0 vs. guice 1.0:
          o Prototype: Single thread: Spring is 50-150X slower. Concurrent: Spring is 50-150X slower.
          o Singleton: Single thread: Spring 3X slower - 2X faster. Concurrent: Spring is 5-10X slower
    * Spring 2.0.6 vs. guice 1.0:
          o Prototype: Single thread: Spring is ~10X slower. Concurrent: Spring is 5X slower.
          o Singleton: Single thread: Spring 2X slower - 2X faster. Concurrent: Spring:Guice ~2:3
    * Spring 2.14m vs. guice 1.0:
          o Prototype: Single thread: Spring is 5-7X slower. Concurrent: Spring is 3-4X slower.
          o Singleton: Single thread: neck and neck. Concurrent: Spring is 1-1.5X faster
    * guice 1.0:
          o Prototype: Single thread vs. Concurrent: Concurrent might be a bit slower than single threaded
          o Singleton: Single thread vs. Concurrent: Concurrent is quite a bit faster than single threaded


详细请见这里
http://www.jroller.com/Solomon/entry/spring_2_5_perfomance_improvements


通过新特性提升性能是可喜的,说明Spring并没有背包袱。
但是对于IoC容器来说,这个性能提升往往没什么实际意义……因为虽说是10x甚至100x的差距,但是实际的单次注入性能差距从时间消耗上来说非常小……对应用来说得不到什么实际好处。
我觉得学习Spring性能改进的方法可能对我们的应用比较有意义。
1 楼 kyo100900 2007-10-10  
一直看好Spring,2.5期待中!!!!!!!!

相关推荐

Global site tag (gtag.js) - Google Analytics