commit dae0bc97203ffbe040bcf8ff5ed532617106dc02 Author: Michael Stack Date: Tue Dec 15 16:20:08 2015 -0800 test diff --git a/conf/hbase-env.sh b/conf/hbase-env.sh index 1885fa9..d1a8107 100644 --- a/conf/hbase-env.sh +++ b/conf/hbase-env.sh @@ -38,7 +38,7 @@ # Below are what we set by default. May only work with SUN JVM. # For more on why as well as other possible settings, # see http://wiki.apache.org/hadoop/PerformanceTuning -export HBASE_OPTS="-XX:+UseConcMarkSweepGC" +export HBASE_OPTS=" -XX:+PreserveFramePointer -XX:+UseConcMarkSweepGC" # Uncomment one of the below three options to enable java garbage collection logging for the server-side processes. diff --git a/conf/hbase-site.xml b/conf/hbase-site.xml index c516ac7..dc86aad 100644 --- a/conf/hbase-site.xml +++ b/conf/hbase-site.xml @@ -21,4 +21,10 @@ */ --> + +hbase.regionserver.info.port +-1 + +hbase.master.info.port +-1 diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java index 7283831..5326de4 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/util/PoolMap.java @@ -93,14 +93,6 @@ public class PoolMap implements Map { return null; } - /** - * @deprecated Will be removed for Java 8, use {@link #removeValue} instead - */ - @Deprecated - public boolean remove(K key, V value) { - return removeValue(key, value); - } - public boolean removeValue(K key, V value) { Pool pool = pools.get(key); boolean res = false; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/IncrementTest.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/IncrementTest.java new file mode 100644 index 0000000..851082f --- /dev/null +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/IncrementTest.java @@ -0,0 +1,90 @@ +package org.apache.hadoop.hbase; + +import com.yammer.metrics.Metrics; +import com.yammer.metrics.core.MetricName; +import com.yammer.metrics.core.Timer; +import com.yammer.metrics.core.TimerContext; +import com.yammer.metrics.stats.Snapshot; +import org.apache.hadoop.conf.Configuration; +// import org.apache.hadoop.hbase.client.ConnectionFactory; +import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.util.Bytes; +import org.junit.Test; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +public class IncrementTest { + + @Test + public void testIncrement() throws Exception { + final String ZOOKEEPER_QUORUM = "localhost:2181"; + final String TABLE_NAME = "t"; + final String FAMILY_NAME = "f"; + + final byte[] commonParent = Bytes.toBytes(1); + final byte[] commonFamily = Bytes.toBytes(FAMILY_NAME); + final byte[] commonColumn = Bytes.toBytes(1); + + final Configuration conf = new Configuration(); + conf.set("hbase.zookeeper.quorum", ZOOKEEPER_QUORUM); + + final MetricName name = new MetricName(this.getClass(), "increment"); + + ExecutorService service = Executors.newFixedThreadPool(80); + Set futures = new HashSet(); + + final AtomicInteger integer = new AtomicInteger(0); // needed a simple "final" counter + while (integer.incrementAndGet() <= 80) { + futures.add(service.submit(new Runnable() { + @Override + public void run() { + HTable table; + try { + table = new HTable(conf, TABLE_NAME); // ConnectionFactory.createConnection(conf).getTable(TableName.valueOf(TABLE_NAME)); + } catch (Exception e) { + throw new RuntimeException(e); + } + + byte[] threadCommonParent = Bytes.add(commonParent, Bytes.toBytes(integer.get())); + + Timer timer = Metrics.newTimer(name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS); + for (int i = 0; i < 50000; i++) { + /* + Try to ensure that the rows in question end up in the same region. + */ + byte[] row = Bytes.add(threadCommonParent, Bytes.toBytes(i)); + + TimerContext context = timer.time(); + try { + table.incrementColumnValue(row, commonFamily, commonColumn, 1l); + } catch (IOException e) { + // swallow..it's a test. + } finally { + context.stop(); + } + } + } + })); + } + + for(Future future : futures) { + future.get(); + } + + service.shutdown(); + + // finally, dump the metrics + Snapshot s = Metrics.newTimer(name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS).getSnapshot(); + System.out.println(String.format("75th: %s", s.get75thPercentile())); + System.out.println(String.format("95th: %s", s.get95thPercentile())); + System.out.println(String.format("98th: %s", s.get98thPercentile())); + System.out.println(String.format("99th: %s", s.get99thPercentile())); + } +} diff --git a/pom.xml b/pom.xml index 9d27a2b..b62e3b6 100644 --- a/pom.xml +++ b/pom.xml @@ -968,10 +968,10 @@ yyyy-MM-dd'T'HH:mm ${maven.build.timestamp} - 1.6 + 1.8 - 1.7 - 1.6 + 1.8 + 1.8 ${targetJavaVersion} ${cdh.hadoop.version}