-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lianxuechao
committed
Nov 26, 2024
1 parent
768c9b9
commit a4c4ba1
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1057,6 +1057,26 @@ Protobuf arena是一种Protobuf message内存管理机制,有着提高内存 | |
|
||
注意:从Protobuf v3.14.0开始,[默认开启arena](https://github.com/protocolbuffers/protobuf/releases/tag/v3.14.0https://github.com/protocolbuffers/protobuf/releases/tag/v3.14.0)。但是Protobuf v3.14.0之前的版本,用户需要再proto文件中加上选项:`option cc_enable_arenas = true;`,所以为了兼容性,可以统一都加上该选项。 | ||
|
||
## server端忽略eovercrowded | ||
### server级别忽略eovercrowded | ||
设置ServerOptions.ignore_eovercrowded,默认值0代表不忽略 | ||
|
||
### method级别忽略eovercrowded | ||
server.IgnoreEovercrowdedOf("...") = ...可设置method级别的ignore_eovercrowded。也可以通过设置ServerOptions.ignore_eovercrowded一次性为所有的method设置忽略eovercrowded。 | ||
|
||
```c++ | ||
ServerOptions.ignore_eovercrowded = true; // Set the default ignore_eovercrowded for all methods | ||
server.IgnoreEovercrowdedOf("example.EchoService.Echo") = true; | ||
server.IgnoreEovercrowdedOf("example.EchoService", "Echo") = true; | ||
server.IgnoreEovercrowdedOf(&service, "Echo") = true; | ||
``` | ||
|
||
此设置一般**发生在AddService后,server启动前**。当设置失败时(比如对应的method不存在),server会启动失败同时提示用户修正IgnoreEovercrowdedOf设置错误。 | ||
|
||
当ServerOptions.ignore_eovercrowded和server.IgnoreEovercrowdedOf("...")=...同时被设置时,任何一个设置为true,就表示会忽略eovercrowded。 | ||
|
||
注意:没有service级别的ignore_eovercrowded。 | ||
|
||
# FAQ | ||
|
||
### Q: Fail to write into fd=1865 [email protected]:54742@8230: Got EOF是什么意思 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1051,6 +1051,28 @@ Users can set `ServerOptions.rpc_pb_message_factory = brpc::GetArenaRpcPBMessage | |
|
||
Note: Since Protocol Buffers v3.14.0, Arenas are now unconditionally enabled. However, for versions prior to Protobuf v3.14.0, users need to add the option `option cc_enable_arenas = true;` to the proto file. so for compatibility, this option can be added uniformly. | ||
|
||
## Ignoring eovercrowded on server-side | ||
### Ignore eovercrowded on server-level | ||
|
||
Set ServerOptions.ignore_eovercrowded. Default value is 0 which means not ignored. | ||
|
||
### Ignore eovercrowded on method-level | ||
|
||
server.IgnoreEovercrowdedOf("...") = … sets ignore_eovercrowded of the method. Possible settings: | ||
|
||
```c++ | ||
ServerOptions.ignore_eovercrowded = true; // Set the default ignore_eovercrowded for all methods | ||
server.IgnoreEovercrowdedOf("example.EchoService.Echo") = true; | ||
server.IgnoreEovercrowdedOf("example.EchoService", "Echo") = true; | ||
server.IgnoreEovercrowdedOf(&service, "Echo") = true; | ||
``` | ||
|
||
The code is generally put **after AddService, before Start() of the server**. When a setting fails(namely the method does not exist), server will fail to start and notify user to fix settings on IgnoreEovercrowdedOf. | ||
|
||
When method-level and server-level ignore_eovercrowded are both set, if any one of them is set to true, eovercrowded will be ignored. | ||
|
||
NOTE: No service-level ignore_eovercrowded. | ||
|
||
# FAQ | ||
|
||
### Q: Fail to write into fd=1865 [email protected]:54742@8230: Got EOF | ||
|