You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/07/26 09:44:13 UTC

[GitHub] [incubator-brpc] jiangdongzi opened a new issue, #1859: Why switch bthread cost so much time? (2us), both libgo and golang coroutine switch cost ~200ns?

jiangdongzi opened a new issue, #1859:
URL: https://github.com/apache/incubator-brpc/issues/1859

   They also support work stealing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] wwbmmm closed issue #1859: Why switch bthread cost so much time? (2us), both libgo and golang coroutine switch cost ~200ns?

Posted by GitBox <gi...@apache.org>.
wwbmmm closed issue #1859: Why switch bthread cost so much time? (2us), both libgo and golang coroutine switch  cost  ~200ns?
URL: https://github.com/apache/incubator-brpc/issues/1859


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] wwbmmm commented on issue #1859: Why switch bthread cost so much time? (2us), both libgo and golang coroutine switch cost ~200ns?

Posted by GitBox <gi...@apache.org>.
wwbmmm commented on issue #1859:
URL: https://github.com/apache/incubator-brpc/issues/1859#issuecomment-1201083002

   The work stealing in libgo is implemented by a global scheduler:
   https://github.com/yyzybb537/libgo/blob/master/libgo/scheduler/scheduler.cpp#L340
   It runs work stealing at an interval of 1000us by default. 
   When a task is ready to run but current worker is busy, it needs at most 1000us to be stolen by an idle worker.
   
   In bthread, when a task is ready to run, futex_wake is called to wakeup an idle worker at once. This avoids long-tail latency. But the cost is that most task switch needs futex. It needs about 2us from one thread calls futex_wake and another thread resumes from futex_wait.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org