Class MultiThreadedClientExample

java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.hbase.client.example.MultiThreadedClientExample
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.util.Tool

@Private public class MultiThreadedClientExample extends org.apache.hadoop.conf.Configured implements org.apache.hadoop.util.Tool
Example on how to use HBase's Connection and Table in a multi-threaded environment. Each table is a light weight object that is created and thrown away. Connections are heavy weight objects that hold on to zookeeper connections, async processes, and other state.
 Usage:
 bin/hbase org.apache.hadoop.hbase.client.example.MultiThreadedClientExample testTableName 500000
 

The table should already be created before running the command. This example expects one column family named d.

This is meant to show different operations that are likely to be done in a real world application. These operations are:

  • 30% of all operations performed are batch writes. 30 puts are created and sent out at a time. The response for all puts is waited on.
  • 20% of all operations are single writes. A single put is sent out and the response is waited for.
  • 50% of all operations are scans. These scans start at a random place and scan up to 100 rows.