-
Notifications
You must be signed in to change notification settings - Fork 26.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
获取Serializer和Deserializer时,高并发情况下线程block #1196
Conversation
|
Codecov Report
@@ Coverage Diff @@
## master #1196 +/- ##
==========================================
- Coverage 27.69% 27.59% -0.11%
==========================================
Files 789 789
Lines 41577 41565 -12
Branches 8476 8476
==========================================
- Hits 11515 11468 -47
- Misses 28019 28053 +34
- Partials 2043 2044 +1
Continue to review full report at Codecov.
|
@carryxyh Please add some unit test |
已经添加了相关单元测试。主要是模拟单线程和多线程获取Serializer和Deserializer,保证一个SerializerFactory中,一个class只对应一个Serializer和Deserializer。 |
* 'master' of https://github.com/alibaba/dubbo: (248 commits) 获取Serializer和Deserializer时,高并发情况下线程block (apache#1196) Merge pull request from apache#1170, fix typo of SUFFIXES. apache#992 add codecov component (apache#993) Merge pull request from apache#1131, delete empty comments. Translate missing content and add apache license Add apache license and remove @author comment I18N effort for dubbo-common, translate the missing content I18N effort for code base, translate the missing content I18N effort for dubbo-admin, translate the missing content I18N effort for dubbo-cluster, translate the missing content I18N effort, translate the missing content I18N effort for dubbo-remoting, translate the missing content Change default locale from zh to en I18N effort for dubbo-admin, xml and UT, apache#1124 I18N effort for dubbo-admin, apache#1124 fix typo translate comments into english translate comments fix typo change comment to english ... # Conflicts: # dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalance.java # dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java
* SerializerFactory 获取Serializer时,锁住整个hashmap,导致整个过程被block * 单元测试。保证一个class只有一个serializer和deserializer。单线程和多线程测试 * 增加线程数 50 模拟多个线程来获取serializer和deserializer
* SerializerFactory 获取Serializer时,锁住整个hashmap,导致整个过程被block * 单元测试。保证一个class只有一个serializer和deserializer。单线程和多线程测试 * 增加线程数 50 模拟多个线程来获取serializer和deserializer
* SerializerFactory 获取Serializer时,锁住整个hashmap,导致整个过程被block * 单元测试。保证一个class只有一个serializer和deserializer。单线程和多线程测试 * 增加线程数 50 模拟多个线程来获取serializer和deserializer
SerializerFactory是从hession中移植过来的类,之前版本的_cachedSerializerMap、_cachedDeserializerMap和_cachedTypeDeserializerMap均为hashmap,获取Serializer(getSerializer方法)和Deserializer时,锁住整个hashmap,锁粒度太大。现在改成ConcurrentHashMap。
hessian 4.0.38中也已经将这两个hashmap替换为ConcurrentHashMap。