Skip to content
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

Add async thread pool for generating diskann cache and catch unexpected return. #226

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

cqy123456
Copy link
Collaborator

No description provided.

@sre-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cqy123456

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

mergify bot commented Nov 28, 2023

⚠️ The sha of the head commit of this PR conflicts with #215. Mergify cannot evaluate rules on this PR. ⚠️

@cqy123456 cqy123456 force-pushed the 1.x-async-pool branch 2 times, most recently from d83e056 to dd61b4b Compare November 28, 2023 08:26
Comment on lines 64 to 75
std::shared_ptr<ThreadPool>
ThreadPool::GetGlobalAsyncThreadPool() {
if (global_thread_pool_size_ == 0) {
std::lock_guard<std::mutex> lock(global_thread_pool_mutex_);
if (global_thread_pool_size_ == 0) {
global_thread_pool_size_ = std::thread::hardware_concurrency();
}
}
uint32_t async_thread_pool_size = int(std::ceil(global_thread_pool_size_ / 2.0));
LOG_KNOWHERE_WARNING_ << "async thread pool size with thread number:" << async_thread_pool_size;
static auto async_pool = std::make_shared<ThreadPool>(async_thread_pool_size);
return async_pool;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not for general purpose, we need to make a static instance in DiskANN instead of here.

@cqy123456 cqy123456 force-pushed the 1.x-async-pool branch 2 times, most recently from 19a5de0 to 90c9ada Compare November 28, 2023 10:40
@liliu-z liliu-z merged commit e61a306 into zilliztech:1.x Nov 28, 2023
4 of 5 checks passed
@liliu-z liliu-z added the lgtm label Nov 28, 2023
@liliu-z
Copy link
Collaborator

liliu-z commented Nov 28, 2023

/lgtm
/approve

@liliu-z
Copy link
Collaborator

liliu-z commented Nov 28, 2023

/kind improvement

@liliu-z
Copy link
Collaborator

liliu-z commented Nov 28, 2023

Note: This PR is to solve slow loading time for DiskANN. It lets segments use a shared global threadpool to make cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants