-
Notifications
You must be signed in to change notification settings - Fork 456
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
pageserver: avoid incrementing access time when reading layers for compaction #4971
Conversation
...and implement a RequestContextBuilder so that as we add such fields, we do not have to keep adding args to RequestContext::new and updating all call sites.
1588 tests run: 1510 passed, 0 failed, 78 skipped (full report)The comment gets automatically updated with the latest test results
d2bf8f5 at 2023-08-14T08:19:19.339Z :recycle: |
00a7a66
to
f2d0acb
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.
I think this could just be an if in DeltaLayer::load
in
neon/pageserver/src/tenant/storage_layer/delta_layer.rs
Lines 455 to 456 in d39fd66
self.access_stats | |
.record_access(access_kind, ctx.task_kind()); |
Like:
if access_kind != AccessKind::CreateImageLayers {
self.access_stats.record_access(access_kind, ctx.task_kind());
}
After this PR, we could already try 1TB import in staging to see if any needle is moved.
I don't think a LayerAccessKind variant works for this. The reads in I'd also not want to make this behavior specific to delta layer, because image layer generation will also depend on reading earlier image layers, where we'd also like to avoid updating their access times. |
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.
My bad for not giving this a more thorough look last friday. Approved with getting rid of "atime" mention just not to confuse with the fs level information which we explicitly ended up not using.
Co-authored-by: Joonas Koivunen <joonas@neon.tech>
Added a commit that tweaks the names to avoid potential confusion around filesystem atime vs out internal access stats. |
Problem
Currently, image generation reads delta layers before writing out subsequent image layers, which updates the access time of the delta layers and effectively puts them at the back of the queue for eviction. This is the opposite of what we want, because after a delta layer is covered by a later image layer, it's likely that subsequent reads of latest data will hit the image rather than the delta layer, so the delta layer should be quite a good candidate for eviction.
Summary of changes
RequestContext
gets a newATimeBehavior
field, and aRequestContextBuilder
helper so that we can optionally add the new field without growingRequestContext::new
every time we add something like this.Request context is passed into the
record_access
function, and the access time is not updated ifATimeBehavior::Skip
is set.The compaction background task constructs its request context with this skip policy.
Closes: #4969
Checklist before requesting a review
Checklist before merging