KYLIN-3716 FastThreadLocal replaces ThreadLocal#436
KYLIN-3716 FastThreadLocal replaces ThreadLocal#436SteNicholas wants to merge 2 commits intoapache:masterfrom
Conversation
|
Can one of the admins verify this patch? |
shaofengshi
left a comment
There was a problem hiding this comment.
This PR doesn't pass the "mvn test", please double check.
I did a quick check, found two issues:
- The ThreadLocal class couldn't be initialized; the root cause it:
java.lang.NullPointerException
at org.apache.kylin.common.threadlocal.ThreadLocalMap.nextVariableIndex(ThreadLocalMap.java:68)
After moving "nextIndex = new AtomicInteger()" before "slowThreadLocalMap = new ThreadLocal();", this error can be avoided;
-
Dead loop:
at org.apache.kylin.common.threadlocal.ThreadLocalMap.get(ThreadLocalMap.java:51)
at org.apache.kylin.common.threadlocal.ThreadLocal.get(ThreadLocal.java:120)
at org.apache.kylin.common.threadlocal.ThreadLocalMap.slowGet(ThreadLocalMap.java:144)
at org.apache.kylin.common.threadlocal.ThreadLocalMap.get(ThreadLocalMap.java:51)
at org.apache.kylin.common.threadlocal.ThreadLocal.get(ThreadLocal.java:120)
at org.apache.kylin.common.threadlocal.ThreadLocalMap.slowGet(ThreadLocalMap.java:144)
For 2), I don't know how to handle it, I suggest you take a look and do test for it. Thanks!
|
@shaofengshi I did maven test and rename the classes of threadlocal package that causes some exception you referred.I have already return to the origin class name and checked maven test passed. |
shaofengshi
left a comment
There was a problem hiding this comment.
Hi Nicholas, thanks for the patch. Is it possible to add the dependency on netty and then use netty's "FastThreadLocal" class in Kylin? instead of copying the source code into Kylin?
|
@shaofengshi Yeah,it is possible to add the dependency on netty and then use netty's "FastThreadLocal" class in Kylin.I simplify FastThreadLocal by using InternalThreadLocal and avoid more dependency in Kylin.Therefore, there is two ways to improve ThreadLocal performance by different aspects. |
|
Hi Nicholas, I merge the change by merging the two commits into one, and modified the commit message to follow Apache rule. Thanks for your patience! |
In kylin query engine,QuerySevice acquires OLAPContext through ThreadLocal.In certain research,the development that FastThreadLocal replaces ThreadLocal to store thread OLAPContext is substantial performance improvement.