You can also add a random (or hashed) prefix to the beginning of the key.
 If your prefix were one byte with values 0-63, you've divided the hot spot
into 64 smaller ones, which is better for writing.  The downside is that if
you want to read a range of values, you will have to query all 64 "shards"
and merge the sorted values.  You can choose whatever prefix size is best
for your scenario.


On Mon, Jan 10, 2011 at 11:05 AM, Chirstopher Tarnas <[email protected]> wrote:

> Some options that I am aware of:
>
> reverse the byte order of the timestamp
> use UUIDs rather than a timestamp
> use hashing, this working really depends on your requirements
>
> On Mon, Jan 10, 2011 at 9:33 AM, Weishung Chung <[email protected]>
> wrote:
>
> > What is the good way to randomize the primary key which is a timestamp in
> > HBase to avoid hotspotting?
> > Thank you so much :)
> >
>

Reply via email to