Git Product home page Git Product logo

saltedhtable's Introduction

#What is SaltedHTable? In this feature, a slater will prepend some prefix before the row, and the prefix is the hash value of the original row key, so that the row key distribution is more even to avoid hot spotting. SaltedTableInterface is used to operate (get, delete, put, scan) the salted table easily.

#Problems

For the results with sequential row keys, they are inserted into one single region which could become a hotspot within a specific period.

#Solution: Salt the Tables

• Salting a table is to add a prefix to row keys to spread the records with sequential row keys into regions.

– The new row key is Prefix+RowKey.

• Eliminate the hotspot issue.

• Increase the throughputs.

#Implement

• SaltedHTable is an implementation of the HTableInterface.

• KeySalter is used to salt tables.

An implemented one is OneBytePrefixKeySalter, where the prefix is hash(RowKey)%buckets

#Sample

Put in the HTable

   HTable ht = new HTable(conf, tablename);
   Put put = new Put(row);
   put. add( family, qualifier, value);
   ht.put(put);

Put in the SaltedHTable

   HTable ht = new HTable(conf, tablename);
   Put put = new Put(row);
   put. add( family, qualifier, value);
   KeySalter salter = new OneBytePrefixKeySalter();
   SaltedHTable saltedTable = new SaltedHTable (ht, salter);
   saltedTable.put(put);

Scan in the Htable

HTable ht = new Htable(conf, tablename);
Scan scan = new Scan();
ResultScanner scanner = ht.getScanner(scan);
Result result = scanner.next();

Scan in the SaltedHTable

HTable ht = new HTable(conf, tablename);
Scan scan = new Scan();
KeySalter salter = new OneBytePrefixKeySalter();
SaltedHTable saltedTable = new SaltedHTable (ht, salter);
ResultScanner scanner = saltedTable.getScanner(scan);
Result result = scanner.next();

saltedhtable's People

Watchers

James Cloos avatar Jiajia Li avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.