-
Notifications
You must be signed in to change notification settings - Fork 463
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
lots of time wasted on count_deltas()
#6861
Comments
…ove backwards This PR enforces aspects of `Timeline::repartition` that were already true at runtime: - it's not called concurrently, so, bail out if it is anyway (see comment why it's not called concurrently) - the `lsn` should never be moving backwards over the lifetime of a Timeline object, because last_record_lsn() can only move forwards over the lifetime of a Timeline object part of #6861
It's been dead-code-at-runtime for 9 months, let's remove it. We can always re-introduce it at a later point. Came across this while working on #6861, which will touch `time_for_new_image_layer`. This is an opporunity to make that function simpler.
The new compaction code in #6830 no longer calls |
Yeah, aware, @arpad-m is going to work on compaction, but, it'll be many more weeks until it lands, I think. |
It's been dead-code-at-runtime for 9 months, let's remove it. We can always re-introduce it at a later point. Came across this while working on #6861, which will touch `time_for_new_image_layer`. This is an opporunity to make that function simpler.
…e backwards (#6862) This PR enforces aspects of `Timeline::repartition` that were already true at runtime: - it's not called concurrently, so, bail out if it is anyway (see comment why it's not called concurrently) - the `lsn` should never be moving backwards over the lifetime of a Timeline object, because last_record_lsn() can only move forwards over the lifetime of a Timeline object The switch to tokio::sync::Mutex blows up the size of the `partitioning` field from 40 bytes to 72 bytes on Linux x86_64. That would be concerning if it was a hot field, but, `partitioning` is only accessed every 20s by one task, so, there won't be excessive cache pain on it. (It still sucks that it's now >1 cache line, but I need the Send-able MutexGuard in the next PR) part of #6861
@VladLazar just in case you didn't see it, my PR to avoid Feel free to take it over |
Update:
|
Looks like #7230 helped here. Generated another flamegraph this morning and it's not exhibiting the original issue: (ask me if you want the svg - can't add it here for some reason) |
Problem
original thread: https://neondb.slack.com/archives/C033RQ5SPDH/p1708513450565049
Now that the flamegraphs are fixed, I took one on ps-2 ap-southeast-1 to investigate the elevanted CPU usage after enabling tokio-epoll-uring there.
That investigation isn't the subject of this thread though, but, the general finding of where that PS is spending its time.
LayerMap::count_deltas
inside time_for_new_image_layer completely dominates the CPU usage there.AFAICT that is called for every tenant, even if the layer map hasn't changed.
This is wasteful.
Solution
If the layer map and partitioning is the same as in an earlier call, early-exit in
time_for_new_image_layer
to avoid the call tocount_deltas()
.Tasks
Tasks
gc_feedback
mechanism #6863count_deltas()
call if nothing changed #6868The text was updated successfully, but these errors were encountered: