SlideShare una empresa de Scribd logo
1 de 13
© 2014 MapR Technologies© 2014 MapR Technologies
C APIs for Apache HBase
Aditya Kishore (aditya@mapr.com)
HBase Meetup @ Ancestry.com
© 2014 MapR Technologies
About Me
• Apache HBase contributor since 2012.
• Software Engineer at MapR Technologies.
• Working on Apache HBase, M7 and Apache Drill.
• https://github.com/adityakishore/
© 2014 MapR Technologies
Agenda
• Introducing libHBase
• Design goals.
• API structures, functions and callbacks.
• Client for HBase 0.94.x
• Building libHBase and using in your application.
• A short example code using the APIs.
• Roadmap for the future.
• Demo (if time permits).
© 2014 MapR Technologies
Introducing libHBase
• Frequent requests from our customers (and on HBase mailing list).
• Long open JIRA HBASE-1015 (created: 21/Nov/08)
• “Mandatory for a database approaching 1.0 release” - Nick Dimiduk.
• Thrift / REST bindings are the only available solution.
• Need for stable, future ready, native APIs.
• “C” extern linkage enables support for other languages too.
• Work in progress to define standard C APIs and develop the client library.
• Join the conversation at HBASE-9835, HBASE-9977, HBASE-10168.
© 2014 MapR Technologies
• Parity with Java APIs.
• With native RPCs to HBase servers without any intermediate gateway.
• Uniform APIs across HBase releases to ensure binary compatibility.
• Thread-safe, non-blocking, asynchronous client.
• Synchronous wrappers available over the asynchronous client.
• No support for explicit batching in asynchronous APIs.
• Application managed buffers with destructors for library created resources.
Design Goals
© 2014 MapR Technologies
Structures, Functions and Callbacks
• The APIs use opaque structures to encapsulate implementation.
• Manipulated using create(), set_xyz(), and destroy() methods.
• Exception to this rule is hb_cell_t type which has static members.
• Asynchronous APIs all take a callback function as parameter.
• Invoking an async APIs always return success, error in callback.
• Callbacks can be triggered on any thread.
• Application are expected to not block in the callback routine.
© 2014 MapR Technologies
Available now: Client for HBase 0.94.x
• Download from MapR’s Github repository http://goo.gl/gs0uMs.
• Applied on top of HBase 0.94.17 code base.
• Patches available soon on JIRAs and Review Board.
• JNI implementation of the proposed APIs using AsyncHBase 1.5.
• Requires modified version of AsyncHBase http://goo.gl/aikZDn.
• Supports asynchronous Put, Get, Delete and Scan APIs.
• Synchronous Admin APIs wraps HBaseAdmin.
© 2014 MapR Technologies
Building libHBase and using in your Application
• Integrated with the HBase maven build using ‘libhbase’ profile.
• The HBase native library is built using Gradle.
• Header files in ‘/libhbase/include’, link with ‘-lhbase’.
• libhbase.so and libjvm.so need to be in LD_LIBRARY_PATH.
• Specify JVM classpath using ‘CLASSPATH’ or ‘HBASE_LIB_DIR’.
• Other JVM options can be specified using ‘LIBHBASE_OPTS’.
• Find the example code under ‘/libhbase/example/async’.
• A rudimentary performance test ‘/bin/perftest.sh’ is included.
© 2014 MapR Technologies
#include <hbase/hbase.h>
int main(int argc, char **argv) {
hb_connection_t connection = NULL;
hb_connection_create("localhost:2181",
"/hbase", &connection);
hb_client_t client = NULL;
hb_client_create(connection, &client);
hb_put_t put = NULL;
char *row_key = strdup("row_001");
size_t row_key_len = strlen(row_key);
hb_put_create((byte_t*) row_key,
row_key_len, &put);
hb_cell_t *cell = (hb_cell_t*)
calloc(1, sizeof(hb_cell_t));
cell->row = (byte_t*)row_key;
cell->row_len = row_key_len;
{...} // assemble the rest of the cell
hb_put_add_cell(put, cell);
hb_mutation_send(client, put,
mutation_callback, cell);
{...} // wait for callback to complete
hb_client_destroy(client, NULL, NULL);
return 0;
}
void mutation_callback(int32_t err,
hb_client_t client, hb_mutation_t mutation,
hb_result_t result, void *extra) {
hb_cell_t *cell = (hb_cell_t*) extra;
free(cell->row);
free(cell);
if (result) {
hb_result_destroy(result);
}
hb_mutation_destroy(mutation);
{...} // notify waiters
}
Example Code using the APIs
ZK Connection
Create the client
Prepare the Put
Assemble a Cell
Add Cell to Put
Submit to Client
Free the buffers
Free the Objects
HBase header
Free the Client
© 2014 MapR Technologies
Roadmap for Future
• Support for remaining APIs (increment, append, etc...).
• Performance test for Get / Scan / Mix workload.
• Support for Scan / Get Filters.
• Optimization of JNI / native call transitions.
• Support for secure RPCs.
• Native implementation for HBase 0.96+.
© 2014 MapR Technologies© 2014 MapR Technologies
DEMO
© 2014 MapR Technologies
Q & A
@mapr maprtech
aditya [at] mapr.com
Engage with us!
MapR
maprtech
mapr-technologies
© 2014 MapR Technologies© 2014 MapR Technologies
We are hiring!!!
http://www.mapr.com/company/careers

Más contenido relacionado

Destacado

Scrapbook in Science
Scrapbook in ScienceScrapbook in Science
Scrapbook in ScienceEudalle Casul
 
Introduction to Autoethnography
Introduction to AutoethnographyIntroduction to Autoethnography
Introduction to Autoethnographyfiadotau
 
Avaya One-X Mobile SIP for Apple iOS by PacketBase
Avaya One-X Mobile SIP for Apple iOS by PacketBaseAvaya One-X Mobile SIP for Apple iOS by PacketBase
Avaya One-X Mobile SIP for Apple iOS by PacketBasePacketBase, Inc.
 
Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...
Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...
Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...fiadotau
 

Destacado (8)

Roushan_CV
Roushan_CVRoushan_CV
Roushan_CV
 
Scrapbook in Science
Scrapbook in ScienceScrapbook in Science
Scrapbook in Science
 
Forandringsledelse
ForandringsledelseForandringsledelse
Forandringsledelse
 
Adrian's Portfolio
Adrian's PortfolioAdrian's Portfolio
Adrian's Portfolio
 
Introduction to Autoethnography
Introduction to AutoethnographyIntroduction to Autoethnography
Introduction to Autoethnography
 
Avaya One-X Mobile SIP for Apple iOS by PacketBase
Avaya One-X Mobile SIP for Apple iOS by PacketBaseAvaya One-X Mobile SIP for Apple iOS by PacketBase
Avaya One-X Mobile SIP for Apple iOS by PacketBase
 
Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...
Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...
Лекция 5. Инструментарий технического переводчика. Электронные словари, поис...
 
Dissertation
DissertationDissertation
Dissertation
 

Más de MapR Technologies

Converging your data landscape
Converging your data landscapeConverging your data landscape
Converging your data landscapeMapR Technologies
 
ML Workshop 2: Machine Learning Model Comparison & Evaluation
ML Workshop 2: Machine Learning Model Comparison & EvaluationML Workshop 2: Machine Learning Model Comparison & Evaluation
ML Workshop 2: Machine Learning Model Comparison & EvaluationMapR Technologies
 
Self-Service Data Science for Leveraging ML & AI on All of Your Data
Self-Service Data Science for Leveraging ML & AI on All of Your DataSelf-Service Data Science for Leveraging ML & AI on All of Your Data
Self-Service Data Science for Leveraging ML & AI on All of Your DataMapR Technologies
 
Enabling Real-Time Business with Change Data Capture
Enabling Real-Time Business with Change Data CaptureEnabling Real-Time Business with Change Data Capture
Enabling Real-Time Business with Change Data CaptureMapR Technologies
 
Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...
Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...
Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...MapR Technologies
 
ML Workshop 1: A New Architecture for Machine Learning Logistics
ML Workshop 1: A New Architecture for Machine Learning LogisticsML Workshop 1: A New Architecture for Machine Learning Logistics
ML Workshop 1: A New Architecture for Machine Learning LogisticsMapR Technologies
 
Machine Learning Success: The Key to Easier Model Management
Machine Learning Success: The Key to Easier Model ManagementMachine Learning Success: The Key to Easier Model Management
Machine Learning Success: The Key to Easier Model ManagementMapR Technologies
 
Data Warehouse Modernization: Accelerating Time-To-Action
Data Warehouse Modernization: Accelerating Time-To-Action Data Warehouse Modernization: Accelerating Time-To-Action
Data Warehouse Modernization: Accelerating Time-To-Action MapR Technologies
 
Live Tutorial – Streaming Real-Time Events Using Apache APIs
Live Tutorial – Streaming Real-Time Events Using Apache APIsLive Tutorial – Streaming Real-Time Events Using Apache APIs
Live Tutorial – Streaming Real-Time Events Using Apache APIsMapR Technologies
 
Bringing Structure, Scalability, and Services to Cloud-Scale Storage
Bringing Structure, Scalability, and Services to Cloud-Scale StorageBringing Structure, Scalability, and Services to Cloud-Scale Storage
Bringing Structure, Scalability, and Services to Cloud-Scale StorageMapR Technologies
 
Live Machine Learning Tutorial: Churn Prediction
Live Machine Learning Tutorial: Churn PredictionLive Machine Learning Tutorial: Churn Prediction
Live Machine Learning Tutorial: Churn PredictionMapR Technologies
 
An Introduction to the MapR Converged Data Platform
An Introduction to the MapR Converged Data PlatformAn Introduction to the MapR Converged Data Platform
An Introduction to the MapR Converged Data PlatformMapR Technologies
 
How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...
How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...
How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...MapR Technologies
 
Best Practices for Data Convergence in Healthcare
Best Practices for Data Convergence in HealthcareBest Practices for Data Convergence in Healthcare
Best Practices for Data Convergence in HealthcareMapR Technologies
 
Geo-Distributed Big Data and Analytics
Geo-Distributed Big Data and AnalyticsGeo-Distributed Big Data and Analytics
Geo-Distributed Big Data and AnalyticsMapR Technologies
 
MapR Product Update - Spring 2017
MapR Product Update - Spring 2017MapR Product Update - Spring 2017
MapR Product Update - Spring 2017MapR Technologies
 
3 Benefits of Multi-Temperature Data Management for Data Analytics
3 Benefits of Multi-Temperature Data Management for Data Analytics3 Benefits of Multi-Temperature Data Management for Data Analytics
3 Benefits of Multi-Temperature Data Management for Data AnalyticsMapR Technologies
 
Cisco & MapR bring 3 Superpowers to SAP HANA Deployments
Cisco & MapR bring 3 Superpowers to SAP HANA DeploymentsCisco & MapR bring 3 Superpowers to SAP HANA Deployments
Cisco & MapR bring 3 Superpowers to SAP HANA DeploymentsMapR Technologies
 
MapR and Cisco Make IT Better
MapR and Cisco Make IT BetterMapR and Cisco Make IT Better
MapR and Cisco Make IT BetterMapR Technologies
 
Evolving from RDBMS to NoSQL + SQL
Evolving from RDBMS to NoSQL + SQLEvolving from RDBMS to NoSQL + SQL
Evolving from RDBMS to NoSQL + SQLMapR Technologies
 

Más de MapR Technologies (20)

Converging your data landscape
Converging your data landscapeConverging your data landscape
Converging your data landscape
 
ML Workshop 2: Machine Learning Model Comparison & Evaluation
ML Workshop 2: Machine Learning Model Comparison & EvaluationML Workshop 2: Machine Learning Model Comparison & Evaluation
ML Workshop 2: Machine Learning Model Comparison & Evaluation
 
Self-Service Data Science for Leveraging ML & AI on All of Your Data
Self-Service Data Science for Leveraging ML & AI on All of Your DataSelf-Service Data Science for Leveraging ML & AI on All of Your Data
Self-Service Data Science for Leveraging ML & AI on All of Your Data
 
Enabling Real-Time Business with Change Data Capture
Enabling Real-Time Business with Change Data CaptureEnabling Real-Time Business with Change Data Capture
Enabling Real-Time Business with Change Data Capture
 
Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...
Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...
Machine Learning for Chickens, Autonomous Driving and a 3-year-old Who Won’t ...
 
ML Workshop 1: A New Architecture for Machine Learning Logistics
ML Workshop 1: A New Architecture for Machine Learning LogisticsML Workshop 1: A New Architecture for Machine Learning Logistics
ML Workshop 1: A New Architecture for Machine Learning Logistics
 
Machine Learning Success: The Key to Easier Model Management
Machine Learning Success: The Key to Easier Model ManagementMachine Learning Success: The Key to Easier Model Management
Machine Learning Success: The Key to Easier Model Management
 
Data Warehouse Modernization: Accelerating Time-To-Action
Data Warehouse Modernization: Accelerating Time-To-Action Data Warehouse Modernization: Accelerating Time-To-Action
Data Warehouse Modernization: Accelerating Time-To-Action
 
Live Tutorial – Streaming Real-Time Events Using Apache APIs
Live Tutorial – Streaming Real-Time Events Using Apache APIsLive Tutorial – Streaming Real-Time Events Using Apache APIs
Live Tutorial – Streaming Real-Time Events Using Apache APIs
 
Bringing Structure, Scalability, and Services to Cloud-Scale Storage
Bringing Structure, Scalability, and Services to Cloud-Scale StorageBringing Structure, Scalability, and Services to Cloud-Scale Storage
Bringing Structure, Scalability, and Services to Cloud-Scale Storage
 
Live Machine Learning Tutorial: Churn Prediction
Live Machine Learning Tutorial: Churn PredictionLive Machine Learning Tutorial: Churn Prediction
Live Machine Learning Tutorial: Churn Prediction
 
An Introduction to the MapR Converged Data Platform
An Introduction to the MapR Converged Data PlatformAn Introduction to the MapR Converged Data Platform
An Introduction to the MapR Converged Data Platform
 
How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...
How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...
How to Leverage the Cloud for Business Solutions | Strata Data Conference Lon...
 
Best Practices for Data Convergence in Healthcare
Best Practices for Data Convergence in HealthcareBest Practices for Data Convergence in Healthcare
Best Practices for Data Convergence in Healthcare
 
Geo-Distributed Big Data and Analytics
Geo-Distributed Big Data and AnalyticsGeo-Distributed Big Data and Analytics
Geo-Distributed Big Data and Analytics
 
MapR Product Update - Spring 2017
MapR Product Update - Spring 2017MapR Product Update - Spring 2017
MapR Product Update - Spring 2017
 
3 Benefits of Multi-Temperature Data Management for Data Analytics
3 Benefits of Multi-Temperature Data Management for Data Analytics3 Benefits of Multi-Temperature Data Management for Data Analytics
3 Benefits of Multi-Temperature Data Management for Data Analytics
 
Cisco & MapR bring 3 Superpowers to SAP HANA Deployments
Cisco & MapR bring 3 Superpowers to SAP HANA DeploymentsCisco & MapR bring 3 Superpowers to SAP HANA Deployments
Cisco & MapR bring 3 Superpowers to SAP HANA Deployments
 
MapR and Cisco Make IT Better
MapR and Cisco Make IT BetterMapR and Cisco Make IT Better
MapR and Cisco Make IT Better
 
Evolving from RDBMS to NoSQL + SQL
Evolving from RDBMS to NoSQL + SQLEvolving from RDBMS to NoSQL + SQL
Evolving from RDBMS to NoSQL + SQL
 

C APIs for Apache HBase by Aditya Kishore

  • 1. © 2014 MapR Technologies© 2014 MapR Technologies C APIs for Apache HBase Aditya Kishore (aditya@mapr.com) HBase Meetup @ Ancestry.com
  • 2. © 2014 MapR Technologies About Me • Apache HBase contributor since 2012. • Software Engineer at MapR Technologies. • Working on Apache HBase, M7 and Apache Drill. • https://github.com/adityakishore/
  • 3. © 2014 MapR Technologies Agenda • Introducing libHBase • Design goals. • API structures, functions and callbacks. • Client for HBase 0.94.x • Building libHBase and using in your application. • A short example code using the APIs. • Roadmap for the future. • Demo (if time permits).
  • 4. © 2014 MapR Technologies Introducing libHBase • Frequent requests from our customers (and on HBase mailing list). • Long open JIRA HBASE-1015 (created: 21/Nov/08) • “Mandatory for a database approaching 1.0 release” - Nick Dimiduk. • Thrift / REST bindings are the only available solution. • Need for stable, future ready, native APIs. • “C” extern linkage enables support for other languages too. • Work in progress to define standard C APIs and develop the client library. • Join the conversation at HBASE-9835, HBASE-9977, HBASE-10168.
  • 5. © 2014 MapR Technologies • Parity with Java APIs. • With native RPCs to HBase servers without any intermediate gateway. • Uniform APIs across HBase releases to ensure binary compatibility. • Thread-safe, non-blocking, asynchronous client. • Synchronous wrappers available over the asynchronous client. • No support for explicit batching in asynchronous APIs. • Application managed buffers with destructors for library created resources. Design Goals
  • 6. © 2014 MapR Technologies Structures, Functions and Callbacks • The APIs use opaque structures to encapsulate implementation. • Manipulated using create(), set_xyz(), and destroy() methods. • Exception to this rule is hb_cell_t type which has static members. • Asynchronous APIs all take a callback function as parameter. • Invoking an async APIs always return success, error in callback. • Callbacks can be triggered on any thread. • Application are expected to not block in the callback routine.
  • 7. © 2014 MapR Technologies Available now: Client for HBase 0.94.x • Download from MapR’s Github repository http://goo.gl/gs0uMs. • Applied on top of HBase 0.94.17 code base. • Patches available soon on JIRAs and Review Board. • JNI implementation of the proposed APIs using AsyncHBase 1.5. • Requires modified version of AsyncHBase http://goo.gl/aikZDn. • Supports asynchronous Put, Get, Delete and Scan APIs. • Synchronous Admin APIs wraps HBaseAdmin.
  • 8. © 2014 MapR Technologies Building libHBase and using in your Application • Integrated with the HBase maven build using ‘libhbase’ profile. • The HBase native library is built using Gradle. • Header files in ‘/libhbase/include’, link with ‘-lhbase’. • libhbase.so and libjvm.so need to be in LD_LIBRARY_PATH. • Specify JVM classpath using ‘CLASSPATH’ or ‘HBASE_LIB_DIR’. • Other JVM options can be specified using ‘LIBHBASE_OPTS’. • Find the example code under ‘/libhbase/example/async’. • A rudimentary performance test ‘/bin/perftest.sh’ is included.
  • 9. © 2014 MapR Technologies #include <hbase/hbase.h> int main(int argc, char **argv) { hb_connection_t connection = NULL; hb_connection_create("localhost:2181", "/hbase", &connection); hb_client_t client = NULL; hb_client_create(connection, &client); hb_put_t put = NULL; char *row_key = strdup("row_001"); size_t row_key_len = strlen(row_key); hb_put_create((byte_t*) row_key, row_key_len, &put); hb_cell_t *cell = (hb_cell_t*) calloc(1, sizeof(hb_cell_t)); cell->row = (byte_t*)row_key; cell->row_len = row_key_len; {...} // assemble the rest of the cell hb_put_add_cell(put, cell); hb_mutation_send(client, put, mutation_callback, cell); {...} // wait for callback to complete hb_client_destroy(client, NULL, NULL); return 0; } void mutation_callback(int32_t err, hb_client_t client, hb_mutation_t mutation, hb_result_t result, void *extra) { hb_cell_t *cell = (hb_cell_t*) extra; free(cell->row); free(cell); if (result) { hb_result_destroy(result); } hb_mutation_destroy(mutation); {...} // notify waiters } Example Code using the APIs ZK Connection Create the client Prepare the Put Assemble a Cell Add Cell to Put Submit to Client Free the buffers Free the Objects HBase header Free the Client
  • 10. © 2014 MapR Technologies Roadmap for Future • Support for remaining APIs (increment, append, etc...). • Performance test for Get / Scan / Mix workload. • Support for Scan / Get Filters. • Optimization of JNI / native call transitions. • Support for secure RPCs. • Native implementation for HBase 0.96+.
  • 11. © 2014 MapR Technologies© 2014 MapR Technologies DEMO
  • 12. © 2014 MapR Technologies Q & A @mapr maprtech aditya [at] mapr.com Engage with us! MapR maprtech mapr-technologies
  • 13. © 2014 MapR Technologies© 2014 MapR Technologies We are hiring!!! http://www.mapr.com/company/careers