# 
1. Salt

By [rojeck](https://paragraph.com/@rojeckluo) · 2021-12-19

---

    The application of Salting in HBase is to assign a random character to each rowkey prefix, so that the data is scattered in multiple different regions to achieve a balanced load.
    
    If the table region in HBase is distinguished according to the prefix of each letter, let's compare the changes before and after adding salt to the rowkey. First, we give a set of rowkeys before salt:
    
    rk001
    
    rk002
    
    rk003
    
    According to the partition, the above rowkey is in the same region. Below we add salt to the above rowkey:
    
    a-rk001
    
    b-rk002
    
    c-rk003
    
    After the processed rowkey, the data is distributed in 3 regions. In theory, the throughput at this time is 3 times that before the processing. Since the prefix is ​​random, it takes more time to search lexicographically when reading these data (may initiate a request to each region server), so salt increases the throughput of write operations, but it increases the read operation Overhead.

---

*Originally published on [rojeck](https://paragraph.com/@rojeckluo/1-salt)*
