[
https://issues.apache.org/jira/browse/KNOX-2136?focusedWorklogId=358644&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-358644
]
ASF GitHub Bot logged work on KNOX-2136:
----------------------------------------
Author: ASF GitHub Bot
Created on: 12/Dec/19 12:23
Start Date: 12/Dec/19 12:23
Worklog Time Spent: 10m
Work Description: smolnar82 commented on pull request #213: KNOX-2136 -
Caching credentials in DefaultKeystoreService when an alias is being added
(instead of the first time someone fetches) and using a different cache
implementation
URL: https://github.com/apache/knox/pull/213
## What changes were proposed in this pull request?
The following changes we made in `DefaultKeystoreService`:
- make sure we cache a credential of a given alias right after we saved it
in the keystore (until my change it was cached after the first time the
credential was fetched from the keystore)
- changing cache implementation from a simple `ConcurrentHashMap` to
[Caffeine Cache](https://github.com/ben-manes/caffeine/wiki). This change
allows us to configure appropriate eviction policy (as of now, policy
attributes are hard-coded)
## How was this patch tested?
Added a new JUnit test and r=executed a full build:
```
$ mvn clean -Dshellcheck=true -T1C verify -Prelease,package
...
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 18:41 min (Wall Clock)
[INFO] Finished at: 2019-12-12T12:51:54+01:00
[INFO] Final Memory: 414M/2402M
[INFO]
------------------------------------------------------------------------
```
In addition to unit testing, I've executed a performance test to check how
much do we gain when adding/fetching 200/500 credentials (repeated 5 times)
after my changes were in place:
| Num of credentials | Before change (ms) | After Change (ms) |
|--|--|--|
| 200 | 44686<br>51197<br>50423<br>50734<br>50207 |
23011<br>28117<br>27075<br>26996<br>27070 |
|500| 139908<br>188967<br>184465<br>175496<br>182561 |
77049<br>105465<br>105407<br>105488<br>105559 |
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 358644)
Remaining Estimate: 0h
Time Spent: 10m
> 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
> Assignee: Sandor Molnar
> Priority: Major
> Fix For: 1.4.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)