fengnanli commented on a change in pull request #2110:
URL: https://github.com/apache/hadoop/pull/2110#discussion_r447993331



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
##########
@@ -726,4 +732,41 @@ public TokenIdent decodeTokenIdentifier(Token<TokenIdent> 
token) throws IOExcept
     return token.decodeIdentifier();
   }
 
+  /**
+   * Return top token real owners list as well as the tokens count.
+   *
+   * @param n top number of users
+   * @return map of owners to counts
+   */
+  public List<NameValuePair> getTopTokenRealOwners(int n) {

Review comment:
       I had similar thoughts as well but didn't come up with a better way. In 
namenode TopN metrics, it is doing so as well just at a lower frequency like 
every 5/15/25 minutes. We can potentially do that by reducing the metric 
reporting frequency.
   I also checked modern CPU for looping over 1M, which takes about 1ms-10ms.
   Another one would be to maintain a data structure to dynamically maintain 
the ordering of users and edit ordering per getdelegationtoken and per 
canceldelegationtoken like stream processing. I am not sure about the cost 
overall since in reality we generally have < 1 Million tokens.
   




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to