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

thread_migrate strategy changes from random to round-robin #163

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

beef9999
Copy link
Collaborator

thread_migrate原先随机的策略有一个缺陷:当thread数量小于vcpu数量时,有一定的概率会产生多个thread堆积到某一个相同的vcpu上的情况。由于我们的thread迁移是被动的,因此一直也无法迁走。这样造成OS线程空闲,workload不均衡。

因此把random改成了round-robin。参考了没有work stealing机制的其他的库,比如cocoyaxi,用的也是rr。


The original random strategy of thread_migrate has a defect: when the number of threads is less than the number of vcpus, there is a certain probability that multiple threads will be scheduled to the same vcpu. Since our thread migration is passive, it's not likely to migrate away in the future. So this causes idle OS threads and unbalanced workload.

So changed the strategy from random to round-robin. Have referred to other libraries that have no work stealing mechanism, such as cocoyaxi. They are using rr as well.

@lihuiba lihuiba merged commit 13ec413 into alibaba:main Jul 25, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants