Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changes

  • Loading branch information...
commit 83bbc1d4a74b7fac326eeec359bf84a8266c0882 1 parent 66fcefd
@srikanthps authored
Showing with 1,558 additions and 4 deletions.
  1. +18 −0 .classpath
  2. +17 −0 .project
  3. +12 −0 .settings/org.eclipse.jdt.core.prefs
  4. BIN  bin/com/srikanthps/HbaseBenchmarking$HTablePoolBasedRowCreator.class
  5. BIN  bin/com/srikanthps/HbaseBenchmarking$HTableWithNewHBaseConfiguration.class
  6. BIN  bin/com/srikanthps/HbaseBenchmarking$HTableWithReusedHBaseConfiguration.class
  7. BIN  bin/com/srikanthps/HbaseBenchmarking$RowCreator.class
  8. BIN  bin/com/srikanthps/HbaseBenchmarking.class
  9. BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$HTablePoolBasedRowCreator.class
  10. BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$HTableWithNewHBaseConfiguration.class
  11. BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$HTableWithReusedHBaseConfiguration.class
  12. BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$RowCreator.class
  13. BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop.class
  14. +37 −0 bin/log4j.properties
  15. BIN  common-jars/commons-beanutils-1.8.0.jar
  16. BIN  common-jars/commons-codec-1.3.jar
  17. BIN  common-jars/commons-collections-3.2.1.jar
  18. BIN  common-jars/commons-httpclient-3.0.1.jar
  19. BIN  common-jars/commons-io.jar
  20. BIN  common-jars/commons-lang-2.3.jar
  21. BIN  common-jars/commons-logging-1.1.1.jar
  22. BIN  common-jars/commons-math-2.2.jar
  23. BIN  common-jars/log4j-1.2.16.jar
  24. BIN  hbase-0.20.6-jars/hadoop-0.20.1-hdfs127-core.jar
  25. BIN  hbase-0.20.6-jars/hbase-0.20.3-1.cloudera.jar
  26. BIN  hbase-0.20.6-jars/zookeeper-3.2.2.jar
  27. BIN  hbase-0.90.1-jars/hadoop-core-0.20.2-cdh3u0.jar
  28. BIN  hbase-0.90.1-jars/hbase-0.90.1-cdh3u0.jar
  29. BIN  hbase-0.90.1-jars/zookeeper-3.3.3-cdh3u0.jar
  30. +983 −0 report.html
  31. +4 −4 src/com/srikanthps/HbaseBenchmarking.java
  32. +487 −0 src/com/srikanthps/HbaseBenchmarkingWithHadoop.java
View
18 .classpath
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="lib" path="common-jars/commons-beanutils-1.8.0.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-codec-1.3.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-collections-3.2.1.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-httpclient-3.0.1.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-io.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-lang-2.3.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-logging-1.1.1.jar"/>
+ <classpathentry kind="lib" path="common-jars/commons-math-2.2.jar"/>
+ <classpathentry kind="lib" path="common-jars/log4j-1.2.16.jar"/>
+ <classpathentry kind="lib" path="hbase-0.90.1-jars/hadoop-core-0.20.2-cdh3u0.jar"/>
+ <classpathentry kind="lib" path="hbase-0.90.1-jars/hbase-0.90.1-cdh3u0.jar"/>
+ <classpathentry kind="lib" path="hbase-0.90.1-jars/zookeeper-3.3.3-cdh3u0.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>hbase-benchmarker</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
12 .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Sun Jun 26 20:11:54 IST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
View
BIN  bin/com/srikanthps/HbaseBenchmarking$HTablePoolBasedRowCreator.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarking$HTableWithNewHBaseConfiguration.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarking$HTableWithReusedHBaseConfiguration.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarking$RowCreator.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarking.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$HTablePoolBasedRowCreator.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$HTableWithNewHBaseConfiguration.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$HTableWithReusedHBaseConfiguration.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop$RowCreator.class
Binary file not shown
View
BIN  bin/com/srikanthps/HbaseBenchmarkingWithHadoop.class
Binary file not shown
View
37 bin/log4j.properties
@@ -0,0 +1,37 @@
+##################################################################################
+#
+# This is the logging configuration file for LOG4J for UID Server Platform
+#
+##################################################################################
+
+# Set root logger level followed by log appenders
+log4j.rootLogger=ERROR, stdout
+
+##################################################################################
+# Pattern information
+#
+# For full pattern information visit:
+# http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html
+#
+# The following variables can be used in a layout if PatternLayout is used:
+# %c - category
+# %C - Class name
+# %d - date
+# %l - location information
+# %L - Line number of caller
+# %m - application message
+# %M - method name of caller
+# %n - platform dependent line seperator character
+# %p - priority
+# %r - number of milliseconds slapsed time since start
+# %t - thread name
+# %x - NDC (nested diagnostic context) associated with the thread
+#
+##################################################################################
+
+# BEGIN APPENDER: CONSOLE APPENDER (stdout)
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] %p [%c{3}] %x - %m%n
+# END APPENDER: CONSOLE APPENDER (stdout)
+
View
BIN  common-jars/commons-beanutils-1.8.0.jar
Binary file not shown
View
BIN  common-jars/commons-codec-1.3.jar
Binary file not shown
View
BIN  common-jars/commons-collections-3.2.1.jar
Binary file not shown
View
BIN  common-jars/commons-httpclient-3.0.1.jar
Binary file not shown
View
BIN  common-jars/commons-io.jar
Binary file not shown
View
BIN  common-jars/commons-lang-2.3.jar
Binary file not shown
View
BIN  common-jars/commons-logging-1.1.1.jar
Binary file not shown
View
BIN  common-jars/commons-math-2.2.jar
Binary file not shown
View
BIN  common-jars/log4j-1.2.16.jar
Binary file not shown
View
BIN  hbase-0.20.6-jars/hadoop-0.20.1-hdfs127-core.jar
Binary file not shown
View
BIN  hbase-0.20.6-jars/hbase-0.20.3-1.cloudera.jar
Binary file not shown
View
BIN  hbase-0.20.6-jars/zookeeper-3.2.2.jar
Binary file not shown
View
BIN  hbase-0.90.1-jars/hadoop-core-0.20.2-cdh3u0.jar
Binary file not shown
View
BIN  hbase-0.90.1-jars/hbase-0.90.1-cdh3u0.jar
Binary file not shown
View
BIN  hbase-0.90.1-jars/zookeeper-3.3.3-cdh3u0.jar
Binary file not shown
View
983 report.html
@@ -0,0 +1,983 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+
+
+<style type="text/css">
+td {
+ border: 1px solid #E6E6E6;
+ padding: 2px;
+ margin: 0px;
+}
+
+.scenario1 {
+ background-color: #E0F2F7
+}
+
+.scenario2 {
+ background-color: #F8E0F1
+}
+
+.scenario3 {
+ background-color: #F2F5A9
+}
+</style>
+<table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <td colspan="9"><strong><span style="color: blue;">HBase&nbsp;0.20.6
+ Standalone mode</span></strong> &nbsp;(all figures in milliseconds)</td>
+ </tr>
+ <tr style="background-color: silver;">
+ <td>Scenario</td>
+ <td>Num Threads</td>
+ <td>Puts</td>
+ <td>Mean</td>
+ <td>Standard Deviation</td>
+ <td>Max</td>
+ <td>Min&nbsp;&nbsp;&nbsp;&nbsp;</td>
+ <td>80th Percentile</td>
+ <td>90th Percentile</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>100</td>
+ <td>4.86</td>
+ <td>1.49</td>
+ <td>12.00</td>
+ <td>3.00</td>
+ <td>5.00</td>
+ <td>6.90</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>100</td>
+ <td>4.52</td>
+ <td>1.12</td>
+ <td>9.00</td>
+ <td>3.00</td>
+ <td>5.00</td>
+ <td>6.90</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>100</td>
+ <td>4.15</td>
+ <td>0.88</td>
+ <td>8.00</td>
+ <td>3.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>4.19</td>
+ <td>3.60</td>
+ <td>108.00</td>
+ <td>3.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>4.02</td>
+ <td>1.79</td>
+ <td>47.00</td>
+ <td>3.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>3.84</td>
+ <td>3.57</td>
+ <td>108.00</td>
+ <td>3.00</td>
+ <td>4.00</td>
+ <td>4.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>3.95</td>
+ <td>4.13</td>
+ <td>211.00</td>
+ <td>2.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>4.28</td>
+ <td>10.02</td>
+ <td>571.00</td>
+ <td>2.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>3.80</td>
+ <td>5.46</td>
+ <td>244.00</td>
+ <td>2.00</td>
+ <td>4.00</td>
+ <td>4.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>100</td>
+ <td>24.59</td>
+ <td>22.73</td>
+ <td>204.00</td>
+ <td>4.00</td>
+ <td>38.60</td>
+ <td>44.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>100</td>
+ <td>20.48</td>
+ <td>28.05</td>
+ <td>233.00</td>
+ <td>5.00</td>
+ <td>22.00</td>
+ <td>36.80</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>100</td>
+ <td>21.44</td>
+ <td>28.05</td>
+ <td>241.00</td>
+ <td>5.00</td>
+ <td>26.80</td>
+ <td>50.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>26.10</td>
+ <td>21.94</td>
+ <td>246.00</td>
+ <td>5.00</td>
+ <td>40.00</td>
+ <td>49.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>23.80</td>
+ <td>25.31</td>
+ <td>238.00</td>
+ <td>3.00</td>
+ <td>35.80</td>
+ <td>44.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>22.55</td>
+ <td>21.96</td>
+ <td>209.00</td>
+ <td>4.00</td>
+ <td>35.00</td>
+ <td>44.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>22.06</td>
+ <td>18.81</td>
+ <td>279.00</td>
+ <td>3.00</td>
+ <td>36.00</td>
+ <td>43.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>22.67</td>
+ <td>18.44</td>
+ <td>287.00</td>
+ <td>3.00</td>
+ <td>37.00</td>
+ <td>45.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>24.43</td>
+ <td>26.67</td>
+ <td>507.00</td>
+ <td>3.00</td>
+ <td>38.00</td>
+ <td>46.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>100</td>
+ <td>106.45</td>
+ <td>68.53</td>
+ <td>422.00</td>
+ <td>5.00</td>
+ <td>164.60</td>
+ <td>199.40</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>100</td>
+ <td>102.81</td>
+ <td>68.45</td>
+ <td>421.00</td>
+ <td>4.00</td>
+ <td>167.80</td>
+ <td>194.60</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>100</td>
+ <td>25.73</td>
+ <td>20.58</td>
+ <td>209.00</td>
+ <td>4.00</td>
+ <td>29.80</td>
+ <td>35.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>195.38</td>
+ <td>189.46</td>
+ <td>696.00</td>
+ <td>3.00</td>
+ <td>375.80</td>
+ <td>488.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>189.86</td>
+ <td>193.69</td>
+ <td>688.00</td>
+ <td>3.00</td>
+ <td>384.00</td>
+ <td>492.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>79.80</td>
+ <td>110.55</td>
+ <td>525.00</td>
+ <td>4.00</td>
+ <td>151.00</td>
+ <td>252.80</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>219.65</td>
+ <td>214.10</td>
+ <td>1277.00</td>
+ <td>3.00</td>
+ <td>433.00</td>
+ <td>543.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>277.60</td>
+ <td>473.36</td>
+ <td>4129.00</td>
+ <td>3.00</td>
+ <td>453.80</td>
+ <td>609.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>214.80</td>
+ <td>230.87</td>
+ <td>1386.00</td>
+ <td>3.00</td>
+ <td>435.00</td>
+ <td>566.00</td>
+ </tr>
+ </tbody>
+</table>
+
+
+<table>
+ <tr>
+ <td colspan="9"><strong><span style="color: blue;">HBase&nbsp;0.20.6&nbsp;Distribute
+ Mode&nbsp;with 3 Region Servers (Hadoop 0.20)</span></strong>&nbsp;(all figures in
+ milliseconds)</td>
+ </tr>
+ <tr style="background-color: silver;">
+ <td>Scenario</td>
+ <td>Num Threads</td>
+ <td>Puts</td>
+ <td>Mean</td>
+ <td>Standard Deviation</td>
+ <td>Max</td>
+ <td>Min&nbsp;&nbsp;&nbsp;&nbsp;</td>
+ <td>80th Percentile</td>
+ <td>90th Percentile</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>100</td>
+ <td>3.25</td>
+ <td>1.96</td>
+ <td>18.00</td>
+ <td>2.00</td>
+ <td>3.00</td>
+ <td>3.90</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>100</td>
+ <td>2.98</td>
+ <td>1.18</td>
+ <td>9.00</td>
+ <td>2.00</td>
+ <td>3.00</td>
+ <td>4.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>100</td>
+ <td>2.91</td>
+ <td>1.43</td>
+ <td>10.00</td>
+ <td>1.00</td>
+ <td>3.00</td>
+ <td>4.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>4.56</td>
+ <td>3.77</td>
+ <td>40.00</td>
+ <td>1.00</td>
+ <td>6.00</td>
+ <td>11.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>4.98</td>
+ <td>4.04</td>
+ <td>20.00</td>
+ <td>1.00</td>
+ <td>11.00</td>
+ <td>11.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>2.28</td>
+ <td>1.20</td>
+ <td>9.00</td>
+ <td>1.00</td>
+ <td>3.00</td>
+ <td>3.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>2.48</td>
+ <td>1.76</td>
+ <td>41.00</td>
+ <td>1.00</td>
+ <td>3.00</td>
+ <td>3.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>2.43</td>
+ <td>1.78</td>
+ <td>49.00</td>
+ <td>1.00</td>
+ <td>3.00</td>
+ <td>3.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>2.84</td>
+ <td>2.79</td>
+ <td>52.00</td>
+ <td>1.00</td>
+ <td>3.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>100</td>
+ <td>15.88</td>
+ <td>21.62</td>
+ <td>204.00</td>
+ <td>2.00</td>
+ <td>23.80</td>
+ <td>32.90</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>100</td>
+ <td>13.09</td>
+ <td>20.50</td>
+ <td>204.00</td>
+ <td>2.00</td>
+ <td>18.00</td>
+ <td>20.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>100</td>
+ <td>8.78</td>
+ <td>19.64</td>
+ <td>197.00</td>
+ <td>2.00</td>
+ <td>8.80</td>
+ <td>13.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>12.36</td>
+ <td>10.76</td>
+ <td>203.00</td>
+ <td>2.00</td>
+ <td>19.00</td>
+ <td>22.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>12.39</td>
+ <td>11.49</td>
+ <td>202.00</td>
+ <td>2.00</td>
+ <td>20.00</td>
+ <td>26.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>9.13</td>
+ <td>10.79</td>
+ <td>204.00</td>
+ <td>1.00</td>
+ <td>14.00</td>
+ <td>17.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>32.41</td>
+ <td>59.62</td>
+ <td>1785.00</td>
+ <td>1.00</td>
+ <td>50.00</td>
+ <td>80.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>37.87</td>
+ <td>143.47</td>
+ <td>4911.00</td>
+ <td>2.00</td>
+ <td>51.00</td>
+ <td>84.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>12.93</td>
+ <td>11.26</td>
+ <td>212.00</td>
+ <td>2.00</td>
+ <td>20.00</td>
+ <td>24.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>100</td>
+ <td>296.71</td>
+ <td>132.66</td>
+ <td>710.00</td>
+ <td>47.00</td>
+ <td>404.80</td>
+ <td>467.50</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>100</td>
+ <td>263.60</td>
+ <td>135.97</td>
+ <td>738.00</td>
+ <td>16.00</td>
+ <td>389.40</td>
+ <td>411.80</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>100</td>
+ <td>7.11</td>
+ <td>8.33</td>
+ <td>48.00</td>
+ <td>2.00</td>
+ <td>10.00</td>
+ <td>12.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>108.58</td>
+ <td>105.80</td>
+ <td>419.00</td>
+ <td>2.00</td>
+ <td>215.00</td>
+ <td>268.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>107.31</td>
+ <td>105.14</td>
+ <td>362.00</td>
+ <td>2.00</td>
+ <td>218.00</td>
+ <td>267.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>10.24</td>
+ <td>13.45</td>
+ <td>203.00</td>
+ <td>1.00</td>
+ <td>11.00</td>
+ <td>20.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>149.96</td>
+ <td>197.28</td>
+ <td>1527.00</td>
+ <td>1.00</td>
+ <td>267.00</td>
+ <td>333.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>134.47</td>
+ <td>144.55</td>
+ <td>646.00</td>
+ <td>2.00</td>
+ <td>276.00</td>
+ <td>358.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>247.84</td>
+ <td>692.83</td>
+ <td>11043.00</td>
+ <td>1.00</td>
+ <td>370.00</td>
+ <td>668.00</td>
+ </tr>
+</table>
+
+
+<table>
+ <tr>
+ <td colspan="9"><strong><span style="color: blue;">HBase&nbsp;0.20.6&nbsp;Distribute
+ Mode&nbsp;with 3 Region Servers (Hadoop 0.20)</span></strong>&nbsp;(all figures in
+ milliseconds)</td>
+ </tr>
+ <tr style="background-color: silver;">
+ <td>Scenario</td>
+ <td>Num Threads</td>
+ <td>Puts</td>
+ <td>Mean</td>
+ <td>Stdev</td>
+ <td>Max</td>
+ <td>Min</td>
+ <td>80 Pctl</td>
+ <td>90 Pctl</td>
+ <td></td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>100</td>
+ <td>6.54</td>
+ <td>4.24</td>
+ <td>38.00</td>
+ <td>4.00</td>
+ <td>7.00</td>
+ <td>8.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>100</td>
+ <td>5.77</td>
+ <td>1.34</td>
+ <td>10.00</td>
+ <td>4.00</td>
+ <td>7.00</td>
+ <td>8.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>100</td>
+ <td>5.23</td>
+ <td>1.33</td>
+ <td>12.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ <td>6.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>5.50</td>
+ <td>1.62</td>
+ <td>26.00</td>
+ <td>4.00</td>
+ <td>6.00</td>
+ <td>7.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>4.95</td>
+ <td>1.35</td>
+ <td>22.00</td>
+ <td>3.00</td>
+ <td>6.00</td>
+ <td>6.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>1000</td>
+ <td>4.94</td>
+ <td>1.31</td>
+ <td>16.00</td>
+ <td>3.00</td>
+ <td>6.00</td>
+ <td>6.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>4.84</td>
+ <td>2.57</td>
+ <td>92.00</td>
+ <td>3.00</td>
+ <td>5.00</td>
+ <td>6.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>4.59</td>
+ <td>4.88</td>
+ <td>229.00</td>
+ <td>3.00</td>
+ <td>5.00</td>
+ <td>6.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>1</td>
+ <td>10000</td>
+ <td>4.30</td>
+ <td>4.72</td>
+ <td>231.00</td>
+ <td>3.00</td>
+ <td>4.00</td>
+ <td>5.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>100</td>
+ <td>26.44</td>
+ <td>27.85</td>
+ <td>205.00</td>
+ <td>4.00</td>
+ <td>34.80</td>
+ <td>39.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>100</td>
+ <td>27.50</td>
+ <td>28.68</td>
+ <td>214.00</td>
+ <td>7.00</td>
+ <td>35.00</td>
+ <td>40.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>100</td>
+ <td>31.55</td>
+ <td>31.22</td>
+ <td>205.00</td>
+ <td>4.00</td>
+ <td>37.00</td>
+ <td>70.40</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>25.80</td>
+ <td>14.84</td>
+ <td>204.00</td>
+ <td>3.00</td>
+ <td>36.00</td>
+ <td>41.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>26.15</td>
+ <td>15.21</td>
+ <td>212.00</td>
+ <td>3.00</td>
+ <td>37.00</td>
+ <td>41.90</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>1000</td>
+ <td>25.72</td>
+ <td>14.31</td>
+ <td>199.00</td>
+ <td>3.00</td>
+ <td>37.00</td>
+ <td>43.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>26.12</td>
+ <td>16.09</td>
+ <td>280.00</td>
+ <td>3.00</td>
+ <td>36.00</td>
+ <td>41.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>27.45</td>
+ <td>16.93</td>
+ <td>274.00</td>
+ <td>3.00</td>
+ <td>38.00</td>
+ <td>43.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>10</td>
+ <td>10000</td>
+ <td>25.57</td>
+ <td>13.90</td>
+ <td>263.00</td>
+ <td>3.00</td>
+ <td>36.00</td>
+ <td>40.00</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>100</td>
+ <td>22.55</td>
+ <td>17.28</td>
+ <td>50.00</td>
+ <td>5.00</td>
+ <td>44.80</td>
+ <td>46.90</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>100</td>
+ <td>132.36</td>
+ <td>77.87</td>
+ <td>481.00</td>
+ <td>18.00</td>
+ <td>197.80</td>
+ <td>241.30</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>100</td>
+ <td>29.23</td>
+ <td>22.76</td>
+ <td>97.00</td>
+ <td>4.00</td>
+ <td>52.60</td>
+ <td>59.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>175.42</td>
+ <td>272.73</td>
+ <td>2987.00</td>
+ <td>3.00</td>
+ <td>307.60</td>
+ <td>356.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>19.54</td>
+ <td>47.49</td>
+ <td>248.00</td>
+ <td>3.00</td>
+ <td>9.00</td>
+ <td>11.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>1000</td>
+ <td>52.58</td>
+ <td>69.17</td>
+ <td>383.00</td>
+ <td>4.00</td>
+ <td>79.80</td>
+ <td>150.90</td>
+ </tr>
+ <tr class="scenario1">
+ <td>HTable from HTablePool (pool size: 100)</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>173.08</td>
+ <td>1294.93</td>
+ <td>24606.00</td>
+ <td>4.00</td>
+ <td>117.00</td>
+ <td>148.00</td>
+ </tr>
+ <tr class="scenario2">
+ <td>HTable with same configuration instance</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>57.95</td>
+ <td>43.75</td>
+ <td>414.00</td>
+ <td>4.00</td>
+ <td>93.00</td>
+ <td>113.00</td>
+ </tr>
+ <tr class="scenario3">
+ <td>HTable with new Hbase configuration instance</td>
+ <td>100</td>
+ <td>10000</td>
+ <td>180.96</td>
+ <td>163.70</td>
+ <td>937.00</td>
+ <td>4.00</td>
+ <td>334.00</td>
+ <td>424.00</td>
+ </tr>
+</table>
+
+
+</body>
+</html>
View
8 src/com/srikanthps/HbaseBenchmarking.java
@@ -44,8 +44,8 @@ public static void main(String[] args) throws InterruptedException, Instantiatio
long startingRowKey = 600000000000L;
- System.out.println(StringUtils.rightPad("Scenario,", 50) + StringUtils.leftPad("Num Threads", LABEL_RIGHT_PAD)
- + StringUtils.leftPad("Puts", LABEL_RIGHT_PAD) + StringUtils.leftPad("Mean,", LABEL_RIGHT_PAD)
+ System.out.println(StringUtils.rightPad("Scenario,", 50) + StringUtils.leftPad("Num Threads,", LABEL_RIGHT_PAD)
+ + StringUtils.leftPad("Puts,", LABEL_RIGHT_PAD) + StringUtils.leftPad("Mean,", LABEL_RIGHT_PAD)
+ StringUtils.leftPad("Stdev,", LABEL_RIGHT_PAD) + StringUtils.leftPad("Max,", LABEL_RIGHT_PAD)
+ StringUtils.leftPad("Min,", LABEL_RIGHT_PAD) + StringUtils.leftPad("80 Pctl,", LABEL_RIGHT_PAD)
+ StringUtils.leftPad("90 Pctl,", LABEL_RIGHT_PAD));
@@ -75,8 +75,8 @@ public static void main(String[] args) throws InterruptedException, Instantiatio
runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 1000, 10, DATA);
System.out.println();
- runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 10000, 10, DATA);
runTest(HTablePoolBasedRowCreator.class, startingRowKey, 10000, 10, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 10000, 10, DATA);
runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 10000, 10, DATA);
System.out.println();
@@ -213,7 +213,7 @@ public HTablePoolBasedRowCreator() {
}
public HTable getHTable(String tableName) {
- return hTablePool.getTable(tableName);
+ return (HTable)hTablePool.getTable(tableName);
}
public void returnHTable(HTable table) {
View
487 src/com/srikanthps/HbaseBenchmarkingWithHadoop.java
@@ -0,0 +1,487 @@
+package com.srikanthps;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.math.stat.descriptive.SynchronizedDescriptiveStatistics;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.HTablePool;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.util.Bytes;
+
+/**
+ * A simple HBase Benchmarking tool
+ *
+ * @author Srikanth P Shreenivas (srikanthps@yahoo.com)
+ *
+ * It has been tested on standalone HBase 0.20.6.
+ *
+ * You need to have table, testtable, in your HBase. Create it in HBase
+ * shell using the command: create "testtable", "data"
+ */
+public class HbaseBenchmarkingWithHadoop {
+
+ private static final int LABEL_RIGHT_PAD = 12;
+ private static final int VALUE_LEFT_PAD = 11;
+
+ public static SynchronizedDescriptiveStatistics timingStats = new SynchronizedDescriptiveStatistics();
+
+ private static HBaseConfiguration hbaseConfiguration;
+ static {
+ hbaseConfiguration = new HBaseConfiguration();
+ hbaseConfiguration.set("hbase.rootdir", "hdfs://uid25.mindtree.com:9000/hbase");
+ hbaseConfiguration.set("hbase.master.port", "60000");
+ hbaseConfiguration.set("hbase.zookeeper.quorum", "10.12.11.129,10.12.11.133");
+ hbaseConfiguration.set("hbase.client.write.buffer", "2097152");
+ }
+
+ public static void main(String[] args) throws InterruptedException, InstantiationException, IllegalAccessException {
+
+ System.out.println("Simple HBase benchmarking application");
+
+ long startingRowKey = 800000000000L;
+
+ System.out.println(StringUtils.rightPad("Scenario,", 50) + StringUtils.leftPad("Num Threads", LABEL_RIGHT_PAD)
+ + StringUtils.leftPad("Puts", LABEL_RIGHT_PAD) + StringUtils.leftPad("Mean,", LABEL_RIGHT_PAD)
+ + StringUtils.leftPad("Stdev,", LABEL_RIGHT_PAD) + StringUtils.leftPad("Max,", LABEL_RIGHT_PAD)
+ + StringUtils.leftPad("Min,", LABEL_RIGHT_PAD) + StringUtils.leftPad("80 Pctl,", LABEL_RIGHT_PAD)
+ + StringUtils.leftPad("90 Pctl,", LABEL_RIGHT_PAD));
+
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 100, 1, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 100, 1, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 100, 1, DATA);
+ System.out.println();
+/*
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 1000, 1, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 1000, 1, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 1000, 1, DATA);
+ System.out.println();
+
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 10000, 1, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 10000, 1, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 10000, 1, DATA);
+ System.out.println();
+
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 100, 10, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 100, 10, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 100, 10, DATA);
+ System.out.println();
+
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 1000, 10, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 1000, 10, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 1000, 10, DATA);
+ System.out.println();
+
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 10000, 10, DATA);
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 10000, 10, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 10000, 10, DATA);
+ System.out.println();
+
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 100, 100, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 100, 100, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 100, 100, DATA);
+ System.out.println();
+
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 1000, 100, DATA);
+ runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 1000, 100, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 1000, 100, DATA);
+ System.out.println();
+*/
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 50000, 200, DATA);
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 50000, 200, DATA);
+ runTest(HTablePoolBasedRowCreator.class, startingRowKey, 50000, 200, DATA);
+/* runTest(HTableWithReusedHBaseConfiguration.class, startingRowKey, 10000, 100, DATA);
+ runTest(HTableWithNewHBaseConfiguration.class, startingRowKey, 10000, 100, DATA);
+*/ System.out.println();
+
+ }
+
+ private static void runTest(Class rowCreatorClass, long startingRowKey, int numRecordsToInsert, long numThreadsToUse, String data)
+ throws InterruptedException, InstantiationException, IllegalAccessException {
+
+ timingStats.clear();
+
+ int numRecordsPerThread = (int) Math.ceil(((double) numRecordsToInsert) / numThreadsToUse);
+
+ List<Thread> threads = new ArrayList<Thread>();
+ for (int i = 0; i < numThreadsToUse; i++) {
+ RowCreator c = (RowCreator) rowCreatorClass.newInstance();
+ c.setData(data);
+ c.setNextRowkey(startingRowKey);
+ c.setNumRecordsToInsert(numRecordsPerThread);
+
+ Thread t = new Thread(c);
+ threads.add(t);
+ t.start();
+ }
+
+ for (int i = 0; i < numThreadsToUse; i++) {
+ threads.get(i).join();
+ }
+
+ System.out.println(StringUtils.rightPad(rowCreatorClass.newInstance().toString(), 50) + ","
+ + format(numThreadsToUse, VALUE_LEFT_PAD) + "," + format(timingStats.getN(), VALUE_LEFT_PAD) + ","
+ + format(timingStats.getMean(), VALUE_LEFT_PAD) + "," + format(timingStats.getStandardDeviation(), VALUE_LEFT_PAD) + ","
+ + format(timingStats.getMax(), VALUE_LEFT_PAD) + "," + format(timingStats.getMin(), VALUE_LEFT_PAD) + ","
+ + format(timingStats.getPercentile(80.0), VALUE_LEFT_PAD) + "," + format(timingStats.getPercentile(90.0), VALUE_LEFT_PAD));
+ }
+
+ private static String format(Long d, int pad) {
+ return StringUtils.leftPad(String.format("%10d", d), pad);
+ }
+
+ private static String format(Double d, int pad) {
+ return StringUtils.leftPad(String.format("%.2f", d), pad);
+ }
+
+ public static abstract class RowCreator implements Runnable {
+
+ int numRecordsToInsert;
+ String data;
+ long nextRowkey;
+
+ public RowCreator() {
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public void setNextRowkey(long nextRowkey) {
+ this.nextRowkey = nextRowkey;
+ }
+
+ public void setNumRecordsToInsert(int numRecordsToInsert) {
+ this.numRecordsToInsert = numRecordsToInsert;
+ }
+
+ @Override
+ public void run() {
+ createRows();
+ }
+
+ private void createRows() {
+ HTable table = null;
+ try {
+ table = getHTable("testtable");
+
+ for (int i = 0; i < numRecordsToInsert; i++) {
+
+ long before = System.currentTimeMillis();
+ putRecord(table);
+ long after = System.currentTimeMillis();
+
+ long timeForThisEntry = after - before;
+
+ timingStats.addValue(Double.valueOf(timeForThisEntry));
+ }
+
+ } catch (Exception e) {
+ System.out.println("Exception during operation" + e);
+ e.printStackTrace();
+ } finally {
+ returnHTable(table);
+ }
+ }
+
+ protected abstract HTable getHTable(String tableName);
+
+ protected abstract void returnHTable(HTable table);
+
+ private void putRecord(HTable table) throws IOException {
+ Put p = new Put(Bytes.toBytes(String.valueOf(nextRowkey++)));
+ p.add("data".getBytes(), "col1".getBytes(), data.getBytes());
+ table.put(p);
+ }
+
+ }
+
+ public static class HTablePoolBasedRowCreator extends RowCreator {
+
+ private final static int poolsize = 100;
+ private static HTablePool hTablePool = new HTablePool(hbaseConfiguration, poolsize);
+
+ public void uninitialize() {
+ if (hTablePool != null) {
+ hTablePool = null;
+ }
+ }
+
+ public HTablePoolBasedRowCreator() {
+ super();
+ }
+
+ public HTable getHTable(String tableName) {
+ return (HTable)hTablePool.getTable(tableName);
+ }
+
+ public void returnHTable(HTable table) {
+ if (table != null) {
+ hTablePool.putTable(table);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "HTable from HTablePool (pool size: " + poolsize + ")";
+ }
+
+ }
+
+ public static class HTableWithReusedHBaseConfiguration extends RowCreator {
+
+ public HTable getHTable(String tableName) {
+ try {
+ return new HTable(hbaseConfiguration, tableName);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void returnHTable(HTable table) {
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "HTable with same configuration instance";
+ }
+ }
+
+ public static class HTableWithNewHBaseConfiguration extends RowCreator {
+
+ public HTable getHTable(String tableName) {
+ try {
+ return new HTable(new HBaseConfiguration(hbaseConfiguration), tableName);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void returnHTable(HTable table) {
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "HTable with new Hbase configuration instance";
+ }
+ }
+
+ //private static final String DATA = "a very small data....";
+
+ private static final String DATA = "A huge string : Licensed to the Apache Software Foundation (ASF) under one " +
+ "or more contributor license agreements. See the NOTICE file distributed with this" +
+ " work for additional information regarding copyright ownership. The ASF licenses " +
+ "this file to you under the Apache License, Version 2.0 (the \"License\"); you may" +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ "licenses this file to you under the Apache License, Version Licensed to the Apache " +
+ "Software Foundation (ASF) under one or more contributor license agreements. See the " +
+ "NOTICE file distributed with this work for additional information regarding copyright" +
+ " ownership. The ASF licenses this file to you under the Apache License, Version 2.0 " +
+ "or more contributor license agreements. See the NOTICE file distributed with this" +
+ " work for additional information regarding copyright ownership. The ASF licenses " +
+ "this file to you under the Apache License, Version 2.0 (the \"License\"); you may" +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ "licenses this file to you under the Apache License, Version Licensed to the Apache " +
+ "Software Foundation (ASF) under one or more contributor license agreements. See the " +
+ "NOTICE file distributed with this work for additional information regarding copyright" +
+ " ownership. The ASF licenses this file to you under the Apache License, Version 2.0 " +
+ "or more contributor license agreements. See the NOTICE file distributed with this" +
+ " work for additional information regarding copyright ownership. The ASF licenses " +
+ "this file to you under the Apache License, Version 2.0 (the \"License\"); you may" +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ "licenses this file to you under the Apache License, Version Licensed to the Apache " +
+ "Software Foundation (ASF) under one or more contributor license agreements. See the " +
+ "NOTICE file distributed with this work for additional information regarding copyright" +
+ " ownership. The ASF licenses this file to you under the Apache License, Version 2.0 " +
+ "(the \"License\"); you may not use this file except in compliance with the License.";
+
+
+
+ /*private static final String DATA = "A huge string : Licensed to the Apache Software Foundation (ASF) under one " +
+ "or more contributor license agreements. See the NOTICE file distributed with this" +
+ " work for additional information regarding copyright ownership. The ASF licenses " +
+ "this file to you under the Apache License, Version 2.0 (the \"License\"); you may" +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ " not use this file except in compliance with the License. You may obtain a copy of " +
+ "the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable" +
+ " law or agreed to in writing, software distributed under the License is distributed " +
+ "on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express " +
+ "or implied. See the License for the specific language governing permissions and " +
+ "limitations under the License. Licensed to the Apache Software Foundation (ASF) " +
+ "under one or more contributor license agreements. See the NOTICE file distributed" +
+ " with this work for additional information regarding copyright ownership. The ASF " +
+ "licenses this file to you under the Apache License, Version Licensed to the Apache " +
+ "Software Foundation (ASF) under one or more contributor license agreements. See the " +
+ "NOTICE file distributed with this work for additional information regarding copyright" +
+ " ownership. The ASF licenses this file to you under the Apache License, Version 2.0 " +
+ "(the \"License\"); you may not use this file except in compliance with the License.";*/
+
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.