-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feature] Supports bthread scanner #16031
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
Conversation
|
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
| PriorityThreadPool* _io_thread_pool = nullptr; | ||
| PriorityThreadPool* _remote_thread_pool = nullptr; | ||
|
|
||
| private: |
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: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
| private: |
be/src/util/async_io.h:79: previously declared here
private:
^| if (!_has_called.load(std::memory_order_acquire)) { | ||
| do { | ||
| std::lock_guard l(_mutex); | ||
| if (_has_called.load(std::memory_order_acquire)) break; |
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: statement should be inside braces [readability-braces-around-statements]
| if (_has_called.load(std::memory_order_acquire)) break; | |
| if (_has_called.load(std::memory_order_acquire)) { break; | |
| } |
| // Blocks until the work queue is empty, and then calls shutdown to stop the worker | ||
| // threads and Join to wait until they are finished. | ||
| // Any work Offer()'ed during DrainAndshutdown may or may not be processed. | ||
| void drain_and_shutdown() override { |
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: only virtual member functions can be marked 'override' [clang-diagnostic-error]
| void drain_and_shutdown() override { | |
| void drain_and_shutdown() { |
| void drain_and_shutdown() override { | ||
| { | ||
| std::unique_lock<std::mutex> l(_lock); | ||
| std::unique_lock l(_lock); |
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 of undeclared identifier '_lock'; did you mean 'clock'? [clang-diagnostic-error]
| std::unique_lock l(_lock); | |
| std::unique_lock l(clock); |
/usr/include/time.h:71: 'clock' declared here
extern clock_t clock (void) __THROW;
^| std::unique_lock<std::mutex> l(_lock); | ||
| std::unique_lock l(_lock); | ||
| while (get_queue_size() != 0) { | ||
| _empty_cv.wait(l); |
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 of undeclared identifier '_empty_cv' [clang-diagnostic-error]
_empty_cv.wait(l);
^|
TeamCity pipeline, clickbench performance test result: |
|
|
LGTM |
gavinchou
left a comment
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
128c4d0 to
eecbcde
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.
clang-tidy made some suggestions
be/src/io/fs/file_system_map.h
Outdated
| static FileSystemMap* instance(); | ||
| ~FileSystemMap() = default; | ||
|
|
||
| void insert(ResourceId id, FileSystemSPtr fs); |
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: unknown type name 'ResourceId' [clang-diagnostic-error]
void insert(ResourceId id, FileSystemSPtr fs);
^
be/src/io/fs/file_system_map.h
Outdated
| void insert(ResourceId id, FileSystemSPtr fs); | ||
|
|
||
| // If `id` is not in `_map`, return nullptr. | ||
| FileSystemSPtr get(const ResourceId& id); |
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: unknown type name 'ResourceId' [clang-diagnostic-error]
FileSystemSPtr get(const ResourceId& id);
^
be/src/io/fs/file_system_map.h
Outdated
| private: | ||
| FileSystemMap() = default; | ||
|
|
||
| private: |
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: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
| private: |
be/src/io/fs/file_system_map.h:39: previously declared here
private:
^
be/src/io/fs/file_system_map.h
Outdated
|
|
||
| private: | ||
| doris::SharedMutex _mu; | ||
| std::unordered_map<ResourceId, FileSystemSPtr> _map; // GUARED_BY(_mu) |
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 of undeclared identifier 'ResourceId' [clang-diagnostic-error]
std::unordered_map<ResourceId, FileSystemSPtr> _map; // GUARED_BY(_mu)
^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
| PriorityThreadPool* _io_thread_pool = nullptr; | ||
| PriorityThreadPool* _remote_thread_pool = nullptr; | ||
|
|
||
| private: |
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: redundant access specifier has the same accessibility as the previous access specifier [readability-redundant-access-specifiers]
| private: |
be/src/util/async_io.h:96: previously declared here
private:
^|
PR approved by anyone and no changes requested. |
dataroaring
left a comment
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
|
PR approved by at least one committer and no changes requested. |
Proposed changes
Issue Number: close #xxx
Problem summary
Add bthread to separate the logic of IO and computation when executing the OlapScanner, which can speed up to access those sql that are already cached.
Performance test
ssbf100 benchmark
The performance of using bthread and using pthread is almost the same.
cached read
Description: First execute q1.1.sql to cache data, and then execute q1.1.sql、q2.1.sql and q4.1.sql concurrently.
When using bthread, If the data of sql has been cached, the result of sql can be returned fast without waiting the free thread of thread pool.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...