天天看點

Spring 2.5 Perfomance Improvements 200% 直逼 Guice

并發性能提升的原因之一是使用了 concurrenthashmap,原來的 collections.synchronized(new hashmap()) 存在同步鎖的性能瓶頸;

如果你是用jdk 5.0或以上的版本,就可以直接得到這個性能的提升的好處了。

或者下載下傳 emory concurrent utilities backport 加到 classpath 中

<a href="" target="_blank">http://dcl.mathcs.emory.edu/util/backport-util-concurrent/</a>

當然還要努力,越快越好啦。。。

引用

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

詳細請見這裡

<a href="http://www.jroller.com/solomon/entry/spring_2_5_perfomance_improvements" target="_blank">http://www.jroller.com/solomon/entry/spring_2_5_perfomance_improvements</a>