rmdmattingly opened a new pull request, #5424:
URL: https://github.com/apache/hbase/pull/5424

   ### Description
   
   At my day job we struggle to use quotas effectively for our most important 
HBase users. This is because our most important users are often proxy APIs 
which are queried by countless "upstream" microservices. It isn't feasible for 
these proxy APIs to spin up new connections for each request, so it isn't 
feasible to have distinct UserGroupInformation at request granularity. This 
leaves us unable to throttle these upstream microservices in isolation.
   
   In https://github.com/apache/hbase/pull/5326 we added support for "request 
attributes" — these are like operation attributes, except they exist 1:1 with 
RpcCalls rather than 1:1 with operations. In this PR we build on the request 
attribute framework and introduce the ability to specify a "quota user 
override" so that one can apply separate throttles to many requests sent by a 
single shared Connection.
   
   ### Usage
   
   For example, one may add the following property to their HBase configuration:
   ```xml
   <property>
     <name>hbase.quota.user.override.key</name>
     <value>quotaUser</value>
   </property>
   ```
   
   One could then create a Table with a quota user override via the 
TableBuilder:
   ```java
     private static final String QUOTA_USER_OVERRIDE_KEY = "quotaUser";
   ...
     String quotaUser = "myCustomQuotaUser";
     admin.setQuota(QuotaSettingsFactory.throttleUser(quotaUser, ...)); // 
configure throttle
     Table table = connection
       .getTableBuilder(tableName)
       .setRequestAttribute(QUOTA_USER_OVERRIDE_KEY, Bytes.toBytes(quotaUser))
       .build();
     table.get(...); // this request will be subject to the throttle defined 
above
   
     Table tableUnthrottled = connection.getTableBuilder(tableName).build();
     table.get(...); // this request will NOT be subject to the throttle 
defined above
   ```
   
   cc @bbeaudreault @hgromer @eab148 @bozzkar
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to