feat: Add OpenResty performance tuning options and validation

- Implemented validation for OpenResty configuration options including worker processes, connections, timeouts, and caching parameters.
- Added new validation functions for positive integers, booleans, and specific formats (e.g., size values, proxy buffers, cache levels).
- Updated the option management to include OpenResty parameters in the database and ensure they can be modified via the management interface.
- Enhanced the settings page to allow users to configure OpenResty parameters with appropriate validation and error handling.
- Added unit tests for the new validation logic to ensure correctness.
- Updated documentation to reflect the new OpenResty configuration options and their usage.
This commit is contained in:
ryan
2026-03-12 22:16:03 +08:00
parent bad716652a
commit 88b99c5cd9
7 changed files with 1137 additions and 8 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ Server 当前支持两类启动配置:
此外,部分运行时参数已迁入数据库 `Option` 表,可在管理端设置页中热更新,例如 Agent 运行参数与限流阈值。
第五版(0.5.x)计划继续复用 `Option` 表承载 OpenResty 性能优化参数与缓存参数,不单独引入新的配置中心。
第五版(0.5.x)继续复用 `Option` 表承载 OpenResty 性能优化参数与缓存参数,不单独引入新的配置中心。
### 1.1 Server 命令行参数
@@ -119,9 +119,9 @@ volumes:
* 限流窗口上限不能超过 `RateLimitKeyExpirationDuration`,当前为 20 分钟
* 限流按来源 IP 统计,若前置了 Nginx/CDN/LB,应正确透传真实客户端 IP
### 1.2.2 第五版规划中的 OpenResty 优化配置项
### 1.2.2 第五版当前支持的 OpenResty 优化配置项
以下配置项用于第五版开发文档定义,目标是在管理端「运维设置」中统一维护,并参与版本渲染。除特别说明外,均计划保存在 `Option` 表中。
以下配置项当前已接入管理端「运维设置」,并统一保存在 `Option` 表中。它们会参与第五版后续的配置渲染与发布链路;当前阶段优先完成参数录入、默认值和校验能力。
| 配置项 | 作用 | 计划默认值 |
| --- | --- | --- |
@@ -157,7 +157,7 @@ volumes:
说明:
* 第五版第一批仅开放稳定、可校验、可回滚的常用性能项;更多指令后续按相同模式扩展
* 第五版第一批当前仅开放稳定、可校验、可回滚的常用性能项;更多指令后续按相同模式扩展
* 所有大小、时长、布尔和整数参数都应在 Server 保存前完成校验
* `OpenRestyCacheEnabled=false` 时,缓存目录与缓存参数应允许留空或回退到默认值
* 任何包含路径的配置项都必须在 Agent 落盘前再次校验可写性与安全边界