-
Notifications
You must be signed in to change notification settings - Fork 80
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
NS-CACHE: Eviction from the cache #6086
Conversation
...end/src/app/components/modals/create-namespace-bucket-modal/create-namespace-bucket-modal.js
Outdated
Show resolved
Hide resolved
...end/src/app/components/modals/create-namespace-bucket-modal/create-namespace-bucket-modal.js
Outdated
Show resolved
Hide resolved
...end/src/app/components/modals/create-namespace-bucket-modal/create-namespace-bucket-modal.js
Outdated
Show resolved
Hide resolved
ff3dd88
to
98e0363
Compare
1f3b4e2
to
2ae7368
Compare
cd39499
to
ea643ab
Compare
c0ef848
to
e1bcffd
Compare
e1bcffd
to
bbc6259
Compare
bbc6259
to
29bcab2
Compare
29bcab2
to
6a43e15
Compare
...end/src/app/components/modals/create-namespace-bucket-modal/create-namespace-bucket-modal.js
Outdated
Show resolved
Hide resolved
6a43e15
to
97976e6
Compare
d9a32c8
to
c4d8a39
Compare
c4d8a39
to
2decc71
Compare
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.
Still reviewing, but sending out my comments so far.
Another note was about the call to noobaa-core/src/server/bg_services/tier_ttf_worker.js Lines 74 to 79 in 0f73225
@nb-ohad suggested to use lower time_range and sum up the results. |
2decc71
to
6970369
Compare
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.
@guptsanj See changes requested. Please let me know if I can help.
Comments are not relevant in updated PR
@jackyalbo Please review and change your review to approved if you have no additional comments - we are trying to complete this PR this week. Thanks |
4ab7236
to
b293934
Compare
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.
Hi @guptsanj Good job, this is almost done.
I found a couple more things - see below.
Also what about usage_aggregator.get_bandwidth_report()
- didn't you need to change it?
Triggered in the tier ttf worker Signed-off-by: Sanjeev Gupta <guptsanj@us.ibm.com>
b293934
to
eb9616b
Compare
Hi @guymguym Re: |
// any attempt is made to delete the objects. | ||
if (this.evict) { | ||
const objects_to_gc = _.uniq(loaded_chunks_db.flatMap(chunk => chunk.objects)) | ||
.filter(obj => Date.now() - obj.create_time.getTime() > config.NAMESPACE_CACHING.MIN_OBJECT_AGE_FOR_GC); |
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.
@guymguym Should we not do this cached object aging check at the start of the map builder for the eviction case? This check is just marking object entries as deleted when they are aged out AND objects have no parts.
The chunks, parts and blocks related to eviction have already been deleted by this point.
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.
Good question - here are my thoughts:
For chunks (with their parts and blocks) we trigger eviction based on capacity and evict chunks from the cache based on LRU. FIFO is even easier to implement just by not moving chunks to the front of the LRU on hit - and FIFO is age based. So if we will prefer simple age based vs access based caching, we can do that - actually we should just add this for dev/test.
For objects_md cleanup - keep in mind that even if we are limited on cache capacity and have to evict, it is still very much likely that cached object_mds have not been deleted or overwritten in the hub, so keeping them is not a bad thing at all. But we do need to evict eventually if the workload will read too many of these to the cache than we can store in the DB. Today we do not have a capacity limit for object_mds and we do not order them in LRU. However we can easily iterate object_mds in FIFO order by traversing the _id index in order or creation in the cache and then check if this object has no parts and then delete.
Ultimately I think object_md cleanup calls for a separate worker - because the iteration subject and order are completely different than tier_ttf_worker. In its own worker we should check how close we are to the object_mds limit we can store in the DB (either config or calculate based on PV), and cleanup in FIFO order.
For now I thought we can piggy back the chunks eviction, BUT adding the age condition I suggested is presenting an issue - if we evict all chunks/parts of an object but it is too young and we filter it out from objects_to_gc, we may never come back to evict more chunks for this same object_md and it will never be evicted. So I would remove the filter for now, but in any case to make it work well we need to move this to its own worker.
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.
@guptsanj Great work. See my comment above - I think removing the age filter for objects_to_gc is better, but in any case this is not a real issue and we can go ahead with this PR and improve object_md eviction in next PR.
Explain the changes
Cached chunks are evicted when a namespace bucket with cache starts to fill up.
The tier ttf worker will periodically perform the eviction.
When bucket reaches a predefined limit, entries are no longer cached
Any in transit objects/chunks are also dropped.
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: