Which release of hbase are you using ? Does it include HBASE-15213 ?
Thanks On Sat, Jul 9, 2016 at 3:14 AM, 陆巍 <luwei...@163.com> wrote: > Hi, > > I had a test for Increment operation, and find the performance is really > bad: 94809ms for 1000 increment operaions. > The testing cluster is pretty small with only three region servers. > > Below is the code for testing. Is there any bentchmark result for htable > increment? Thanks! > > import java.io.IOException; > import java.util.Random; > > import org.apache.hadoop.conf.Configuration; > import org.apache.hadoop.hbase.HBaseConfiguration; > import org.apache.hadoop.hbase.TableName; > import org.apache.hadoop.hbase.client.Connection; > import org.apache.hadoop.hbase.client.ConnectionFactory; > import org.apache.hadoop.hbase.client.Increment; > import org.apache.hadoop.hbase.client.Table; > import org.apache.hadoop.hbase.util.Bytes; > > class HBaseTableFactory { > private Configuration config = HBaseConfiguration.create(); > private Connection connection = null; > > public Table createTable(String tableName) throws IOException { > if (connection == null) { > connection = ConnectionFactory.createConnection(config); > } > return create(tableName, config); > } > > protected Table create(String tableName, Configuration config) > throws IOException { > return connection.getTable(TableName.valueOf(tableName)); > } > > } > > public class TestBytes { > public static void main(String[] args) throws IOException { > long t1 = System.currentTimeMillis(); > Table table = new HBaseTableFactory().createTable("xyz"); > for (int i = 0; i < 1000; i++) { > > byte[] row = Bytes.toBytes("row-" + i); > Increment p = new Increment(row); > byte[] f = Bytes.toBytes("cf1"); > byte[] q = Bytes.toBytes("q1"); > long v = 1L; > p.addColumn(f, q, v); > table.increment(p); > System.out.println(i); > } > table.close(); > System.out.println(System.currentTimeMillis() - t1); > } > } > >