chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r1039604 - in /incubator/chukwa/trunk: bin/VERSION src/java/org/apache/hadoop/chukwa/datacollection/writer/hbase/OutputCollector.java
Date Sat, 27 Nov 2010 02:55:36 GMT
Author: eyang
Date: Sat Nov 27 02:55:36 2010
New Revision: 1039604

URL: http://svn.apache.org/viewvc?rev=1039604&view=rev
Log:
CHUKWA-560. Improve HBaseWriter performance.  (Jerome Boulon via Eric Yang)

Modified:
    incubator/chukwa/trunk/bin/VERSION
    incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/hbase/OutputCollector.java

Modified: incubator/chukwa/trunk/bin/VERSION
URL: http://svn.apache.org/viewvc/incubator/chukwa/trunk/bin/VERSION?rev=1039604&r1=1039603&r2=1039604&view=diff
==============================================================================
--- incubator/chukwa/trunk/bin/VERSION (original)
+++ incubator/chukwa/trunk/bin/VERSION Sat Nov 27 02:55:36 2010
@@ -1 +1 @@
-0.4.0
+0.5.0

Modified: incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/hbase/OutputCollector.java
URL: http://svn.apache.org/viewvc/incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/hbase/OutputCollector.java?rev=1039604&r1=1039603&r2=1039604&view=diff
==============================================================================
--- incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/hbase/OutputCollector.java
(original)
+++ incubator/chukwa/trunk/src/java/org/apache/hadoop/chukwa/datacollection/writer/hbase/OutputCollector.java
Sat Nov 27 02:55:36 2010
@@ -34,6 +34,10 @@ public class OutputCollector implements
     org.apache.hadoop.mapred.OutputCollector<ChukwaRecordKey, ChukwaRecord> {
   
   private List<Put> buffers;
+  private StringBuffer s = new StringBuffer();
+  private byte[] rowKey = null;
+  private byte[] cf = null;
+  private long now = 0L;
 
   public OutputCollector() {
     buffers = new ArrayList<Put>();
@@ -41,17 +45,22 @@ public class OutputCollector implements
   
   @Override
   public void collect(ChukwaRecordKey key, ChukwaRecord value) throws IOException {
-    StringBuffer s = new StringBuffer();
     String[] keyParts = key.getKey().split("/");
+    s.setLength(0);
     s.append(keyParts[2]);
     s.append("-");
     s.append(keyParts[1]);
+    
+    rowKey = s.toString().getBytes();
 
+    cf = key.getReduceType().getBytes();
+    now = value.getTime();
+
+    Put kv = new Put(rowKey);
     for(String field : value.getFields()) {
-        Put kv = new Put(s.toString().getBytes());
-        kv.add(key.getReduceType().getBytes(), field.getBytes(), value.getTime(), value.getValue(field).getBytes());
-        buffers.add(kv);
-    }    
+        kv.add(cf, field.getBytes(), now , value.getValue(field).getBytes());
+    }  
+    buffers.add(kv);  
   }
 
   public List<Put> getKeyValues() {
@@ -59,6 +68,9 @@ public class OutputCollector implements
   }
 
   public void clear() {
+    s.setLength(0);
+    rowKey = null;
+    cf = null;
     buffers.clear();
   }
   



Mime
View raw message