-
Notifications
You must be signed in to change notification settings - Fork 6
[example] Add Instrumented Loading LRU cache example #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[example] Add Instrumented Loading LRU cache example #66
Conversation
ab3bddd to
31b7bee
Compare
578c452 to
b3b2fb4
Compare
a54961a to
9e3dad2
Compare
bhufmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be interesting to have some screenshots of the traces and show them in the readme? Interested people might not want to run it, but would like to see the results?
lrucacheexample/README.md
Outdated
|
|
||
| #### Leads | ||
|
|
||
| - How to explain the disproportional decrase in performance between the fully sized caches vs 95% sized results? It's a ~12x factor! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decase -> decrease
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| @@ -0,0 +1,96 @@ | |||
| package org.eclipse.tracecompass.traceeventlogger.lrucachedemo; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it have a copyright header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| @@ -0,0 +1,249 @@ | |||
| package org.eclipse.tracecompass.traceeventlogger.lrucachedemo; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it have a copyright header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| @@ -0,0 +1,240 @@ | |||
| package org.eclipse.tracecompass.traceeventlogger.lrucachedemo; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it have a copyright header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
c47ee9e to
bbb321b
Compare
bhufmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the lrucacheexample should be under a folder with name examples. Then we can add other examples when we have them.
Done - will push new version momentarily |
c96774e to
246a4e4
Compare
This toy example was inspired by a real-life investigation, regarding a web-accessible application that had configurable caches, including a specific one whose performance came under scrutiny. That investigation produces some interesting traces, which we aim to approximately replicate with this example. Real life investigation - some info about that cache: type: LRU (least recently used) - when the cache is full, the cache element that was the least recently used is evicted to make space for a new element to be inserted in its place. configurable cache size: The number of elements it can hold is configurable by the app's admins cache / cached data usage: The cache is used in a special way. Thought the cache-backed data can be accessed randomly, it's often accessed sequentially, from first element to the last, in order. The app is multi-threaded and often multiple reader threads would be reading the data through the cache, in parallel. The app provides cache statistics, which seemed quite good (a high cache "hit" rate was reported). Investigation: The cache was configured to be slightly under-sized vs the data it was caching, which size (number of elements) was slowly but surely increasing. Given the good reported cache stats, was it an issue that it was a bit undersized (by ~15%)? Was the cache, as configured, potentially affecting performance? Tracing to the rescue! The cache and reader thread code were instrumented. From the generated traces, it was possible to distinguish cache hits vs misses. Capturing traces for a few scenarios, some surprising details started to emerge! See the example's README for more details. Signed-off-by: Marc Dumais <[email protected]>
246a4e4 to
242c4cc
Compare
bhufmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks!
c10569f
into
eclipse-tracecompass:main
What it does
This toy example was inspired by a real-life investigation, regarding a web-accessible application that had configurable caches, including a specific one whose performance came under scrutiny. That investigation produced some interesting traces, which we aim to approximately replicate with this example.
Related YouTube video:
https://www.youtube.com/watch?v=mSg8EO_FhuQ
Real life investigation - some info about that cache:
type: LRU (least recently used) - when the cache is full, the cache element that was the least recently used is evicted to make space for a new element to be inserted in its place.
configurable cache size: The number of elements it can hold is configurable by the app's admins
cache / cached data usage: The cache is used in a special way. Thought the cache-backed data can be accessed randomly, it's often accessed sequentially, from first element to the last, in order. The app is multi-threaded and often multiple reader threads would be reading the data through the cache, in parallel.
The app provides cache statistics, which seemed quite good (a high cache "hit" rate was reported).
Investigation:
The cache was configured to be slightly under-sized vs the data it was caching, which size (number of elements) was slowly but surely increasing. Given the good reported cache stats, was it an issue that it was a bit undersized (by ~15%)? Was the cache, as configured, potentially affecting performance?
Tracing to the rescue!
The cache and reader thread code were instrumented. From the generated traces, it was possible to distinguish cache hits vs misses. Capturing traces for a few scenarios, some surprising details started to emerge!
See the example's README for more details.
How to test
Follow the instructions in the example's README - try to visualize some of the captured traces. Comments welcome!
Here is what the generated traces look-like in Trace Compass:
Cache big enough to contain all elements:

Cache slightly undersized (fits 95% of elements):

Follow-ups
N/A
Review checklist