phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vijay Vangapandu <>
Subject Re: Help with salting
Date Mon, 23 Nov 2015 02:25:33 GMT
Hi James,

Thanks for your help. I used reverseBytes on the sequence key. hot spotting issue is not completely
gone but better than before.
Do you think it will get better with reverse bits?

I have one more question. I see few errors in logs and I am not sure where the issue is, we
are debugging the issue but just want to post the exception incase you encountered this before.

We are trying to insert “en_US” value to a locale column, which VARCHAR data type, and
birthdate field (DATE) comes before this locale field if that helps.

Caused by: org.apache.phoenix.exception.PhoenixParserException: ERROR 604 (42P00): Syntax
error. Mismatched input. Expecting "RPAREN", got "en_US" at line 1, column 515.

        at org.apache.phoenix.exception.PhoenixParserException.newException(

        at org.apache.phoenix.parse.SQLParser.parseStatement( ~[phoenix-4.4.0-HBase-1.1-client-minimal.jar:na]

        at org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(

        at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(

        at org.apache.phoenix.jdbc.PhoenixPreparedStatement.<init>(

        at org.apache.phoenix.jdbc.PhoenixConnection.prepareStatement(


        ... 158 common frames omitted

Caused by: org.antlr.runtime.MismatchedTokenException: null

        at org.apache.phoenix.parse.PhoenixSQLParser.recoverFromMismatchedToken(

        at org.antlr.runtime.BaseRecognizer.match( ~[phoenix-4.4.0-HBase-1.1-client-minimal.jar:na]

        at org.apache.phoenix.parse.PhoenixSQLParser.upsert_node(

        at org.apache.phoenix.parse.PhoenixSQLParser.oneStatement(

From: James Taylor <<>>
Reply-To: "<>" <<>>
Date: Tuesday, November 3, 2015 at 6:49 PM
To: user <<>>
Subject: Re: Help with salting

Hi Vijay,
Have you considered generating your IDs in a way that prevents hotspotting? One way might
be to reverse the bits you get back from the sequence generator. You could write a simple
UDF that does that:

See inline for answers to your questions.


On Tue, Nov 3, 2015 at 3:44 PM, Vijay Vangapandu <<>>

I integrated one of the online services in my company with hbase using apache phoenix, after
loading few millions of records I noticed that we have hotspot problem. All the records are
going to one region as the keys are generated using sequence.
Usecase is: each user has 1000’s of records with combination of userid and second record
id as rowkey (primary key uid, XXX). When user logs in we fetch all records by using userid
and render the results to user. But updates will always be with combination (userid + XXX).
Below are my questions.

 1.  If I salt the table using apache phoenix, is there any performance impact on reads as
the reads has to query all regions?
Yes - for range scans, Phoenix needs to run N scans to find all the data where N is the number
of salt buckets. Worst case, that's N times more load on your cluster, but in reality, the
impact would likely be lower. A good way to think of it is that you're loading N blocks when
in the non salted case you might only be loading 1 block.

 2.  If I have to salt the table, how many buckets should I use for 8 regional servers with
272 regions, roughly 33 regions for a regions server?
Have you seen the Tuning presentation on our Presentations page?
Maybe start with 10 or 11 salt buckets. Looks like your region size is pretty small, so not
sure how this will impact things. Try using Pherf (
with different salt buckets to get an idea.

 3.  If I salt the table using phoenix, what is the effort to move away  from pehonix and
use the hbase client directly in later times ( not that I want to but just checking the options)
Impossible. :-) The salt byte value calculation is just a few lines of code (see SaltingUtil.getSaltingByte()),
and you'd need to run scans against all salt buckets and merge the results. But assuming your
using where clauses and other features, that's going to be a lot of work.

Thanks for your help.

Vijay Vangapandu
eHarmony, Platform
Principal Software Engineer

View raw message