Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
009b57c2
Commit
009b57c2
authored
Aug 16, 2018
by
TousakaRin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add doc for auto_concurrency_limiter
parent
6c220435
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
auto_concurrency_limiter.md
docs/cn/auto_concurrency_limiter.md
+0
-0
server.md
docs/cn/server.md
+13
-2
server.md
docs/en/server.md
+0
-2
No files found.
docs/cn/auto_concurrency_limiter.md
0 → 100644
View file @
009b57c2
This diff is collapsed.
Click to expand it.
docs/cn/server.md
View file @
009b57c2
...
@@ -587,8 +587,6 @@ QPS是一个秒级的指标,无法很好地控制瞬间的流量爆发。而
...
@@ -587,8 +587,6 @@ QPS是一个秒级的指标,无法很好地控制瞬间的流量爆发。而
设置ServerOptions.max_concurrency,默认值0代表不限制。访问内置服务不受此选项限制。
设置ServerOptions.max_concurrency,默认值0代表不限制。访问内置服务不受此选项限制。
Server.ResetMaxConcurrency()可在server启动后动态修改server级别的max_concurrency。
### 限制method级别并发度
### 限制method级别并发度
server.MaxConcurrencyOf("...") = ...可设置method级别的max_concurrency。可能的设置方法有:
server.MaxConcurrencyOf("...") = ...可设置method级别的max_concurrency。可能的设置方法有:
...
@@ -605,6 +603,19 @@ server.MaxConcurrencyOf(&service, "Echo") = 10;
...
@@ -605,6 +603,19 @@ server.MaxConcurrencyOf(&service, "Echo") = 10;
注意:没有service级别的max_concurrency。
注意:没有service级别的max_concurrency。
### 使用自适应限流算法
实际生产环境中,最大并发并不一定是一成不变的。这个时候可以在Server级别使用自适应限流算法,同时将Method级别设置为不限制并发(即默认值):
```
c++
brpc::Server server;
brpc::ServerOptions options;
options.max_concurrency = "auto"; // auto concurrency limiter
```
使用自适应限流的算法需要保证:
1. 客户端开启了重试
2. 服务端有多个节点,当一个节点返回过载时,客户端可以向其他节点发起重试
更多细节可以看[这里]()
## pthread模式
## pthread模式
用户代码(客户端的done,服务器端的CallMethod)默认在栈为1MB的bthread中运行。但有些用户代码无法在bthread中运行,比如:
用户代码(客户端的done,服务器端的CallMethod)默认在栈为1MB的bthread中运行。但有些用户代码无法在bthread中运行,比如:
...
...
docs/en/server.md
View file @
009b57c2
...
@@ -588,8 +588,6 @@ PeakQPS and AverageLatency are queries-per-second and latencies measured in a se
...
@@ -588,8 +588,6 @@ PeakQPS and AverageLatency are queries-per-second and latencies measured in a se
Set ServerOptions.max_concurrency. Default value is 0 which means not limited. Accesses to builtin services are not limited by this option.
Set ServerOptions.max_concurrency. Default value is 0 which means not limited. Accesses to builtin services are not limited by this option.
Call Server.ResetMaxConcurrency() to modify max_concurrency of the server after starting.
### Limit method-level concurrency
### Limit method-level concurrency
server.MaxConcurrencyOf("...") = … sets max_concurrency of the method. Possible settings:
server.MaxConcurrencyOf("...") = … sets max_concurrency of the method. Possible settings:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment