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

Basics- pthread mode description is ambiguous #160

Open
jiazhanfeng1989 opened this issue Aug 25, 2023 · 2 comments
Open

Basics- pthread mode description is ambiguous #160

jiazhanfeng1989 opened this issue Aug 25, 2023 · 2 comments

Comments

@jiazhanfeng1989
Copy link

jiazhanfeng1989 commented Aug 25, 2023

https://brpc.apache.org/docs/server/basics/#pthread-mode

User code(client-side done, server-side CallMethod) runs in bthreads with 1MB stacksize by default. But some of them cannot run in bthreads:

......
brpc offers pthread mode to solve the issues. When -usercode_in_pthread is turned on, user code will be run in pthreads. Functions that would block bthreads block pthreads.

Note: With -usercode_in_pthread on, brpc::thread_local_data() does not guarantee to return valid value.

Performance issues when pthread mode is on:
.....

User code still runs in special bthreads actually, which use stacks of pthread workers. These special bthreads are scheduled same with normal bthreads and performance differences are negligible.

@jiazhanfeng1989
Copy link
Author

when -usercode_in_pthread enable, which thread is used and schedule is what?

@Huixxi
Copy link
Contributor

Huixxi commented Oct 9, 2023

when -usercode_in_pthread enable, which thread is used and schedule is what?

pthread

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

No branches or pull requests

2 participants