You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/08/31 11:48:00 UTC

[jira] [Work logged] (KNOX-2408) Improve AliasBasedTokenState service performance

     [ https://issues.apache.org/jira/browse/KNOX-2408?focusedWorklogId=476544&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-476544 ]

ASF GitHub Bot logged work on KNOX-2408:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 31/Aug/20 11:47
            Start Date: 31/Aug/20 11:47
    Worklog Time Spent: 10m 
      Work Description: smolnar82 opened a new pull request #371:
URL: https://github.com/apache/knox/pull/371


   ## What changes were proposed in this pull request?
   
   - Let end-users customize the size/TTL attributes of the cache in `DefaultKeystoreService` I introduced while working on [KNOX-2136](https://issues.apache.org/jira/browse/KNOX-2136)
   - `AliasBasedTokenStateService.updateExpiration` updates the data in-memory and let the background thread does its job
   - if `AliasBasedTokenStateService` is selected as token state service, a new background thread is run when the service is started which reads previously persisted relevant aliases into the in-memory collections (in `DefaultTokenStateService`). With this change, it's not needed to override `getTokens` in `AliasBasedTokenStateService` which is only used by the reaper thread when evicting expired tokens. Instead, the token eviction logic will wait until everything is loaded.
   - `DefaultTokenStateService.tokenExpirations` and `DefaultTokenStateService.maxTokenLifetimes` became `ConcurrentHashMap`s -> get rid of many of the synchronization blocks -> easier to read and maintain the code and `CHM` performs better than synchronization + `HashMap`
   
   ## How was this patch tested?
   
   Updated and ran JUnit tests as well as executed the performance test tool multiple times to make sure I achieved the performance goals I was looking for with these changes.


----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 476544)
    Remaining Estimate: 0h
            Time Spent: 10m

> Improve AliasBasedTokenState service performance
> ------------------------------------------------
>
>                 Key: KNOX-2408
>                 URL: https://issues.apache.org/jira/browse/KNOX-2408
>             Project: Apache Knox
>          Issue Type: Task
>          Components: Server
>    Affects Versions: 1.4.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 1.5.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> While working on KNOX-2402 there were some performance issues related to {{AliasBasedTokenStateService}} which the new tool revealed during the test phase:
> {{AliasBasedTokenStateService}}:
>  - {{updateExpiration()}} goes directly to alias service rather than updating it locally and let the background thread does its job
>  - {{getTokens}} goes directly to alias service
> {{DefaultTokenStateService}}:
>  - we should start using {{ConcurrentHashMap}} instead of {{HashMap}} for {{tokenExpirations}} and {{maxTokenLifetimes}} -> many of the synchronization blocks could be get rid of (CHM gives better performance anyway)
>  - review {{getTokens()}} usage
>  - eviction: needs to consider the case when Gateway was restarted -> nothing found in memory -> eviction is extremely slow



--
This message was sent by Atlassian Jira
(v8.3.4#803005)