-
Notifications
You must be signed in to change notification settings - Fork 526
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
Curvefs: enable async read for FileCacheManager::ReadKVRequest
#2421
Conversation
cicheck |
1 similar comment
cicheck |
cicheck |
cicheck |
cicheck |
|
||
// read from kv cluster (localcache -> remote kv cluster -> s3) | ||
// localcache/remote kv cluster fail will not return error code. | ||
// Failure to read from s3 will eventually return failure. | ||
int ret = ReadKVRequest(kvRequest, dataBuf, inodeWrapper->GetLength()); | ||
int ret = ReadKVRequest(kvRequests, dataBuf, inodeWrapper->GetLength()); |
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.
Declare the return value of ReadKVRequest
as an enum here? @ilixiaocui
kvClientManager_(std::move(kvClientManager)) {} | ||
FileCacheManager() {} | ||
kvClientManager_(std::move(kvClientManager)) { | ||
readTaskPool_.Start(4); |
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.
let it configurable?
uint64_t fileLen, | ||
std::once_flag &cancelFlag, | ||
std::atomic<bool> &isCanceled, | ||
std::atomic<int> &ret) { |
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.
forget set ret?
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.
It will be set when read from s3 failed.
auto defer = absl::MakeCleanup([&]() { counter.DecrementCount(); }); | ||
if (isCanceled) { | ||
LOG(WARNING) << "kv request is canceled " << req.DebugString(); | ||
return; |
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 need retry in FileCacheManager::Read
, so if its failed here, we need return a meaningful value
FileCacheManager::ProcessKVRequest
FileCacheManager::ReadKVRequest
cicheck |
cicheck |
cicheck |
cicheck |
851ed2f
to
6f50947
Compare
cicheck |
unittest run timeout, you can run it in you testing environment and look why |
cicheck |
@wuhongsong @ilixiaocui Mind take a look? |
const std::vector<S3ReadRequest> &kvRequests, char *dataBuf, | ||
uint64_t fileLen) { | ||
readTaskPool_.Start(readCacheThreads_); |
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.
maybe the thread pool shouldn't be in FileCacheManager
, If a large number of files are read at the same time, the number of threads can get out of hand?
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.
Maybe bthread can work? Bthread is an M:N thread, multiple Bthreads can be declared in the same Read thread
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.
Maybe bthread can work? Bthread is an M:N thread, multiple Bthreads can be declared in the same Read thread
sorry, I don't think it's a good way, we just need a configurable number of threads, so i think move the thread pool toFsCacheManager
maybe better?
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.
Do you mean that all FileCacheManager
share a thread pool?
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.
Do you mean that all
FileCacheManager
share a thread pool?
yes
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'll try it :)
cicheck |
cicheck |
1 similar comment
cicheck |
cicheck |
1 similar comment
cicheck |
|
||
ReadStatus st = ReadStatus::OK; | ||
if (retCode.load() < 0) { | ||
st = retCode.load() == -2 ? ReadStatus::S3_NOT_EXIST |
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.
It is recommended to encapsulate a function like ReadStatus ToReadStatus(int ret)
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 idea!
|
||
// prefetch | ||
if (s3ClientAdaptor_->HasDiskCache()) { |
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.
Why delete Prefetch()
?
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.
Prefetch()
locate at line 583.
Signed-off-by: Ziy1-Tan <ajb459684460@gmail.com>
cicheck |
What problem does this PR solve?
Issue Number: #2070
Problem Summary:
FileCacheManager::ProcessKVRequest
processes kvRequests one by one, maybe we can increase the concurrencyWhat is changed and how it works?
What's Changed:
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List