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
+31
View File
@@ -55,6 +55,37 @@ var AgentHeartbeatInterval = 30000 // milliseconds
var AgentSyncInterval = 30000 // milliseconds
var AgentUpdateRepo = "Rain-kl/ATSFlare"
// V5 OpenResty performance settings (hot-reloadable via Option table)
var OpenRestyWorkerProcesses = "auto"
var OpenRestyWorkerConnections = 4096
var OpenRestyWorkerRlimitNofile = 65535
var OpenRestyEventsUse = ""
var OpenRestyEventsMultiAcceptEnabled = false
var OpenRestyKeepaliveTimeout = 65
var OpenRestyKeepaliveRequests = 1000
var OpenRestyClientHeaderTimeout = 15
var OpenRestyClientBodyTimeout = 15
var OpenRestySendTimeout = 30
var OpenRestyProxyConnectTimeout = 5
var OpenRestyProxySendTimeout = 60
var OpenRestyProxyReadTimeout = 60
var OpenRestyProxyBufferingEnabled = true
var OpenRestyProxyBuffers = "16 16k"
var OpenRestyProxyBufferSize = "8k"
var OpenRestyProxyBusyBuffersSize = "64k"
var OpenRestyGzipEnabled = true
var OpenRestyGzipMinLength = 1024
var OpenRestyGzipCompLevel = 5
var OpenRestyCacheEnabled = false
var OpenRestyCachePath = ""
var OpenRestyCacheLevels = "1:2"
var OpenRestyCacheInactive = "30m"
var OpenRestyCacheMaxSize = "1g"
var OpenRestyCacheKeyTemplate = "$scheme$proxy_host$request_uri"
var OpenRestyCacheLockEnabled = true
var OpenRestyCacheLockTimeout = "5s"
var OpenRestyCacheUseStale = "error timeout updating http_500 http_502 http_503 http_504"
const (
RoleGuestUser = 0
RoleCommonUser = 1