Skip to content

lua-resty-limit-traffic库使用

运行示例步骤

lua-resty-limit-traffic相关示例请参考 链接

  1. 编译示例

    bash
    docker compose build
  2. 运行示例

    bash
    docker compose up -d
  3. 运行jmeter并打开 jmeter-assistant.jmx文件 辅助调试

resty.limit.conn

限制客户端并发连接数。

参考链接

示例的详细配置请参考 链接

resty.limit.count

在给定的时间窗口内限制固定数量的请求。

参考链接

示例的详细配置请参考 链接

resty.limit.req

限制客户端请求速率。

参考链接

示例的详细配置请参考 链接

resty.limit.traffic

合并resty.limit.connresty.limit.countresty.limit.req限制器。提醒:todo 合并多个limiters并``rejected时,无法知道具体哪个limiter`拒绝了服务,所以暂时不能应用。

参考链接

自定义同时使用多个限制器

由于resty.limit.traffic存在以上提到的问题,尝试自定义同时使用多个限制器。提示:todo 在测试连接数限制时,jmeter使用15个线程测试openresty一直报告超出允许的最大连接数15阈值。