[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6PBHS8D57AHHD7V9EYD7G35":3,"skill-same:01M6PBHS8D57AHHD7V9EYD7G35":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":29,"commitSha":52,"skillDirectory":53,"forksCount":13,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6PBHS8D57AHHD7V9EYD7G35","performance-tuning",null,"Optimize Linux system performance. Configure kernel parameters, analyze bottlenecks, and tune resources. Use when improving system performance.","duc-duy-1612\u002FOnline-Delivery-Systems-Web","duc-duy-1612","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192231384?v=4","01M6NSDKQQDKVTHZ8DZMZ1VYY6","01M6NSDKW8DDVTQHBT1HBDDJPT",0,"MIT","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fperformance-tuning\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"performance tuning","performance","tuning","community","relevant","resources","scripts","critical","os","platform","optimize","main","kernel","only","analyze","system","configure","access","devops-security","security","2026-11-10 10:12:30",false,"---\nname: performance-tuning\ndescription: Optimize Linux system performance. Configure kernel parameters, analyze\n  bottlenecks, and tune resources. Use when improving system performance.\ncategory: devops\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\nsource_repo: BagelHole\u002FDevOps-Security-Agent-Skills\nsource_type: community\ndate_added: '2026-09-20'\nlicense: MIT\nlicense_source: https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE\ncompatibility: Requires the relevant OS\u002Fplatform tooling and privileged access where\n  noted. Docs-only; helper scripts and templates not bundled.\nmetadata:\n  author: devops-skills\n  version: '1.0'\n---\n\n# Performance Tuning\n\nOptimize Linux system performance through kernel parameter tuning, I\u002FO scheduler selection, memory management, CPU governor configuration, and benchmarking. Covers methodology, real sysctl settings, and tool-based validation.\n\n## When to Use\n\n- Server experiencing high latency, throughput bottlenecks, or resource exhaustion\n- Preparing infrastructure for high-traffic events or load tests\n- Tuning a database server, web server, or application host for production\n- Diagnosing whether a bottleneck is CPU, memory, disk I\u002FO, or network\n- Establishing baseline performance metrics before and after changes\n- Configuring kernel parameters for containers, VMs, or bare-metal hosts\n\n## Prerequisites\n\n- Root or sudo access on the target system\n- `sysstat` package installed (provides `sar`, `iostat`, `mpstat`)\n- `linux-tools` or `perf` package for CPU profiling\n- Benchmarking tools: `fio` (disk), `sysbench` (CPU\u002Fmemory), `iperf3` (network)\n- Baseline metrics collected before making any changes\n\n## Performance Analysis Methodology\n\nAlways follow this order:\n\n1. **Collect baseline** -- measure current performance with tools\n2. **Identify bottleneck** -- determine if CPU, memory, I\u002FO, or network\n3. **Change one parameter** -- apply a single tuning change\n4. **Measure impact** -- re-run the same benchmark\n5. **Document** -- record the change and its effect\n6. **Iterate or revert** -- keep the change if beneficial, revert if not\n\n## System Monitoring Tools\n\n```bash\n# CPU and process monitoring\ntop                              # Interactive process viewer\nhtop                             # Enhanced interactive viewer\nmpstat -P ALL 2                  # Per-CPU utilization every 2 seconds\npidstat -u 2                     # Per-process CPU usage\n\n# Memory monitoring\nfree -h                          # Memory summary\nvmstat 2                         # Virtual memory stats every 2 seconds\n# Columns: r=runnable, b=blocked, si\u002Fso=swap in\u002Fout, bi\u002Fbo=block I\u002FO\n\n# Disk I\u002FO monitoring\niostat -xz 2                     # Extended disk stats every 2 seconds\n# Key columns: %util, await (latency), r\u002Fs, w\u002Fs\niotop -oP                        # Show processes doing I\u002FO\n\n# Network monitoring\nsar -n DEV 2                     # Network interface stats\nss -s                            # Socket summary\nnstat                            # Network counters\n\n# CPU profiling (requires perf)\nperf top                         # Real-time function-level CPU profiling\nperf stat -a sleep 10            # System-wide counters for 10 seconds\nperf record -g -a sleep 30       # Record 30 seconds of call stacks\nperf report                      # Analyze recorded data\n\n# One-liner: check all major resources\necho \"=== CPU ===\" && mpstat 1 1 && echo \"=== MEM ===\" && free -h && echo \"=== DISK ===\" && iostat -x 1 1 && echo \"=== NET ===\" && ss -s\n```\n\n## Sysctl Kernel Parameter Tuning\n\n### Network Tuning\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-network-performance.conf\n\n# Increase the maximum socket receive\u002Fsend buffer sizes\nnet.core.rmem_max = 134217728\nnet.core.wmem_max = 134217728\nnet.core.rmem_default = 1048576\nnet.core.wmem_default = 1048576\n\n# TCP buffer auto-tuning (min, default, max in bytes)\nnet.ipv4.tcp_rmem = 4096 1048576 134217728\nnet.ipv4.tcp_wmem = 4096 1048576 134217728\n\n# Increase connection backlog for high-traffic servers\nnet.core.somaxconn = 65535\nnet.ipv4.tcp_max_syn_backlog = 65535\nnet.core.netdev_max_backlog = 65535\n\n# Enable TCP fast open (client and server)\nnet.ipv4.tcp_fastopen = 3\n\n# Reuse TIME_WAIT sockets for new connections\nnet.ipv4.tcp_tw_reuse = 1\n\n# Increase the range of ephemeral ports\nnet.ipv4.ip_local_port_range = 1024 65535\n\n# TCP keepalive tuning (detect dead connections faster)\nnet.ipv4.tcp_keepalive_time = 120\nnet.ipv4.tcp_keepalive_intvl = 30\nnet.ipv4.tcp_keepalive_probes = 3\n\n# Disable slow start after idle (keeps congestion window open)\nnet.ipv4.tcp_slow_start_after_idle = 0\n\n# Enable BBR congestion control (requires kernel 4.9+)\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\n```\n\n### Memory Tuning\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-memory-performance.conf\n\n# Reduce swappiness (0-100, lower = less swap usage)\n# 10 for general servers, 1 for database servers\nvm.swappiness = 10\n\n# Dirty page ratios (controls when dirty data is flushed to disk)\n# Lower values = more frequent, smaller writes (better for SSDs)\nvm.dirty_ratio = 20\nvm.dirty_background_ratio = 5\n\n# For large-memory systems writing to fast storage\n# vm.dirty_ratio = 40\n# vm.dirty_background_ratio = 10\n\n# Increase inotify limits (for apps watching many files)\nfs.inotify.max_user_watches = 524288\nfs.inotify.max_user_instances = 1024\n\n# Maximum number of open file descriptors system-wide\nfs.file-max = 2097152\n\n# Virtual memory overcommit\n# 0 = heuristic (default), 1 = always overcommit, 2 = never overcommit\nvm.overcommit_memory = 0\n\n# For Redis or similar in-memory stores, use:\n# vm.overcommit_memory = 1\n\n# Disable Transparent Huge Pages if it causes latency spikes (common with databases)\n# Done via boot parameter or runtime:\n# echo madvise > \u002Fsys\u002Fkernel\u002Fmm\u002Ftransparent_hugepage\u002Fenabled\n```\n\n### Applying Sysctl Changes\n\n```bash\n# Apply all sysctl files\nsysctl --system\n\n# Apply a specific file\nsysctl -p \u002Fetc\u002Fsysctl.d\u002F60-network-performance.conf\n\n# Set a parameter temporarily (lost on reboot)\nsysctl -w vm.swappiness=10\n\n# Verify a parameter\nsysctl vm.swappiness\nsysctl net.ipv4.tcp_congestion_control\n```\n\n## I\u002FO Scheduler Configuration\n\n```bash\n# Check the current scheduler for a device\ncat \u002Fsys\u002Fblock\u002Fsda\u002Fqueue\u002Fscheduler\n# Output example: [mq-deadline] none kyber bfq\n\n# Set the scheduler temporarily\necho mq-deadline > \u002Fsys\u002Fblock\u002Fsda\u002Fqueue\u002Fscheduler   # Good for databases\necho none > \u002Fsys\u002Fblock\u002Fnvme0n1\u002Fqueue\u002Fscheduler       # Best for NVMe SSDs\necho bfq > \u002Fsys\u002Fblock\u002Fsda\u002Fqueue\u002Fscheduler            # Good for interactive desktop\n\n# Scheduler recommendations:\n# NVMe SSD:  none (noop)    -- minimal overhead, hardware handles scheduling\n# SATA SSD:  mq-deadline    -- provides fairness with low latency\n# HDD:       mq-deadline    -- prevents starvation, good for databases\n# Desktop:   bfq            -- prioritizes interactive I\u002FO\n\n# Make persistent via udev rule\ncat \u003C\u003C'EOF' > \u002Fetc\u002Fudev\u002Frules.d\u002F60-io-scheduler.rules\n# Set mq-deadline for rotational (HDD) devices\nACTION==\"add|change\", KERNEL==\"sd[a-z]\", ATTR{queue\u002Frotational}==\"1\", ATTR{queue\u002Fscheduler}=\"mq-deadline\"\n# Set none for non-rotational (SSD\u002FNVMe) devices\nACTION==\"add|change\", KERNEL==\"sd[a-z]\", ATTR{queue\u002Frotational}==\"0\", ATTR{queue\u002Fscheduler}=\"none\"\nACTION==\"add|change\", KERNEL==\"nvme[0-9]*\", ATTR{queue\u002Fscheduler}=\"none\"\nEOF\n\nudevadm control --reload-rules\n\n# Tune read-ahead for sequential workloads (database sequential scans)\nblockdev --setrahead 4096 \u002Fdev\u002Fsda    # 4096 sectors = 2 MB\n\n# Enable TRIM for SSDs (weekly via systemd timer)\nsystemctl enable --now fstrim.timer\nfstrim -av    # Manual run\n```\n\n## CPU Governor Configuration\n\n```bash\n# Check available governors\ncat \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpu0\u002Fcpufreq\u002Fscaling_available_governors\n# Output: performance powersave schedutil\n\n# Check current governor\ncat \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpu0\u002Fcpufreq\u002Fscaling_governor\n\n# Set all CPUs to performance mode (maximum frequency)\nfor cpu in \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpu*\u002Fcpufreq\u002Fscaling_governor; do\n  echo performance > \"$cpu\"\ndone\n\n# Set using cpupower (if installed)\ncpupower frequency-set -g performance\n\n# Governor recommendations:\n# Server (production):   performance    -- max frequency, lowest latency\n# Server (general):      schedutil      -- kernel-driven dynamic scaling\n# Laptop \u002F idle server:  powersave      -- minimize power consumption\n\n# Make persistent via systemd service\ncat \u003C\u003C'EOF' > \u002Fetc\u002Fsystemd\u002Fsystem\u002Fcpu-governor.service\n[Unit]\nDescription=Set CPU governor to performance\n\n[Service]\nType=oneshot\nExecStart=\u002Fusr\u002Fbin\u002Fcpupower frequency-set -g performance\nRemainAfterExit=yes\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsystemctl enable --now cpu-governor\n\n# Disable CPU boost (turbo) if consistent latency is needed\necho 1 > \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fintel_pstate\u002Fno_turbo\n```\n\n## Benchmarking Tools\n\n### fio -- Disk I\u002FO Benchmarking\n\n```bash\n# Install fio\napt install -y fio    # Debian\u002FUbuntu\ndnf install -y fio    # RHEL\u002FCentOS\n\n# Sequential read test (simulates backup reads)\nfio --name=seq-read --ioengine=libaio --direct=1 --rw=read \\\n  --bs=1M --numjobs=4 --size=1G --runtime=60 --time_based --group_reporting\n\n# Sequential write test\nfio --name=seq-write --ioengine=libaio --direct=1 --rw=write \\\n  --bs=1M --numjobs=4 --size=1G --runtime=60 --time_based --group_reporting\n\n# Random read (4K blocks -- simulates database IOPS)\nfio --name=rand-read --ioengine=libaio --direct=1 --rw=randread \\\n  --bs=4k --numjobs=16 --iodepth=64 --size=1G --runtime=60 --time_based --group_reporting\n\n# Random write (4K blocks)\nfio --name=rand-write --ioengine=libaio --direct=1 --rw=randwrite \\\n  --bs=4k --numjobs=16 --iodepth=64 --size=1G --runtime=60 --time_based --group_reporting\n\n# Mixed random read\u002Fwrite (70\u002F30 -- typical database workload)\nfio --name=mixed --ioengine=libaio --direct=1 --rw=randrw --rwmixread=70 \\\n  --bs=4k --numjobs=8 --iodepth=32 --size=1G --runtime=60 --time_based --group_reporting\n```\n\n### sysbench -- CPU and Memory Benchmarking\n\n```bash\n# Install: apt install -y sysbench (Debian) \u002F dnf install -y sysbench (RHEL)\n\n# CPU benchmark\nsysbench cpu --threads=4 --time=30 run\n\n# Memory benchmark\nsysbench memory --threads=4 --time=30 --memory-block-size=1K --memory-total-size=100G run\n```\n\n### iperf3 -- Network Benchmarking\n\n```bash\n# Install iperf3\napt install -y iperf3\n\n# Start server on one host\niperf3 -s\n\n# Run client test from another host\niperf3 -c \u003Cserver-ip> -t 30 -P 4    # 30 seconds, 4 parallel streams\n\n# Test with UDP (measure packet loss)\niperf3 -c \u003Cserver-ip> -u -b 1G -t 30\n\n# Reverse mode (server sends to client)\niperf3 -c \u003Cserver-ip> -R -t 30\n```\n\n## Quick-Reference Tuning Profiles\n\n### Web Server (nginx\u002FApache)\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-webserver.conf\nnet.core.somaxconn = 65535\nnet.ipv4.tcp_max_syn_backlog = 65535\nnet.ipv4.tcp_tw_reuse = 1\nnet.ipv4.tcp_fastopen = 3\nnet.ipv4.ip_local_port_range = 1024 65535\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\nfs.file-max = 2097152\nvm.swappiness = 10\n```\n\n### Database Server (PostgreSQL\u002FMySQL)\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-database.conf\nvm.swappiness = 1\nvm.dirty_ratio = 15\nvm.dirty_background_ratio = 3\nvm.overcommit_memory = 2\nvm.overcommit_ratio = 80\nnet.core.somaxconn = 4096\nfs.file-max = 2097152\n# Disable THP for databases\n# echo never > \u002Fsys\u002Fkernel\u002Fmm\u002Ftransparent_hugepage\u002Fenabled\n```\n\n## Troubleshooting\n\n| Symptom | Diagnostic Command | Common Fix |\n|---|---|---|\n| High CPU, no obvious process | `perf top`, `mpstat -P ALL 2` | Check for kernel-level issues: softirqs, interrupts |\n| High load avg, low CPU usage | `vmstat 2` (check `b` column) | I\u002FO bottleneck: tune scheduler, check disk health |\n| System swapping heavily | `free -h`, `vmstat 2` (check si\u002Fso) | Reduce `vm.swappiness`, add RAM, find memory leak |\n| Disk latency spikes | `iostat -x 2` (check await) | Switch I\u002FO scheduler, reduce dirty ratio, add SSD |\n| \"Too many open files\" error | `cat \u002Fproc\u002Fsys\u002Ffs\u002Ffile-nr` | Increase `fs.file-max` and `LimitNOFILE` |\n| Network throughput low | `iperf3 -c \u003Cserver>`, `ethtool` | Increase buffer sizes, enable BBR, check MTU |\n| Application timeout under load | `ss -s`, `sysctl net.core.somaxconn` | Increase `somaxconn` and `tcp_max_syn_backlog` |\n| Inconsistent latency | Check CPU governor | Set governor to `performance`, disable turbo boost |\n\n## Related Skills\n\n- `linux-administration` -- General system monitoring and management\n- `systemd-services` -- Resource limits via cgroups in unit files\n- `block-storage` -- Storage-level performance (LVM, RAID, filesystems)\n- `nfs-storage` -- NFS-specific performance tuning\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n","# Performance Tuning\n\nOptimize Linux system performance through kernel parameter tuning, I\u002FO scheduler selection, memory management, CPU governor configuration, and benchmarking. Covers methodology, real sysctl settings, and tool-based validation.\n\n## When to Use\n\n- Server experiencing high latency, throughput bottlenecks, or resource exhaustion\n- Preparing infrastructure for high-traffic events or load tests\n- Tuning a database server, web server, or application host for production\n- Diagnosing whether a bottleneck is CPU, memory, disk I\u002FO, or network\n- Establishing baseline performance metrics before and after changes\n- Configuring kernel parameters for containers, VMs, or bare-metal hosts\n\n## Prerequisites\n\n- Root or sudo access on the target system\n- `sysstat` package installed (provides `sar`, `iostat`, `mpstat`)\n- `linux-tools` or `perf` package for CPU profiling\n- Benchmarking tools: `fio` (disk), `sysbench` (CPU\u002Fmemory), `iperf3` (network)\n- Baseline metrics collected before making any changes\n\n## Performance Analysis Methodology\n\nAlways follow this order:\n\n1. **Collect baseline** -- measure current performance with tools\n2. **Identify bottleneck** -- determine if CPU, memory, I\u002FO, or network\n3. **Change one parameter** -- apply a single tuning change\n4. **Measure impact** -- re-run the same benchmark\n5. **Document** -- record the change and its effect\n6. **Iterate or revert** -- keep the change if beneficial, revert if not\n\n## System Monitoring Tools\n\n```bash\n# CPU and process monitoring\ntop                              # Interactive process viewer\nhtop                             # Enhanced interactive viewer\nmpstat -P ALL 2                  # Per-CPU utilization every 2 seconds\npidstat -u 2                     # Per-process CPU usage\n\n# Memory monitoring\nfree -h                          # Memory summary\nvmstat 2                         # Virtual memory stats every 2 seconds\n# Columns: r=runnable, b=blocked, si\u002Fso=swap in\u002Fout, bi\u002Fbo=block I\u002FO\n\n# Disk I\u002FO monitoring\niostat -xz 2                     # Extended disk stats every 2 seconds\n# Key columns: %util, await (latency), r\u002Fs, w\u002Fs\niotop -oP                        # Show processes doing I\u002FO\n\n# Network monitoring\nsar -n DEV 2                     # Network interface stats\nss -s                            # Socket summary\nnstat                            # Network counters\n\n# CPU profiling (requires perf)\nperf top                         # Real-time function-level CPU profiling\nperf stat -a sleep 10            # System-wide counters for 10 seconds\nperf record -g -a sleep 30       # Record 30 seconds of call stacks\nperf report                      # Analyze recorded data\n\n# One-liner: check all major resources\necho \"=== CPU ===\" && mpstat 1 1 && echo \"=== MEM ===\" && free -h && echo \"=== DISK ===\" && iostat -x 1 1 && echo \"=== NET ===\" && ss -s\n```\n\n## Sysctl Kernel Parameter Tuning\n\n### Network Tuning\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-network-performance.conf\n\n# Increase the maximum socket receive\u002Fsend buffer sizes\nnet.core.rmem_max = 134217728\nnet.core.wmem_max = 134217728\nnet.core.rmem_default = 1048576\nnet.core.wmem_default = 1048576\n\n# TCP buffer auto-tuning (min, default, max in bytes)\nnet.ipv4.tcp_rmem = 4096 1048576 134217728\nnet.ipv4.tcp_wmem = 4096 1048576 134217728\n\n# Increase connection backlog for high-traffic servers\nnet.core.somaxconn = 65535\nnet.ipv4.tcp_max_syn_backlog = 65535\nnet.core.netdev_max_backlog = 65535\n\n# Enable TCP fast open (client and server)\nnet.ipv4.tcp_fastopen = 3\n\n# Reuse TIME_WAIT sockets for new connections\nnet.ipv4.tcp_tw_reuse = 1\n\n# Increase the range of ephemeral ports\nnet.ipv4.ip_local_port_range = 1024 65535\n\n# TCP keepalive tuning (detect dead connections faster)\nnet.ipv4.tcp_keepalive_time = 120\nnet.ipv4.tcp_keepalive_intvl = 30\nnet.ipv4.tcp_keepalive_probes = 3\n\n# Disable slow start after idle (keeps congestion window open)\nnet.ipv4.tcp_slow_start_after_idle = 0\n\n# Enable BBR congestion control (requires kernel 4.9+)\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\n```\n\n### Memory Tuning\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-memory-performance.conf\n\n# Reduce swappiness (0-100, lower = less swap usage)\n# 10 for general servers, 1 for database servers\nvm.swappiness = 10\n\n# Dirty page ratios (controls when dirty data is flushed to disk)\n# Lower values = more frequent, smaller writes (better for SSDs)\nvm.dirty_ratio = 20\nvm.dirty_background_ratio = 5\n\n# For large-memory systems writing to fast storage\n# vm.dirty_ratio = 40\n# vm.dirty_background_ratio = 10\n\n# Increase inotify limits (for apps watching many files)\nfs.inotify.max_user_watches = 524288\nfs.inotify.max_user_instances = 1024\n\n# Maximum number of open file descriptors system-wide\nfs.file-max = 2097152\n\n# Virtual memory overcommit\n# 0 = heuristic (default), 1 = always overcommit, 2 = never overcommit\nvm.overcommit_memory = 0\n\n# For Redis or similar in-memory stores, use:\n# vm.overcommit_memory = 1\n\n# Disable Transparent Huge Pages if it causes latency spikes (common with databases)\n# Done via boot parameter or runtime:\n# echo madvise > \u002Fsys\u002Fkernel\u002Fmm\u002Ftransparent_hugepage\u002Fenabled\n```\n\n### Applying Sysctl Changes\n\n```bash\n# Apply all sysctl files\nsysctl --system\n\n# Apply a specific file\nsysctl -p \u002Fetc\u002Fsysctl.d\u002F60-network-performance.conf\n\n# Set a parameter temporarily (lost on reboot)\nsysctl -w vm.swappiness=10\n\n# Verify a parameter\nsysctl vm.swappiness\nsysctl net.ipv4.tcp_congestion_control\n```\n\n## I\u002FO Scheduler Configuration\n\n```bash\n# Check the current scheduler for a device\ncat \u002Fsys\u002Fblock\u002Fsda\u002Fqueue\u002Fscheduler\n# Output example: [mq-deadline] none kyber bfq\n\n# Set the scheduler temporarily\necho mq-deadline > \u002Fsys\u002Fblock\u002Fsda\u002Fqueue\u002Fscheduler   # Good for databases\necho none > \u002Fsys\u002Fblock\u002Fnvme0n1\u002Fqueue\u002Fscheduler       # Best for NVMe SSDs\necho bfq > \u002Fsys\u002Fblock\u002Fsda\u002Fqueue\u002Fscheduler            # Good for interactive desktop\n\n# Scheduler recommendations:\n# NVMe SSD:  none (noop)    -- minimal overhead, hardware handles scheduling\n# SATA SSD:  mq-deadline    -- provides fairness with low latency\n# HDD:       mq-deadline    -- prevents starvation, good for databases\n# Desktop:   bfq            -- prioritizes interactive I\u002FO\n\n# Make persistent via udev rule\ncat \u003C\u003C'EOF' > \u002Fetc\u002Fudev\u002Frules.d\u002F60-io-scheduler.rules\n# Set mq-deadline for rotational (HDD) devices\nACTION==\"add|change\", KERNEL==\"sd[a-z]\", ATTR{queue\u002Frotational}==\"1\", ATTR{queue\u002Fscheduler}=\"mq-deadline\"\n# Set none for non-rotational (SSD\u002FNVMe) devices\nACTION==\"add|change\", KERNEL==\"sd[a-z]\", ATTR{queue\u002Frotational}==\"0\", ATTR{queue\u002Fscheduler}=\"none\"\nACTION==\"add|change\", KERNEL==\"nvme[0-9]*\", ATTR{queue\u002Fscheduler}=\"none\"\nEOF\n\nudevadm control --reload-rules\n\n# Tune read-ahead for sequential workloads (database sequential scans)\nblockdev --setrahead 4096 \u002Fdev\u002Fsda    # 4096 sectors = 2 MB\n\n# Enable TRIM for SSDs (weekly via systemd timer)\nsystemctl enable --now fstrim.timer\nfstrim -av    # Manual run\n```\n\n## CPU Governor Configuration\n\n```bash\n# Check available governors\ncat \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpu0\u002Fcpufreq\u002Fscaling_available_governors\n# Output: performance powersave schedutil\n\n# Check current governor\ncat \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpu0\u002Fcpufreq\u002Fscaling_governor\n\n# Set all CPUs to performance mode (maximum frequency)\nfor cpu in \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fcpu*\u002Fcpufreq\u002Fscaling_governor; do\n  echo performance > \"$cpu\"\ndone\n\n# Set using cpupower (if installed)\ncpupower frequency-set -g performance\n\n# Governor recommendations:\n# Server (production):   performance    -- max frequency, lowest latency\n# Server (general):      schedutil      -- kernel-driven dynamic scaling\n# Laptop \u002F idle server:  powersave      -- minimize power consumption\n\n# Make persistent via systemd service\ncat \u003C\u003C'EOF' > \u002Fetc\u002Fsystemd\u002Fsystem\u002Fcpu-governor.service\n[Unit]\nDescription=Set CPU governor to performance\n\n[Service]\nType=oneshot\nExecStart=\u002Fusr\u002Fbin\u002Fcpupower frequency-set -g performance\nRemainAfterExit=yes\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsystemctl enable --now cpu-governor\n\n# Disable CPU boost (turbo) if consistent latency is needed\necho 1 > \u002Fsys\u002Fdevices\u002Fsystem\u002Fcpu\u002Fintel_pstate\u002Fno_turbo\n```\n\n## Benchmarking Tools\n\n### fio -- Disk I\u002FO Benchmarking\n\n```bash\n# Install fio\napt install -y fio    # Debian\u002FUbuntu\ndnf install -y fio    # RHEL\u002FCentOS\n\n# Sequential read test (simulates backup reads)\nfio --name=seq-read --ioengine=libaio --direct=1 --rw=read \\\n  --bs=1M --numjobs=4 --size=1G --runtime=60 --time_based --group_reporting\n\n# Sequential write test\nfio --name=seq-write --ioengine=libaio --direct=1 --rw=write \\\n  --bs=1M --numjobs=4 --size=1G --runtime=60 --time_based --group_reporting\n\n# Random read (4K blocks -- simulates database IOPS)\nfio --name=rand-read --ioengine=libaio --direct=1 --rw=randread \\\n  --bs=4k --numjobs=16 --iodepth=64 --size=1G --runtime=60 --time_based --group_reporting\n\n# Random write (4K blocks)\nfio --name=rand-write --ioengine=libaio --direct=1 --rw=randwrite \\\n  --bs=4k --numjobs=16 --iodepth=64 --size=1G --runtime=60 --time_based --group_reporting\n\n# Mixed random read\u002Fwrite (70\u002F30 -- typical database workload)\nfio --name=mixed --ioengine=libaio --direct=1 --rw=randrw --rwmixread=70 \\\n  --bs=4k --numjobs=8 --iodepth=32 --size=1G --runtime=60 --time_based --group_reporting\n```\n\n### sysbench -- CPU and Memory Benchmarking\n\n```bash\n# Install: apt install -y sysbench (Debian) \u002F dnf install -y sysbench (RHEL)\n\n# CPU benchmark\nsysbench cpu --threads=4 --time=30 run\n\n# Memory benchmark\nsysbench memory --threads=4 --time=30 --memory-block-size=1K --memory-total-size=100G run\n```\n\n### iperf3 -- Network Benchmarking\n\n```bash\n# Install iperf3\napt install -y iperf3\n\n# Start server on one host\niperf3 -s\n\n# Run client test from another host\niperf3 -c \u003Cserver-ip> -t 30 -P 4    # 30 seconds, 4 parallel streams\n\n# Test with UDP (measure packet loss)\niperf3 -c \u003Cserver-ip> -u -b 1G -t 30\n\n# Reverse mode (server sends to client)\niperf3 -c \u003Cserver-ip> -R -t 30\n```\n\n## Quick-Reference Tuning Profiles\n\n### Web Server (nginx\u002FApache)\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-webserver.conf\nnet.core.somaxconn = 65535\nnet.ipv4.tcp_max_syn_backlog = 65535\nnet.ipv4.tcp_tw_reuse = 1\nnet.ipv4.tcp_fastopen = 3\nnet.ipv4.ip_local_port_range = 1024 65535\nnet.core.default_qdisc = fq\nnet.ipv4.tcp_congestion_control = bbr\nfs.file-max = 2097152\nvm.swappiness = 10\n```\n\n### Database Server (PostgreSQL\u002FMySQL)\n\n```bash\n# \u002Fetc\u002Fsysctl.d\u002F60-database.conf\nvm.swappiness = 1\nvm.dirty_ratio = 15\nvm.dirty_background_ratio = 3\nvm.overcommit_memory = 2\nvm.overcommit_ratio = 80\nnet.core.somaxconn = 4096\nfs.file-max = 2097152\n# Disable THP for databases\n# echo never > \u002Fsys\u002Fkernel\u002Fmm\u002Ftransparent_hugepage\u002Fenabled\n```\n\n## Troubleshooting\n\n| Symptom | Diagnostic Command | Common Fix |\n|---|---|---|\n| High CPU, no obvious process | `perf top`, `mpstat -P ALL 2` | Check for kernel-level issues: softirqs, interrupts |\n| High load avg, low CPU usage | `vmstat 2` (check `b` column) | I\u002FO bottleneck: tune scheduler, check disk health |\n| System swapping heavily | `free -h`, `vmstat 2` (check si\u002Fso) | Reduce `vm.swappiness`, add RAM, find memory leak |\n| Disk latency spikes | `iostat -x 2` (check await) | Switch I\u002FO scheduler, reduce dirty ratio, add SSD |\n| \"Too many open files\" error | `cat \u002Fproc\u002Fsys\u002Ffs\u002Ffile-nr` | Increase `fs.file-max` and `LimitNOFILE` |\n| Network throughput low | `iperf3 -c \u003Cserver>`, `ethtool` | Increase buffer sizes, enable BBR, check MTU |\n| Application timeout under load | `ss -s`, `sysctl net.core.somaxconn` | Increase `somaxconn` and `tcp_max_syn_backlog` |\n| Inconsistent latency | Check CPU governor | Set governor to `performance`, disable turbo boost |\n\n## Related Skills\n\n- `linux-administration` -- General system monitoring and management\n- `systemd-services` -- Resource limits via cgroups in unit files\n- `block-storage` -- Storage-level performance (LVM, RAID, filesystems)\n- `nfs-storage` -- NFS-specific performance tuning\n\n## Limitations\n\n- Infrastructure commands can disrupt services: confirm target host\u002Fscope and have backups\u002Fsnapshots before mutating state.\n- Docs-only import: upstream scripts and templates not bundled.\n\n",{"name":5,"risk":25,"source":43,"license":14,"category":44,"metadata":45,"date_added":48,"description":7,"source_repo":49,"source_type":21,"compatibility":50,"license_source":51},"https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills","devops",{"author":46,"version":47},"devops-skills","1.0","2026-09-20","BagelHole\u002FDevOps-Security-Agent-Skills","Requires the relevant OS\u002Fplatform tooling and privileged access where noted. Docs-only; helper scripts and templates not bundled.","https:\u002F\u002Fgithub.com\u002FBagelHole\u002FDevOps-Security-Agent-Skills\u002Fblob\u002Fmain\u002FLICENSE","f3312ba749561b6159f477dbfc9313c875d40a56",".agents\u002Fskills_archive\u002Fperformance-tuning","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612","2026-10-25 23:50:58",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill performance-tuning",{"tool":63,"command":64},"bunx","bunx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill performance-tuning",{"tool":66,"command":67},"pnpm","pnpm dlx skills add duc-duy-1612\u002FOnline-Delivery-Systems-Web --skill performance-tuning","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fperformance-tuning\u002FSKILL.md",true,[],[72,94,118,143,171,195],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":83,"publishedAt":38},"01M6Q0FA5FZ410Z33Z3TFQ4DBA","zero-trust","Implement zero-trust network architecture. Configure identity-based access, micro-segmentation, and continuous verification. Use when implementing modern security architectures.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzero-trust\u002FSKILL.md",[78],{"categoryNo":79,"categoryName":80,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[84,85,86,87,88,89,74,90,36,35,34,31,21,29,91,25,92,24,22,93],"ZeRO","trust","zero trust","architecture","assessment","verification","segmentation","active","scope","implementing",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":38},"01M6Q0F1YZJW3KX5FBKEVZ8CV4","zcode-delegate","Delegate coding tasks to the Z.AI ZCode CLI only when the user explicitly requests it, while the orchestrator retains review and landing responsibility.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fzcode-delegate\u002FSKILL.md",[],[101,102,103,104,105,106,107,108,109,110,111,112,113,31,114,21,115,116,25,117],"delegate","zcode","zcode delegate","review","cli","orchestration","tasks","run","Bash","model","node","read","orchestrator","files","desktop app","app","agent-orchestration",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":38},"01M6Q0ETK41VGNMYEXW0T00AJN","youtube-transcript","Fetch YouTube transcripts through DeepAPI or local fallback tooling and save clean text output.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript\u002FSKILL.md",[],[125,126,127,128,129,130,131,132,133,134,135,136,137,21,29,138,139,140,141,142],"transcript","youtube transcript","youtube","safe","github","codex","research","license","https","text","fetch","tooling","clean","local","output","deepapi","youtube transcripts","blob",{"skillNo":144,"name":145,"nameZh":6,"description":146,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":160,"publishedAt":38},"01M6Q0EPPH2PVMDW40017F8WX0","youtube-transcript-skills","Fetch YouTube video transcripts, search videos\u002Fchannels, browse channels, and extract playlists via the getyoutubetranscript.com API - free tier, no card required.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-transcript-skills\u002FSKILL.md",[149,152,155],{"categoryNo":150,"categoryName":151,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":153,"categoryName":154,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":156,"categoryName":157,"taxonomyType":158,"taxonomyTypeDesc":159},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[125,126,127,161,128,162,129,130,132,163,164,165,166,135,167,21,29,168,169,170],"youtube transcript skills","gemini","search","api","Video","browse","api-integration","free","card","channels",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":181,"publishedAt":38},"01M6Q0EAB96PX83W5PTE8A0R8D","youtube-notetaker","Turn YouTube talks into local study notes with slides, transcripts, editable annotations, and a markdown-backed viewer.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-notetaker\u002FSKILL.md",[177,180],{"categoryNo":178,"categoryName":179,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":153,"categoryName":154,"taxonomyType":81,"taxonomyTypeDesc":82},[127,182,183,105,128,184,185,186,187,132,165,188,189,190,191,29,192,138,193,194],"youtube notetaker","notetaker","workflow","official","notes","code","markdown","slides","annotations","README","study","dair-academy","viewer",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":202,"publishedAt":38},"01M6Q0E55F0GW5MX48V8HXS8B5","youtube-full","Fetch YouTube transcripts, search videos, browse channels, and extract playlists via TranscriptAPI — no yt-dlp, no Google API key, works from any cloud server.","https:\u002F\u002Fgithub.com\u002Fduc-duy-1612\u002FOnline-Delivery-Systems-Web\u002Fblob\u002Fmain\u002F.agents\u002Fskills_archive\u002Fyoutube-full\u002FSKILL.md",[201],{"categoryNo":150,"categoryName":151,"taxonomyType":81,"taxonomyTypeDesc":82},[203,127,204,205,128,162,163,206,207,164,165,166,135,208,167,21,29,168,209,141],"youtube full","full","google","server","dlp","credits","automatic"]