public static int estimatedSerializedSizeOfKey(final Cell cell) {
    if (cell instanceof KeyValue) return ((KeyValue) cell).getKeyLength();
    return cell.getRowLength() + cell.getFamilyLength() + cell.getQualifierLength()
      + KeyValue.KEY_INFRASTRUCTURE_SIZE;
  }
Calculates the serialized key size. We always serialize in the KeyValue's serialization format.
@param cell the cell for which the key size has to be calculated.
@return the key size
hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java