forked from fagongzi/manba
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
3d427aa
commit ffdfa49
Showing
2 changed files
with
54 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Optimization | ||
Gateway网关在使用的时候有一些地方需要做一些优化,以便达到更好的性能。这里给出一些优化配置的意见。 | ||
|
||
### Docker | ||
在使用docker启动`Proxy`镜像的时候,由于默认的镜像的`somaxconn`是默认值`128`,docker 启动的时候加上如下参数: | ||
```bash | ||
docker run -d --rm --sysctl net.core.somaxconn=你期望的值 fagongzi/proxy | ||
``` | ||
|
||
### Keepalive | ||
Proxy默认回启用Keepalive来保持和后端服务的链接,这里有2个重要的启动参数: | ||
* limit-conn-keepalive 链接最大Keepalive保持的时间 | ||
* limit-conn-idle 链接最大的空闲时间,超过这个时间,Proxy会主动关闭这个连接 | ||
|
||
建议配置: `后端服务的Keepalive时间 > limit-conn-keepalive > 2*limit-conn-idle` | ||
|
||
### limit-dispatch | ||
这个参数是用来设置`聚合`请求的工作协程池的个数,当系统中有`聚合`请求,可以适当调大这个值来提升`聚合`请求的吞吐。 | ||
|
||
### limit-copy | ||
这个参数是用来设置`Copy流量`流量的工作协程池的个数,当系统中有`Copy流量`流量的场景,可以适当调大这个值来提升`Copy流量`的吞吐。 | ||
|
||
### limit-conn | ||
这个参数是用来控制`Proxy`与每个后端建立的最大链接数,如果发现某个后端Server的并发非常高,延迟较大,有可能时间花费了等待空闲链接的操作上,可以适当调大这个值。 | ||
|
||
### limit-caching | ||
这个参数控制单个`Proxy`使用多少内存来做缓存,如果`Proxy`中的API开启了缓存,那么可以通过这个参数控制缓存大小。 |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Optimization | ||
There are some places where the Gateway Gateway needs to be optimized to achieve better performance. Here are some suggestions for optimizing the configuration. | ||
|
||
### Docker | ||
When using docker to start the `Proxy` image, since the default image `somaxconn` is the default value of `128`, the docker starts with the following parameters: | ||
```bash | ||
Docker run -d --rm --sysctl net.core.somaxconn=The value you expect fagongzi/proxy | ||
``` | ||
|
||
### Keepalive | ||
Proxy defaults to enabling Keepalive to maintain links to backend services. There are 2 important startup parameters: | ||
* limit-conn-keepalive link maximum keepalive time | ||
* limit-conn-idle The maximum idle time of the link. After this time, the Proxy will actively close the connection. | ||
|
||
Recommended configuration: `Keepalive time of backend service> limit-conn-keepalive > 2*limit-conn-idle` | ||
|
||
### limit-dispatch | ||
This parameter is used to set the number of working coroutine pools for the ʻaggregation` request. When there is an 'aggregation' request in the system, this value can be appropriately adjusted to improve the throughput of the `aggregation` request. | ||
|
||
### limit-copy | ||
This parameter is used to set the number of working coordination pools of `Copy traffic` traffic. When there is a scene of `Copy traffic` traffic in the system, this value can be adjusted appropriately to improve the throughput of `Copy traffic`. | ||
|
||
### limit-conn | ||
This parameter is used to control the maximum number of links that `Proxy` can establish with each backend. If it finds that the backend of a backend server is very high and the delay is large, it may take time to wait for the operation of the idle link. Increase this value. | ||
|
||
### limit-caching | ||
This parameter controls how much memory a single `Proxy` uses for caching. If the API in `Proxy` has caching enabled, then this parameter can be used to control the cache size. |