HTTP协议下,当返回数据较大时,reponse发送延迟极大且并行请求会一起堵塞很久
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- backend-api-design, networking, performance
Research direction
Start by reproducing the HTTP server case using the shown response_attachment() and http_response() calls with 100 MB and 1 GB values. Compare one request with 50 concurrent requests on the stated Ubuntu, GCC, and brpc versions, recording server-side and client-observed timings. Done means the cause of the delayed or blocked responses is identified and the large-response behavior is measurably improved or clearly documented.
Written by the indexing model from the issue text.
Description
Describe the bug (描述bug)
HTTP协议的server下,如果请求返回的数据较大时,数据返回延迟过高(不是rpc方法延迟,方法内无阻塞,延迟经测试很低)。返回数据100mb时,并行50个请求需要等到很久后(45s)同时发出的请求才会陆续收到回报,显著慢于只打一个请求(1.3s), 单个请求返回1GB时耗时10s显著慢于网卡的吞吐
To Reproduce (复现方法)
http协议的server返回内容如下,value为大小为100MB或1GB的字符串
std::string value(1024*1024*100, 'a');
cntl->http_response().set_status_code(200);
cntl->http_response().set_content_type("text/plain");
cntl->response_attachment().append(value.c_str(), value.length());
打http请求
Expected behavior (期望行为)
当并发50个http请求,返回value为100MB时,50个请求在发出请求45秒后统一陆续返回。如果只有一个请求,返回value 100MB只需要1.3s。
一次请求,如果返回value为1GB,leave method耗时要10多s(不考虑rpc方法内的时间),请求端很久收到返回,延迟过高。
Versions (各种版本)
OS: ubuntu20
Compiler: gcc13
brpc: 1.11.0
protobuf: 3.21.12
Additional context/screenshots (更多上下文/截图)
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.2k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 72
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/brpc
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
endpoint2hostname() prints a byte-swapped port for IPv6 endpointsPossibly taken @0z5a claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
perf(butil): ARM64 (aarch64) performance and modernisation improvements across atomics, CRC32C, spin-wait hints, and fast timersPossibly taken @jimmystewpot claimed this 2 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 12/100
Maintainers usually reply within 2 days
-
file:// naming service takes a comment after the address as the tagPossibly taken @0z5a claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 2 days
Similar issues
-
agent:Windows bug in progress pri:medium sev:low testing windows
Difficulty 1/5 Under an hour Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
protocolbuffers/protobuf#31768 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
godotengine/godot#125651 ·
Maintainers usually reply within 1 day
-
Android: with view recycling on, a recycled View keeps its nextFocusLeftPossibly taken A pull request linked to this issue is open or already merged. OpenNeeds: Triage :mag: Platform: Android
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
react/react-native#60167 ·
Maintainers usually reply within 2 days
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 63/100