Is the efficient buffer Java interface BufferedMutator is mutate into memory each time, only to write. The value of the buffer before writing, or flush (),
C + + is to call thrift2 interface, how to achieve efficient insertion, or disable automatic flush table??
Void HBaseDriver: : putMultiple (string& TableName, string& RowKey, unordered_map & lt; String, string> & QualifierVal string& Family) {
CurrentPutCount +=1;
//STD: : vectorPuts;
TPut put;
STD: : vectorCVS;
Put the __set_row (rowKey);
If (BOOL_TEST) {
Start=clock ();
BOOL_TEST=false;
}
Unordered_map & lt; String, string> : : iterator it;
Try {
It=qualifierVal. The begin ();
While (it!=qualifierVal. End ()) {
TColumnValue CV;
CV. __set_family (family);
CV. __set_qualifier (it - & gt; First);
CV. __set_value (it - & gt; Second);
/* if (it - & gt; The first=="feature") {//if the key is' feature '
Assert (it - & gt; Second, length ()==BASE64_FEATURE_LEN);
} */
CVS. Insert (CVS) end (), CV);
The put. __set_durability (TDurability: : SKIP_WAL);//skit write ahead log for speed up
Put the __set_columnValues (CVS);
Puts. Insert (puts the end (), put);
It++;
}
If (this - & gt; This currentPutCount % - & gt; PUT_BATCH_SIZE==0) {
Put_client_ - & gt; PutMultiple (tableName, puts);
finish=clock();
Duration=(finish - start)/CLOCKS_PER_SEC;
Printf ("=====================================% f seconds cost for hbase put. \ n ", duration).
//long end=CURRENT_TIME ();
Time Cost://LOG (string (" "+ to_string (end - start) +" ms "));
Puts the clear ();
}
CVS. The clear ();
{} the catch (TException Tex)
The LOG (string (Tex. What ()));
}
}
CodePudding user response:
Can not through c + + to write? The message queue for Java to write, if the timeliness requirements can use bulkload isn't high (minutes)