[ 
https://issues.apache.org/jira/browse/KNOX-2136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16993430#comment-16993430
 ] 

Sandor Molnar commented on KNOX-2136:
-------------------------------------

Another thing I also found while looking at the implementation in 
{{DefaultKeystoreService}}: {{addToCache}} method is only invoked in 
{{getCredentialForCluster}} (see 
[here|[https://github.com/apache/knox/blob/master/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultKeystoreService.java#L313]]).
 This means the first time we store a credential in the in-memory cache (added 
more than a year ago; check out KNOX-1230 and KNOX-1552) happens after we 
fetched it from the keystore. Just moving that one line above into 
{{addCredentialForCluster}} (after line 292) produces the same performance as I 
achieved with adding a new cache in {{DefaultAliasService}} (see my previous 
comment).

My proposal is:

replace the current cache implementation in {{DefaultKeystoreService}} with 
Caffeine's Cache (so that we can leverage its eviction policy management) and 
invoke the {{addToCache}} method in {{addCredentialForCluster}}.

[~pzampino], [~krisden] - any thoughts?

> Caching for keystore-based AliasService implementation
> ------------------------------------------------------
>
>                 Key: KNOX-2136
>                 URL: https://issues.apache.org/jira/browse/KNOX-2136
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: Server
>    Affects Versions: 1.3.0
>            Reporter: Philip Zampino
>            Priority: Major
>             Fix For: 1.4.0
>
>
> Performance testing has revealed that as the number of keys increases, the 
> performance of keystores degrades significantly. We should investigate the 
> feasibility and potential benefit of adding in-memory caching of aliases in 
> the keystore(file)-based AliasService implementation.



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

Reply via email to