apache / apache/brpc

多次调用能使server用同一个线程处理么?

Open
#2,203 6 comments 0 reactions 0 assignees View on GitHub
usage
Dominant language
C++
Stars
17.6k
Forks
4.1k
Avg merge
2d 12h
Merged PRs (30d)
69

Description

**Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)**
是否有办法使得server端处理client请求的时候,始终使用的是同一个线程,也就是调用bthread_self()返回的值保持不变

我这边现在有需求依赖上下文(是另外一个lib提供的),如果不同请求的线程切换了,上下文信息就丢失了,后续请求都会失败
上下文对我这边调用是黑盒的,无法直接干预,只能通过保障我这边线程不切换

或者是否能指定一个单线程的线程池来提供服务?

Contributor guide

Open the contributing guide

Research direction

Start from the server request-processing and bthread scheduling behavior described in the issue, focusing on whether repeated client calls can retain the same bthread_self() value or use a single-thread pool. Determine the supported approach, if any, and document the behavior and limitations for callers that depend on thread-local context.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.