重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
nginx-c-module-perf by pproenca/dot-skills
npx skills add https://github.com/pproenca/dot-skills --skill nginx-c-module-perf基于官方 nginx 开发文档和生产工程经验总结的 nginx C 模块全面性能优化与可靠性指南。包含 8 大类共 43 条规则,按影响优先级排序,以指导自动化优化和弹性改进。
配套技能:此技能是对 nginx-c-modules 的补充,后者涵盖正确性(内存安全、请求生命周期、配置)。此技能涵盖性能优化和运行可靠性。
在以下情况下参考本指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 缓冲区与零拷贝 I/O | 关键 | buf- |
| 2 | 连接效率 | 关键 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
conn-| 3 | 锁争用与原子操作 | 高 | lock- |
| 4 | 错误恢复与弹性 | 高 | err- |
| 5 | 超时与重试策略 | 中高 | timeout- |
| 6 | 响应缓存 | 中 | cache- |
| 7 | 工作进程与进程调优 | 中 | worker- |
| 8 | 日志记录与指标 | 低中 | log- |
buf-chain-reuse - 重用缓冲区链节点而非分配新节点buf-file-sendfile - 对静态内容使用文件缓冲区而非读入内存buf-avoid-copy - 在通过过滤器链传递时避免复制缓冲区buf-coalesce-small - 在输出前合并小缓冲区buf-shadow-reference - 对派生数据使用影子缓冲区而非完全拷贝buf-recycled-flag - 标记缓冲区为可回收以供上游响应重用conn-reusable-queue - 将空闲连接标记为可重用以便池恢复conn-drain-pressure - 处理内存压力下的连接排空conn-tcp-nodelay - 为延迟敏感型响应控制 TCP_NODELAYconn-prealloc-pool - 调整连接池大小以避免运行时重新分配conn-close-linger - 使用延迟关闭实现优雅连接关闭conn-ssl-session-reuse - 在上游连接中启用 SSL 会话缓存lock-minimize-critical - 最小化共享内存中临界区的持续时间lock-atomic-counters - 对简单计数器使用原子操作而非互斥锁lock-trylock-fallback - 使用 ngx_shmtx_trylock 并降级以避免工作进程停滞lock-per-worker-aggregate - 聚合每工作进程计数器以减少共享内存访问lock-alloc-outside - 在热点路径外执行 slab 分配lock-rw-pattern - 对读密集型共享数据使用读-拷贝-更新模式err-cache-errno - 立即缓存 ngx_errno 以防止被覆盖err-fallback-response - 当上游失败时返回降级响应err-resource-exhaustion - 优雅处理池和 slab 分配耗尽err-blocked-counter - 使用阻塞计数器防止请求过早销毁err-connection-error-check - 在 I/O 操作前检查连接错误标志err-log-once-pattern - 限制重复错误日志记录以防止日志风暴timeout-upstream-phases - 为连接、发送和读取阶段设置独立的超时timeout-retry-next-upstream - 为可重试的失败配置 next_upstream 掩码timeout-backoff-reconnect - 对上游重连尝试使用指数退避timeout-client-body-limit - 设置客户端请求体超时以限制慢客户端资源使用cache-shm-lru - 在共享内存缓存区中实现 LRU 淘汰cache-stampede-lock - 使用单飞模式防止缓存雪崩cache-key-hash - 使用 ngx_hash 进行固定缓存键查找cache-ttl-atomic - 使用原子时间戳比较进行 TTL 过期检查cache-conditional-store - 仅缓存成功的响应以避免负面缓存污染worker-accept-mutex - 理解接受互斥锁对连接分发的影响worker-connection-prealloc - 为模块数据结构使用预分配的空闲列表worker-graceful-shutdown - 处理工作进程关闭信号而不丢失数据worker-single-process-debug - 支持单进程模式以进行调试worker-cycle-conf - 通过周期访问配置以进行进程级操作log-level-guard - 在级别检查后保护昂贵的调试参数计算log-connection-context - 将模块上下文附加到连接日志以进行追踪log-shared-metrics - 通过共享内存计数器收集指标log-error-dedup - 通过节流对重复错误消息进行去重log-action-string - 为操作上下文设置日志操作字符串阅读单独的参考文件以获取详细解释和代码示例:
| 文件 | 描述 |
|---|---|
| references/_sections.md | 类别定义和排序 |
| assets/templates/_template.md | 新规则模板 |
| metadata.json | 版本和参考信息 |
每周安装
50
代码仓库
GitHub 星标
95
首次出现
2026年2月16日
安全审计
安装于
codex46
github-copilot45
gemini-cli45
kimi-cli44
opencode44
cursor44
Comprehensive performance optimization and reliability guide for nginx C modules, derived from the official nginx development documentation and production engineering experience. Contains 43 rules across 8 categories, prioritized by impact to guide automated optimization and resilience improvements.
Companion skill : This skill complements nginx-c-modules which covers correctness (memory safety, request lifecycle, configuration). This skill covers performance optimization and operational reliability.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Buffer & Zero-Copy I/O | CRITICAL | buf- |
| 2 | Connection Efficiency | CRITICAL | conn- |
| 3 | Lock Contention & Atomics | HIGH | lock- |
| 4 | Error Recovery & Resilience | HIGH | err- |
| 5 | Timeout & Retry Strategy | MEDIUM-HIGH | timeout- |
| 6 | Response Caching | MEDIUM | cache- |
| 7 | Worker & Process Tuning | MEDIUM | worker- |
| 8 | Logging & Metrics | LOW-MEDIUM | log- |
buf-chain-reuse - Reuse Buffer Chain Links Instead of Allocating New Onesbuf-file-sendfile - Use File Buffers for Static Content Instead of Reading into Memorybuf-avoid-copy - Avoid Copying Buffers When Passing Through Filter Chainbuf-coalesce-small - Coalesce Small Buffers Before Outputbuf-shadow-reference - Use Shadow Buffers for Derived Data Instead of Full Copiesconn-reusable-queue - Mark Idle Connections as Reusable for Pool Recoveryconn-drain-pressure - Handle Connection Drain Under Memory Pressureconn-tcp-nodelay - Control TCP_NODELAY for Latency-Sensitive Responsesconn-prealloc-pool - Size Connection Pool to Avoid Runtime Reallocationconn-close-linger - Use Lingering Close for Graceful Connection Shutdownlock-minimize-critical - Minimize Critical Section Duration in Shared Memorylock-atomic-counters - Use Atomic Operations for Simple Counters Instead of Mutexlock-trylock-fallback - Use ngx_shmtx_trylock with Fallback to Avoid Worker Stallslock-per-worker-aggregate - Aggregate Per-Worker Counters to Reduce Shared Memory Accesslock-alloc-outside - Perform Slab Allocation Outside Hot Patherr-cache-errno - Cache ngx_errno Immediately to Prevent Overwriteerr-fallback-response - Return Fallback Response When Upstream Failserr-resource-exhaustion - Handle Pool and Slab Allocation Exhaustion Gracefullyerr-blocked-counter - Use Blocked Counter to Prevent Premature Request Destructionerr-connection-error-check - Check Connection Error Flag Before I/O Operationstimeout-upstream-phases - Set Separate Timeouts for Connect, Send, and Read Phasestimeout-retry-next-upstream - Configure next_upstream Mask for Retriable Failurestimeout-backoff-reconnect - Use Exponential Backoff for Upstream Reconnection Attemptstimeout-client-body-limit - Set Client Body Timeout to Bound Slow-Client Resource Usagecache-shm-lru - Implement LRU Eviction in Shared Memory Cache Zonescache-stampede-lock - Prevent Cache Stampede with Single-Flight Patterncache-key-hash - Use ngx_hash for Fixed Cache Key Lookupscache-ttl-atomic - Use Atomic Timestamp Comparison for TTL Expiry Checkscache-conditional-store - Cache Only Successful Responses to Avoid Negative Cache Pollutionworker-accept-mutex - Understand Accept Mutex Impact on Connection Distributionworker-connection-prealloc - Use Pre-Allocated Free List for Module Data Structuresworker-graceful-shutdown - Handle Worker Shutdown Signal Without Data Lossworker-single-process-debug - Support Single-Process Mode for Debuggingworker-cycle-conf - Access Configuration Through Cycle for Process-Level Operationslog-level-guard - Guard Expensive Debug Argument Computation Behind Level Checklog-connection-context - Attach Module Context to Connection Log for Tracinglog-shared-metrics - Collect Metrics via Shared Memory Counterslog-error-dedup - Deduplicate Repeated Error Messages with Throttlinglog-action-string - Set Log Action String for Operation ContextRead individual reference files for detailed explanations and code examples:
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
Weekly Installs
50
Repository
GitHub Stars
95
First Seen
Feb 16, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex46
github-copilot45
gemini-cli45
kimi-cli44
opencode44
cursor44
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
127,000 周安装
AWS CloudFront CDN 配置指南:快速部署、最佳实践与安全优化
177 周安装
系统性调试方法:4个阶段快速定位根本原因,解决技术问题
175 周安装
错误追踪与监控专家:实施全面错误监控解决方案,提升系统稳定性
177 周安装
SVG 插图入门指南:创建专业图表、排查嵌入问题、提升幻灯片视觉效果
180 周安装
iOS/Swift 内存调试与泄漏修复指南 - 使用 Instruments 和 Xcode 诊断循环引用、计时器泄漏
184 周安装
Apify 社交平台数据抓取工具集:Twitter、Reddit、LinkedIn、Instagram 等自动化爬虫
177 周安装
buf-recycled-flagconn-ssl-session-reuselock-rw-patternerr-log-once-pattern