[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEE9HTRHWN94DFT206Y235":3,"skill-same:01M6FEE9HTRHWN94DFT206Y235":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":22,"linkOnly":23,"markdownContent":24,"markdownBody":24,"frontMatter":25,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M6FEE9HTRHWN94DFT206Y235","nginx-c-module-perf",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fnginx-c-module-perf\u002FSKILL.md",[],[18,19,20,21],"perf","nginx","module","nginx c module perf","2026-11-10 10:12:30",false,"# nginx.org C Module Performance & Reliability Best Practices\n\nComprehensive 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.\n\n**Companion skill**: This skill complements [nginx-c-modules](..\u002Fnginx-c-modules\u002FSKILL.md) which covers correctness (memory safety, request lifecycle, configuration). This skill covers **performance optimization and operational reliability**.\n\n## When to Apply\n\nReference these guidelines when:\n- Optimizing nginx C module throughput and latency\n- Reducing buffer copies and enabling zero-copy I\u002FO paths\n- Tuning connection pooling and socket options\n- Minimizing shared memory lock contention across workers\n- Implementing graceful error recovery and fallback responses\n- Configuring upstream timeouts and retry strategies\n- Building in-module response caches with shared memory\n- Tuning worker process behavior under load\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Buffer & Zero-Copy I\u002FO | CRITICAL | `buf-` |\n| 2 | Connection Efficiency | CRITICAL | `conn-` |\n| 3 | Lock Contention & Atomics | HIGH | `lock-` |\n| 4 | Error Recovery & Resilience | HIGH | `err-` |\n| 5 | Timeout & Retry Strategy | MEDIUM-HIGH | `timeout-` |\n| 6 | Response Caching | MEDIUM | `cache-` |\n| 7 | Worker & Process Tuning | MEDIUM | `worker-` |\n| 8 | Logging & Metrics | LOW-MEDIUM | `log-` |\n\n## Quick Reference\n\n### 1. Buffer & Zero-Copy I\u002FO (CRITICAL)\n\n- [`buf-chain-reuse`](references\u002Fbuf-chain-reuse.md) - Reuse Buffer Chain Links Instead of Allocating New Ones\n- [`buf-file-sendfile`](references\u002Fbuf-file-sendfile.md) - Use File Buffers for Static Content Instead of Reading into Memory\n- [`buf-avoid-copy`](references\u002Fbuf-avoid-copy.md) - Avoid Copying Buffers When Passing Through Filter Chain\n- [`buf-coalesce-small`](references\u002Fbuf-coalesce-small.md) - Coalesce Small Buffers Before Output\n- [`buf-shadow-reference`](references\u002Fbuf-shadow-reference.md) - Use Shadow Buffers for Derived Data Instead of Full Copies\n- [`buf-recycled-flag`](references\u002Fbuf-recycled-flag.md) - Mark Buffers as Recycled for Upstream Response Reuse\n\n### 2. Connection Efficiency (CRITICAL)\n\n- [`conn-reusable-queue`](references\u002Fconn-reusable-queue.md) - Mark Idle Connections as Reusable for Pool Recovery\n- [`conn-drain-pressure`](references\u002Fconn-drain-pressure.md) - Handle Connection Drain Under Memory Pressure\n- [`conn-tcp-nodelay`](references\u002Fconn-tcp-nodelay.md) - Control TCP_NODELAY for Latency-Sensitive Responses\n- [`conn-prealloc-pool`](references\u002Fconn-prealloc-pool.md) - Size Connection Pool to Avoid Runtime Reallocation\n- [`conn-close-linger`](references\u002Fconn-close-linger.md) - Use Lingering Close for Graceful Connection Shutdown\n- [`conn-ssl-session-reuse`](references\u002Fconn-ssl-session-reuse.md) - Enable SSL Session Caching in Upstream Connections\n\n### 3. Lock Contention & Atomics (HIGH)\n\n- [`lock-minimize-critical`](references\u002Flock-minimize-critical.md) - Minimize Critical Section Duration in Shared Memory\n- [`lock-atomic-counters`](references\u002Flock-atomic-counters.md) - Use Atomic Operations for Simple Counters Instead of Mutex\n- [`lock-trylock-fallback`](references\u002Flock-trylock-fallback.md) - Use ngx_shmtx_trylock with Fallback to Avoid Worker Stalls\n- [`lock-per-worker-aggregate`](references\u002Flock-per-worker-aggregate.md) - Aggregate Per-Worker Counters to Reduce Shared Memory Access\n- [`lock-alloc-outside`](references\u002Flock-alloc-outside.md) - Perform Slab Allocation Outside Hot Path\n- [`lock-rw-pattern`](references\u002Flock-rw-pattern.md) - Use Read-Copy-Update Pattern for Read-Heavy Shared Data\n\n### 4. Error Recovery & Resilience (HIGH)\n\n- [`err-cache-errno`](references\u002Ferr-cache-errno.md) - Cache ngx_errno Immediately to Prevent Overwrite\n- [`err-fallback-response`](references\u002Ferr-fallback-response.md) - Return Fallback Response When Upstream Fails\n- [`err-resource-exhaustion`](references\u002Ferr-resource-exhaustion.md) - Handle Pool and Slab Allocation Exhaustion Gracefully\n- [`err-blocked-counter`](references\u002Ferr-blocked-counter.md) - Use Blocked Counter to Prevent Premature Request Destruction\n- [`err-connection-error-check`](references\u002Ferr-connection-error-check.md) - Check Connection Error Flag Before I\u002FO Operations\n- [`err-log-once-pattern`](references\u002Ferr-log-once-pattern.md) - Limit Repeated Error Logging to Prevent Log Storms\n\n### 5. Timeout & Retry Strategy (MEDIUM-HIGH)\n\n- [`timeout-upstream-phases`](references\u002Ftimeout-upstream-phases.md) - Set Separate Timeouts for Connect, Send, and Read Phases\n- [`timeout-retry-next-upstream`](references\u002Ftimeout-retry-next-upstream.md) - Configure next_upstream Mask for Retriable Failures\n- [`timeout-backoff-reconnect`](references\u002Ftimeout-backoff-reconnect.md) - Use Exponential Backoff for Upstream Reconnection Attempts\n- [`timeout-client-body-limit`](references\u002Ftimeout-client-body-limit.md) - Set Client Body Timeout to Bound Slow-Client Resource Usage\n\n### 6. Response Caching (MEDIUM)\n\n- [`cache-shm-lru`](references\u002Fcache-shm-lru.md) - Implement LRU Eviction in Shared Memory Cache Zones\n- [`cache-stampede-lock`](references\u002Fcache-stampede-lock.md) - Prevent Cache Stampede with Single-Flight Pattern\n- [`cache-key-hash`](references\u002Fcache-key-hash.md) - Use ngx_hash for Fixed Cache Key Lookups\n- [`cache-ttl-atomic`](references\u002Fcache-ttl-atomic.md) - Use Atomic Timestamp Comparison for TTL Expiry Checks\n- [`cache-conditional-store`](references\u002Fcache-conditional-store.md) - Cache Only Successful Responses to Avoid Negative Cache Pollution\n\n### 7. Worker & Process Tuning (MEDIUM)\n\n- [`worker-accept-mutex`](references\u002Fworker-accept-mutex.md) - Understand Accept Mutex Impact on Connection Distribution\n- [`worker-connection-prealloc`](references\u002Fworker-connection-prealloc.md) - Use Pre-Allocated Free List for Module Data Structures\n- [`worker-graceful-shutdown`](references\u002Fworker-graceful-shutdown.md) - Handle Worker Shutdown Signal Without Data Loss\n- [`worker-single-process-debug`](references\u002Fworker-single-process-debug.md) - Support Single-Process Mode for Debugging\n- [`worker-cycle-conf`](references\u002Fworker-cycle-conf.md) - Access Configuration Through Cycle for Process-Level Operations\n\n### 8. Logging & Metrics (LOW-MEDIUM)\n\n- [`log-level-guard`](references\u002Flog-level-guard.md) - Guard Expensive Debug Argument Computation Behind Level Check\n- [`log-connection-context`](references\u002Flog-connection-context.md) - Attach Module Context to Connection Log for Tracing\n- [`log-shared-metrics`](references\u002Flog-shared-metrics.md) - Collect Metrics via Shared Memory Counters\n- [`log-error-dedup`](references\u002Flog-error-dedup.md) - Deduplicate Repeated Error Messages with Throttling\n- [`log-action-string`](references\u002Flog-action-string.md) - Set Log Action String for Operation Context\n\n## How to Use\n\nRead individual reference files for detailed explanations and code examples:\n\n- [Section definitions](references\u002F_sections.md) - Category structure and impact levels\n- [Rule template](assets\u002Ftemplates\u002F_template.md) - Template for adding new rules\n\n## Reference Files\n\n| File | Description |\n|------|-------------|\n| [references\u002F_sections.md](references\u002F_sections.md) | Category definitions and ordering |\n| [assets\u002Ftemplates\u002F_template.md](assets\u002Ftemplates\u002F_template.md) | Template for new rules |\n| [metadata.json](metadata.json) | Version and reference information |\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fnginx-c-module-perf",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill nginx-c-module-perf",{"tool":41,"command":42},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill nginx-c-module-perf",{"tool":44,"command":45},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill nginx-c-module-perf","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fnginx-c-module-perf\u002FSKILL.md",true,[],[50,64,74,83,89,96],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":60,"publishedAt":22},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[55],{"categoryNo":56,"categoryName":57,"taxonomyType":58,"taxonomyTypeDesc":59},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[61,62,63],"model","model hierarchy","model hierarchy skill",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":70,"publishedAt":22},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[69],{"categoryNo":56,"categoryName":57,"taxonomyType":58,"taxonomyTypeDesc":59},[71,72,73],"MCP","zoom","zoom mcp",{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":22},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[80,81,82,72],"sdk","zoom apps sdk","apps",{"skillNo":84,"name":85,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":22},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[85],{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":95,"publishedAt":22},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[94],{"categoryNo":56,"categoryName":57,"taxonomyType":58,"taxonomyTypeDesc":59},[91],{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":22},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[98]]