[ https://issues.apache.org/jira/browse/HBASE-9941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13861405#comment-13861405 ]
Andrew Purtell edited comment on HBASE-9941 at 1/3/14 10:34 AM: ---------------------------------------------------------------- Updated patch fixes javadoc warnings and includes a microbenchmark. I went and replaced with simple code where I was maybe getting too clever with anonymous classes. There is more cutting and pasting but additional overhead goes from ~11x to ~10x. Without the latest patch: {noformat} apurtell@acer:/usr/src/Hadoop/hbase$ ./bin/hbase org.apache.hadoop.hbase.CoprocessorInvocationEvaluation --trials 10 0% Scenario{vm=java, trial=0, benchmark=Invocations} 10.33 ns; σ=0.00 ns @ 3 trials 10% Scenario{vm=java, trial=1, benchmark=Invocations} 10.30 ns; σ=0.02 ns @ 3 trials 20% Scenario{vm=java, trial=2, benchmark=Invocations} 10.32 ns; σ=0.03 ns @ 3 trials 30% Scenario{vm=java, trial=3, benchmark=Invocations} 10.32 ns; σ=0.03 ns @ 3 trials 40% Scenario{vm=java, trial=4, benchmark=Invocations} 10.35 ns; σ=0.04 ns @ 3 trials 50% Scenario{vm=java, trial=5, benchmark=Invocations} 10.36 ns; σ=0.03 ns @ 3 trials 60% Scenario{vm=java, trial=6, benchmark=Invocations} 10.42 ns; σ=0.08 ns @ 3 trials 70% Scenario{vm=java, trial=7, benchmark=Invocations} 10.34 ns; σ=0.02 ns @ 3 trials 80% Scenario{vm=java, trial=8, benchmark=Invocations} 10.31 ns; σ=0.04 ns @ 3 trials 90% Scenario{vm=java, trial=9, benchmark=Invocations} 10.35 ns; σ=0.09 ns @ 7 trials {noformat} With the latest patch: {noformat} apurtell@acer:/usr/src/Hadoop/hbase$ ./bin/hbase org.apache.hadoop.hbase.CoprocessorInvocationEvaluation --trials 10 0% Scenario{vm=java, trial=0, benchmark=Invocations} 97.45 ns; σ=1.79 ns @ 10 trials 10% Scenario{vm=java, trial=1, benchmark=Invocations} 98.90 ns; σ=0.73 ns @ 3 trials 20% Scenario{vm=java, trial=2, benchmark=Invocations} 98.31 ns; σ=1.33 ns @ 10 trials 30% Scenario{vm=java, trial=3, benchmark=Invocations} 100.97 ns; σ=0.94 ns @ 5 trials 40% Scenario{vm=java, trial=4, benchmark=Invocations} 97.20 ns; σ=0.36 ns @ 3 trials 50% Scenario{vm=java, trial=5, benchmark=Invocations} 99.53 ns; σ=0.76 ns @ 3 trials 60% Scenario{vm=java, trial=6, benchmark=Invocations} 96.04 ns; σ=0.28 ns @ 3 trials 70% Scenario{vm=java, trial=7, benchmark=Invocations} 98.39 ns; σ=1.01 ns @ 10 trials 80% Scenario{vm=java, trial=8, benchmark=Invocations} 95.87 ns; σ=1.98 ns @ 10 trials 90% Scenario{vm=java, trial=9, benchmark=Invocations} 98.56 ns; σ=0.23 ns @ 3 trials {noformat} Java: Java(TM) SE Runtime Environment (build 1.7.0_21-b11) HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode) This overhead seems the cost of switching the thread context classloader. was (Author: apurtell): Updated patch fixes javadoc warnings and includes a microbenchmark. I went and replaced with simple code where I was maybe getting too clever with anonymous classes. There is more cutting and pasting but additional overhead goes from ~11x to ~10x. Without the latest patch: {noformat} apurtell@acer:/usr/src/Hadoop/hbase$ ./bin/hbase org.apache.hadoop.hbase.CoprocessorInvocationEvaluation --trials 10 0% Scenario{vm=java, trial=0, benchmark=Invocations} 10.33 ns; σ=0.00 ns @ 3 trials 10% Scenario{vm=java, trial=1, benchmark=Invocations} 10.30 ns; σ=0.02 ns @ 3 trials 20% Scenario{vm=java, trial=2, benchmark=Invocations} 10.32 ns; σ=0.03 ns @ 3 trials 30% Scenario{vm=java, trial=3, benchmark=Invocations} 10.32 ns; σ=0.03 ns @ 3 trials 40% Scenario{vm=java, trial=4, benchmark=Invocations} 10.35 ns; σ=0.04 ns @ 3 trials 50% Scenario{vm=java, trial=5, benchmark=Invocations} 10.36 ns; σ=0.03 ns @ 3 trials 60% Scenario{vm=java, trial=6, benchmark=Invocations} 10.42 ns; σ=0.08 ns @ 3 trials 70% Scenario{vm=java, trial=7, benchmark=Invocations} 10.34 ns; σ=0.02 ns @ 3 trials 80% Scenario{vm=java, trial=8, benchmark=Invocations} 10.31 ns; σ=0.04 ns @ 3 trials 90% Scenario{vm=java, trial=9, benchmark=Invocations} 10.35 ns; σ=0.09 ns @ 7 trials {noformat} With the latest patch: {noformat} apurtell@acer:/usr/src/Hadoop/hbase$ ./bin/hbase org.apache.hadoop.hbase.CoprocessorInvocationEvaluation --trials 10 0% Scenario{vm=java, trial=0, benchmark=Invocations} 97.45 ns; σ=1.79 ns @ 10 trials 10% Scenario{vm=java, trial=1, benchmark=Invocations} 98.90 ns; σ=0.73 ns @ 3 trials 20% Scenario{vm=java, trial=2, benchmark=Invocations} 98.31 ns; σ=1.33 ns @ 10 trials 30% Scenario{vm=java, trial=3, benchmark=Invocations} 100.97 ns; σ=0.94 ns @ 5 trials 40% Scenario{vm=java, trial=4, benchmark=Invocations} 97.20 ns; σ=0.36 ns @ 3 trials 50% Scenario{vm=java, trial=5, benchmark=Invocations} 99.53 ns; σ=0.76 ns @ 3 trials 60% Scenario{vm=java, trial=6, benchmark=Invocations} 96.04 ns; σ=0.28 ns @ 3 trials 70% Scenario{vm=java, trial=7, benchmark=Invocations} 98.39 ns; σ=1.01 ns @ 10 trials 80% Scenario{vm=java, trial=8, benchmark=Invocations} 95.87 ns; σ=1.98 ns @ 10 trials 90% Scenario{vm=java, trial=9, benchmark=Invocations} 98.56 ns; σ=0.23 ns @ 3 trials {noformat} This overhead seems the cost of switching the thread context classloader. > The context ClassLoader isn't set while calling into a coprocessor > ------------------------------------------------------------------ > > Key: HBASE-9941 > URL: https://issues.apache.org/jira/browse/HBASE-9941 > Project: HBase > Issue Type: Sub-task > Components: Coprocessors > Affects Versions: 0.96.0 > Reporter: Benoit Sigoure > Assignee: Andrew Purtell > Fix For: 0.98.0 > > Attachments: 9941.patch, 9941.patch > > > Whenever one of the methods of a coprocessor is invoked, the context > {{ClassLoader}} isn't set to be the {{CoprocessorClassLoader}}. It's only > set properly when calling the coprocessor's {{start}} method. This means > that if the coprocessor code attempts to load classes using the context > {{ClassLoader}}, it will fail to find the classes it's looking for. -- This message was sent by Atlassian JIRA (v6.1.5#6160)