-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[enhancement](cloud) optimize block cache lock #41818
Conversation
freemandealer
commented
Oct 14, 2024
•
edited by gavinchou
Loading
edited by gavinchou
- async deletion when do stale rowsets reclycle
- minimize lock critical size
- add cache lock held & wait time info for debug
1. async deletion when do stale rowsets reclycle 2. minimize lock critical size 3. add cache lock held & wait time info for debug Signed-off-by: freemandealer <[email protected]>
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
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.
clang-tidy made some suggestions
@@ -19,6 +19,7 @@ | |||
|
|||
#include <bvar/bvar.h> |
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.
warning: 'bvar/bvar.h' file not found [clang-diagnostic-error]
#include <bvar/bvar.h>
^
be/src/io/cache/block_file_cache.h
Outdated
template <class Lock> | ||
concept IsXLock = std::same_as<Lock, std::lock_guard<std::mutex>> || | ||
std::same_as<Lock, std::unique_lock<std::mutex>>; | ||
|
||
class FSFileCacheStorage; | ||
|
||
class LockScopedTimer { | ||
public: | ||
LockScopedTimer() : start_(std::chrono::high_resolution_clock::now()) {} |
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.
warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]
LockScopedTimer() : start_(std::chrono::high_resolution_clock::now()) {} | |
LockScopedTimer() : start_(std::chrono::high_resolution_clock::now()) = default; |
Signed-off-by: freemandealer <[email protected]>
run buildall |
1 similar comment
run buildall |
9e44e1e
to
1981d93
Compare
Signed-off-by: freemandealer <[email protected]>
1981d93
to
384b29d
Compare
run buildall |
Signed-off-by: freemandealer <[email protected]>
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.
clang-tidy made some suggestions
template <class Lock> | ||
concept IsXLock = std::same_as<Lock, std::lock_guard<std::mutex>> || | ||
std::same_as<Lock, std::unique_lock<std::mutex>>; | ||
|
||
class FSFileCacheStorage; | ||
|
||
class LockScopedTimer { | ||
public: | ||
LockScopedTimer() : start_(std::chrono::steady_clock::now()) {} |
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.
warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]
LockScopedTimer() : start_(std::chrono::steady_clock::now()) {} | |
LockScopedTimer() : start_(std::chrono::steady_clock::now()) = default; |
run buildall |
TeamCity be ut coverage result: |
std::chrono::duration_cast<std::chrono::milliseconds>(acq_time - start_time).count(); \ | ||
if (duration > config::cache_lock_long_tail_threshold) \ | ||
LOG(WARNING) << "Lock wait time " << std::to_string(duration) << "ms. " \ | ||
<< get_stack_trace_by_boost() << std::endl; \ |
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.
We should limit frequency of the log.
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.
@dataroaring It is limited already: only > config::cache_lock_long_tail_threshold (default:1s) will print the log. If not enough, enlarge the threshold.
run cloud_p0 |
run buildall |
TeamCity be ut coverage result: |
while (_recycle_keys->pop(key)) { | ||
Status st = _storage->remove(key); | ||
if (!st.ok()) { | ||
LOG_WARNING("").error(st); |
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.
put some key word in the log e.g.
"failed to remove when recycle_stale_rowset_async_bottom_half, key = {}" ...
LOG_WARNING("Failed to push recycle key to queue, do it synchronously"); | ||
Status st = _storage->remove(key); | ||
if (!st.ok()) { | ||
LOG_WARNING("").error(st); |
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.
put some key word in the log e.g.
"failed to remove async, key = {}" ...
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
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.
LGTM
1. async deletion when do stale rowsets reclycle 2. minimize lock critical size 3. add cache lock held & wait time info for debug
pick apache#41818 from master 1. async deletion when do stale rowsets reclycle 2. minimize lock critical size 3. add cache lock held & wait time info for debug
…#43401) pick apache#41818 from master 1. async deletion when do stale rowsets reclycle 2. minimize lock critical size 3. add cache lock held & wait time info for debug