mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-04 21:17:36 +08:00
doc: fix some doc styles by markdownlint (#1460)
This commit is contained in:
parent
9baad7856b
commit
3405b61d7a
@ -23,7 +23,6 @@ The batch processor can be used to aggregate entries(logs/any data) and process
|
||||
When the batch_max_size is set to zero the processor will execute each entry immediately. Setting the batch max size more
|
||||
than 1 will start aggregating the entries until it reaches the max size or the timeout expires.
|
||||
|
||||
|
||||
## Configurations
|
||||
|
||||
The only mandatory parameter to create a batch processor is a function. The function will be executed when the batch reaches the max size
|
||||
@ -38,11 +37,9 @@ or when the buffer duration exceeds.
|
||||
|max_retry_count|optional |Maximum number of retries before removing from the processing pipe line; default is zero|
|
||||
|retry_delay |optional |Number of seconds the process execution should be delayed if the execution fails; default is 1|
|
||||
|
||||
|
||||
The following code shows an example of how to use a batch processor. The batch processor takes a function to be executed as the first
|
||||
argument and the batch configuration as the second parameter.
|
||||
|
||||
|
||||
```lua
|
||||
local bp = require("apisix.plugins.batch-processor")
|
||||
local func_to_execute = function(entries)
|
||||
|
@ -18,43 +18,52 @@
|
||||
-->
|
||||
|
||||
[English](benchmark.md)
|
||||
|
||||
### 测试环境
|
||||
|
||||
使用谷歌云的服务器进行测试,型号为 n1-highcpu-8 (8 vCPUs, 7.2 GB memory)
|
||||
|
||||
我们最多只使用 4 核去运行 APISIX, 剩下的 4 核用于系统和压力测试工具 [wrk](https://github.com/wg/wrk)。
|
||||
|
||||
### 测试反向代理
|
||||
|
||||
我们把 APISIX 当做反向代理来使用,不开启任何插件,响应体的大小为 1KB。
|
||||
|
||||
#### QPS
|
||||
|
||||
下图中 x 轴为 CPU 的使用个数,y 轴为每秒处理的请求数:
|
||||
|
||||
<img src="../doc/images/benchmark-1.jpg" width="70%" height="70%">
|
||||
|
||||
#### 延时
|
||||
|
||||
请注意 y 轴延时的单位是**微秒(μs)**,而不是毫秒:
|
||||
|
||||
<img src="../doc/images/latency-1.jpg" width="70%" height="70%">
|
||||
|
||||
#### 火焰图
|
||||
|
||||
火焰图的采样结果:
|
||||
|
||||
<img src="../doc/images/flamegraph-1.jpg">
|
||||
|
||||
|
||||
### 测试反向代理,开启 2 个插件
|
||||
|
||||
我们把 APISIX 当做反向代理来使用,开启限速和 prometheus 插件,响应体的大小为 1KB。
|
||||
|
||||
#### QPS
|
||||
|
||||
下图中 x 轴为 CPU 的使用个数,y 轴为每秒处理的请求数:
|
||||
|
||||
<img src="../doc/images/benchmark-2.jpg" width="70%" height="70%">
|
||||
|
||||
#### Latency
|
||||
|
||||
请注意 y 轴延时的单位是**微秒(μs)**,而不是毫秒:
|
||||
|
||||
<img src="../doc/images/latency-2.jpg" width="70%" height="70%">
|
||||
|
||||
#### 火焰图
|
||||
|
||||
火焰图的采样结果:
|
||||
![](../doc/images/flamegraph-2.jpg)
|
||||
![火焰图采样结果](../doc/images/flamegraph-2.jpg)
|
||||
|
@ -46,7 +46,7 @@ Note the y-axis latency in **microsecond(μs)** not millisecond.
|
||||
#### Flame Graph
|
||||
|
||||
The result of Flame Graph:
|
||||
![](../doc/images/flamegraph-1.jpg)
|
||||
![flamegraph-1](../doc/images/flamegraph-1.jpg)
|
||||
|
||||
And if you want to run the benchmark test in your machine, you should run another Nginx to listen 80 port.
|
||||
|
||||
@ -91,7 +91,7 @@ Note the y-axis latency in **microsecond(μs)** not millisecond.
|
||||
#### Flame Graph
|
||||
|
||||
The result of Flame Graph:
|
||||
![](../doc/images/flamegraph-2.jpg)
|
||||
![flamegraph-2](../doc/images/flamegraph-2.jpg)
|
||||
|
||||
And if you want to run the benchmark test in your machine, you should run another Nginx to listen 80 port.
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#
|
||||
-->
|
||||
[English](getting-started.md)
|
||||
|
||||
# 快速入门指南
|
||||
|
||||
本指南的目的是介绍如何使用 APISIX 来配置出一个安全的可以对外提供服务的 API。当您读完本指南,你需要自己安装一下 APISIX 应用,并准备好一个可以对外提供服务的 API,该服务将由 API key 进行访问保护。
|
||||
@ -101,6 +102,7 @@ Service(服务)为上游服务提供了抽象。因此,您可以创建单
|
||||
... Additional Configurations
|
||||
}
|
||||
```
|
||||
|
||||
通过上面的匹配规则你就可以通过如下的命令跟 APISIX 进行交互了
|
||||
|
||||
```bash
|
||||
|
@ -18,6 +18,7 @@
|
||||
-->
|
||||
|
||||
[Chinese](getting-started-cn.md)
|
||||
|
||||
# Quick Start Guide
|
||||
|
||||
The goal of this guide is to get started with APISIX and to configure a secured public API with APISIX.
|
||||
@ -104,6 +105,7 @@ Technically all this information(upstream or service, plugins) can be included i
|
||||
... Additional Configurations
|
||||
}
|
||||
```
|
||||
|
||||
With the above matching rule you can communicate to APISIX via the following command.
|
||||
|
||||
```bash
|
||||
@ -118,7 +120,6 @@ Technically all this information(upstream or service, plugins) can be included i
|
||||
|
||||
When configuring a route you can either set the upstream information or use service abstraction to refer the upstream information.
|
||||
|
||||
|
||||
- Plugins
|
||||
|
||||
Plugins allows you to extend the capabilities of APISIX and to implement arbitrary logic which can interface with the HTTP request/response lifecycle.
|
||||
|
@ -18,20 +18,19 @@
|
||||
-->
|
||||
|
||||
[English](grpc-proxy.md)
|
||||
|
||||
# grpc-proxy
|
||||
|
||||
通过 APISIX 代理 gRPC 连接,并使用 APISIX 的大部分特性管理你的 gRPC 服务。
|
||||
|
||||
|
||||
### 参数
|
||||
## 参数
|
||||
|
||||
* `service_protocol`: 这个 Route 的属性 `service_protocol` 必须设置为 `grpc`
|
||||
* `uri`: 格式为 /service/method 如:/helloworld.Greeter/SayHello
|
||||
|
||||
## 示例
|
||||
|
||||
### 示例
|
||||
|
||||
#### 创建代理 gRPC 的 Route
|
||||
### 创建代理 gRPC 的 Route
|
||||
|
||||
在指定 Route 中,代理 gRPC 服务接口:
|
||||
|
||||
@ -54,8 +53,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
|
||||
}'
|
||||
```
|
||||
|
||||
|
||||
#### 测试
|
||||
### 测试
|
||||
|
||||
访问上面配置的 Route:
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
开启 Stand-alone 模式的 APISIX 节点,将不再使用默认的 etcd 作为配置中心。
|
||||
|
||||
这种方式比较适合两类用户:
|
||||
|
||||
1. kubernetes(k8s):声明式 API 场景,通过全量 yaml 配置来动态更新修改路由规则。
|
||||
2. 不同配置中心:配置中心的实现有很多,比如 Consule 等,使用全量 yaml 做中间转换桥梁。
|
||||
|
||||
@ -48,7 +49,6 @@ apisix:
|
||||
此外由于目前 Admin API 都是基于 etcd 配置中心解决方案,当开启 Stand-alone 模式后,
|
||||
Admin API 实际将不起作用。
|
||||
|
||||
|
||||
## 如何配置规则
|
||||
|
||||
所有的路由规则均存放在 `conf/apisix.yaml` 这一个文件中,APISIX 会以每秒(默认)频率检查文件是否有变化,如果有变化,则会检查文件末尾是否能找到 `#END` 结尾,找到后则重新加载文件更新到内存。
|
||||
@ -68,7 +68,7 @@ routes:
|
||||
|
||||
*注意*:如果`conf/apisix.yaml`末尾不能找到 `#END`,那么 APISIX 将不会加载这个文件规则到内存。
|
||||
|
||||
#### 配置 Router
|
||||
### 配置 Router
|
||||
|
||||
单个 Router:
|
||||
|
||||
@ -102,8 +102,7 @@ routes:
|
||||
#END
|
||||
```
|
||||
|
||||
|
||||
#### 配置 Router + Service
|
||||
### 配置 Router + Service
|
||||
|
||||
```yml
|
||||
routes:
|
||||
@ -120,7 +119,7 @@ services:
|
||||
#END
|
||||
```
|
||||
|
||||
#### 配置 Router + Upstream
|
||||
### 配置 Router + Upstream
|
||||
|
||||
```yml
|
||||
routes:
|
||||
|
Loading…
Reference in New Issue
Block a user