[
https://issues.apache.org/jira/browse/KYLIN-2716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080469#comment-16080469
]
Zhong Yanghong edited comment on KYLIN-2716 at 7/11/17 2:58 PM:
----------------------------------------------------------------
[[email protected]] & [~Shaofengshi], could you help have a check of this
patch which is for 2.0.0.
was (Author: yaho):
[~yangli907] & [~Shaofengshi], could you help have a check of this patch which
is for 2.0.0.
> Using non-thread-safe WeakHashMap leading to server high cpu
> ------------------------------------------------------------
>
> Key: KYLIN-2716
> URL: https://issues.apache.org/jira/browse/KYLIN-2716
> Project: Kylin
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: all
> Reporter: Zhong Yanghong
> Assignee: Zhong Yanghong
> Fix For: v2.0.0
>
> Attachments: APACHE-KYLIN-2716.patch
>
>
> Multiple threads invoke WeakHashMap.get() simultaneously may leading to a
> dead loop in *WeakHashMap.get() -> getTable() -> expungeStaleEntries()*,
> which finally resulting in server high cpu. There're two places using
> WeakHashMap.
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> One is used in the method *ClassUtil.forName()*.
> We made an inner test by invoking the method *ClassUtil.forName()* 1M times,
> the result is as follows:
> * With cache: 20ms;
> * Without cache: less than 2s.
> By invoking the method *ClassUtil.forName()* with *newInstance()* 1M times,
> the result is as follows:
> * With cache: around 2s
> * Without cache: around 3s.
> Considering *ClassUtil.forName()* is always invoked with *newInstance()*,
> there's no much downgrade without cache. Thus the fix is just to remove the
> cache.
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Another is used in the method *CubeService.getHTableInfo()*. We changed the
> WeakHashMap to Guava Cache with introducing size & time limitation.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)