-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[core]Make GCS InternalKV workload configurable to the Policy. #47736
Open
rynewang
wants to merge
18
commits into
ray-project:master
Choose a base branch
from
rynewang:dedicated-kv-ioctx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+80
−42
Open
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
bcf81c8
dedicated kv ioctx
rynewang c84fd80
move gcs_table_storage_ back to main service.
rynewang a021521
Merge branch 'master' into dedicated-kv-ioctx
rynewang 5d8eaee
Merge branch 'master' into dedicated-kv-ioctx
rynewang 36fc808
fix cpp test
rynewang a87c39d
fix atomics now that we have multiple thread reads...
rynewang 7cd7705
atomics
rynewang bbf02cd
fix
rynewang 99f7ba9
size_t -> int for proto
rynewang a1ab6c6
fix atomics in periodical_runner
rynewang cf3f343
update doc
rynewang 6d006e9
stopped -> shared_ptr<atomic<bool>>
rynewang 110ae3e
rename
rynewang 3d5e7f0
Merge remote-tracking branch 'origin/master' into dedicated-kv-ioctx
rynewang 3461330
fit lint
rynewang 4ade4af
Merge remote-tracking branch 'origin/master' into dedicated-kv-ioctx
rynewang a607528
type traits and policy for kv
rynewang 698cbe9
remove temp code
rynewang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
namespace ray { | ||
|
||
PeriodicalRunner::PeriodicalRunner(instrumented_io_context &io_service) | ||
: io_service_(io_service), mutex_(), stopped_(std::make_shared<bool>(false)) {} | ||
: io_service_(io_service) {} | ||
|
||
PeriodicalRunner::~PeriodicalRunner() { | ||
RAY_LOG(DEBUG) << "PeriodicalRunner is destructed"; | ||
|
@@ -29,7 +29,7 @@ PeriodicalRunner::~PeriodicalRunner() { | |
|
||
void PeriodicalRunner::Clear() { | ||
absl::MutexLock lock(&mutex_); | ||
*stopped_ = true; | ||
stopped_ = true; | ||
for (const auto &timer : timers_) { | ||
timer->cancel(); | ||
} | ||
|
@@ -38,22 +38,17 @@ void PeriodicalRunner::Clear() { | |
|
||
void PeriodicalRunner::RunFnPeriodically(std::function<void()> fn, | ||
uint64_t period_ms, | ||
const std::string name) { | ||
*stopped_ = false; | ||
const std::string &name) { | ||
stopped_ = false; | ||
if (period_ms > 0) { | ||
auto timer = std::make_shared<boost::asio::deadline_timer>(io_service_); | ||
{ | ||
absl::MutexLock lock(&mutex_); | ||
timers_.push_back(timer); | ||
} | ||
io_service_.post( | ||
[this, | ||
stopped = stopped_, | ||
fn = std::move(fn), | ||
period_ms, | ||
name, | ||
timer = std::move(timer)]() { | ||
if (*stopped) { | ||
[this, fn = std::move(fn), period_ms, name, timer = std::move(timer)]() { | ||
if (this->stopped_) { | ||
return; | ||
} | ||
if (RayConfig::instance().event_stats()) { | ||
|
@@ -74,28 +69,27 @@ void PeriodicalRunner::DoRunFnPeriodically( | |
fn(); | ||
absl::MutexLock lock(&mutex_); | ||
timer->expires_from_now(period); | ||
timer->async_wait( | ||
[this, stopped = stopped_, fn = std::move(fn), period, timer = std::move(timer)]( | ||
const boost::system::error_code &error) { | ||
if (*stopped) { | ||
return; | ||
} | ||
if (error == boost::asio::error::operation_aborted) { | ||
// `operation_aborted` is set when `timer` is canceled or destroyed. | ||
// The Monitor lifetime may be short than the object who use it. (e.g. | ||
// gcs_server) | ||
return; | ||
} | ||
RAY_CHECK(!error) << error.message(); | ||
DoRunFnPeriodically(fn, period, timer); | ||
}); | ||
timer->async_wait([this, fn, period, timer = std::move(timer)]( | ||
const boost::system::error_code &error) { | ||
if (stopped_) { | ||
return; | ||
} | ||
if (error == boost::asio::error::operation_aborted) { | ||
// `operation_aborted` is set when `timer` is canceled or destroyed. | ||
// The Monitor lifetime may be short than the object who use it. (e.g. | ||
// gcs_server) | ||
return; | ||
} | ||
RAY_CHECK(!error) << error.message(); | ||
DoRunFnPeriodically(fn, period, timer); | ||
}); | ||
} | ||
|
||
void PeriodicalRunner::DoRunFnPeriodicallyInstrumented( | ||
const std::function<void()> &fn, | ||
boost::posix_time::milliseconds period, | ||
std::shared_ptr<boost::asio::deadline_timer> timer, | ||
const std::string name) { | ||
const std::string &name) { | ||
fn(); | ||
absl::MutexLock lock(&mutex_); | ||
timer->expires_from_now(period); | ||
|
@@ -104,24 +98,17 @@ void PeriodicalRunner::DoRunFnPeriodicallyInstrumented( | |
// event loop. | ||
auto stats_handle = io_service_.stats().RecordStart(name, period.total_nanoseconds()); | ||
timer->async_wait([this, | ||
fn = std::move(fn), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why removing move? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because that fn move did not work, because fn is a const& and move is no-op. |
||
stopped = stopped_, | ||
fn, | ||
period, | ||
timer = std::move(timer), | ||
stats_handle = std::move(stats_handle), | ||
name](const boost::system::error_code &error) { | ||
if (*stopped) { | ||
if (this->stopped_) { | ||
return; | ||
} | ||
io_service_.stats().RecordExecution( | ||
[this, | ||
stopped = stopped_, | ||
fn = std::move(fn), | ||
error, | ||
period, | ||
timer = std::move(timer), | ||
name]() { | ||
if (*stopped) { | ||
[this, fn, error, period, timer, name]() { | ||
if (this->stopped_) { | ||
return; | ||
} | ||
if (error == boost::asio::error::operation_aborted) { | ||
|
@@ -133,7 +120,7 @@ void PeriodicalRunner::DoRunFnPeriodicallyInstrumented( | |
RAY_CHECK(!error) << error.message(); | ||
DoRunFnPeriodicallyInstrumented(fn, period, timer, name); | ||
}, | ||
std::move(stats_handle)); | ||
stats_handle); | ||
}); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 be IO instead of Io? lol