[{"data":1,"prerenderedAt":2051},["ShallowReactive",2],{"page-\u002Flinux\u002F15-performance-and-tuning":3},{"id":4,"title":5,"body":6,"description":2044,"extension":2045,"meta":2046,"navigation":205,"path":2047,"seo":2048,"stem":2049,"__hash__":2050},"content\u002Flinux\u002F15-performance-and-tuning.md","15 — Performance & Tuning",{"type":7,"value":8,"toc":2007},"minimark",[9,13,22,27,146,152,155,160,228,232,339,349,413,437,441,495,501,581,591,594,601,630,653,660,687,691,773,777,894,899,942,945,952,1005,1061,1111,1118,1193,1196,1200,1271,1275,1330,1337,1445,1449,1511,1516,1520,1642,1646,1799,1803,1809,1833,1848,2003],[10,11,5],"h1",{"id":12},"_15-performance-tuning",[14,15,16,17,21],"p",{},"Linux performance tuning is about finding the ",[18,19,20],"strong",{},"bottleneck"," (CPU, memory, disk I\u002FO, network) and addressing it — without making things worse. This chapter covers the tools to identify bottlenecks, the tuning knobs, and the kernel's built-in responses (OOM killer, swappiness).",[23,24,26],"h2",{"id":25},"the-four-resources","The Four Resources",[28,29,30,46],"table",{},[31,32,33],"thead",{},[34,35,36,40,43],"tr",{},[37,38,39],"th",{},"Resource",[37,41,42],{},"Symptom",[37,44,45],{},"Tool",[47,48,49,73,94,122],"tbody",{},[34,50,51,57,60],{},[52,53,54],"td",{},[18,55,56],{},"CPU",[52,58,59],{},"High load, slow response",[52,61,62,66,67,66,70],{},[63,64,65],"code",{},"top",", ",[63,68,69],{},"mpstat",[63,71,72],{},"perf",[34,74,75,80,83],{},[52,76,77],{},[18,78,79],{},"Memory",[52,81,82],{},"OOM, swapping, slow",[52,84,85,66,88,66,91],{},[63,86,87],{},"free",[63,89,90],{},"vmstat",[63,92,93],{},"\u002Fproc\u002Fmeminfo",[34,95,96,101,111],{},[52,97,98],{},[18,99,100],{},"Disk I\u002FO",[52,102,103,104,66,107,110],{},"High ",[63,105,106],{},"await",[63,108,109],{},"%util",", slow apps",[52,112,113,66,116,66,119],{},[63,114,115],{},"iostat",[63,117,118],{},"iotop",[63,120,121],{},"pidstat -d",[34,123,124,129,132],{},[52,125,126],{},[18,127,128],{},"Network",[52,130,131],{},"High latency, low throughput",[52,133,134,66,137,66,140,66,143],{},[63,135,136],{},"iftop",[63,138,139],{},"nethogs",[63,141,142],{},"ss",[63,144,145],{},"mtr",[14,147,148,151],{},[18,149,150],{},"Find the bottleneck first, then tune."," Tuning the wrong resource is at best useless and at worst harmful.",[23,153,56],{"id":154},"cpu",[156,157,159],"h3",{"id":158},"load-average","Load Average",[161,162,164],"code-wrapper",{"language":163},"bash",[165,166,170],"pre",{"className":167,"code":168,"language":163,"meta":169,"style":169},"language-bash shiki shiki-themes github-light github-dark","# Complex Implementation: interpret load average correctly\nuptime\n# ... load average: 1.45, 0.92, 0.78\n#                   1m   5m   15m\n\nnproc                           # CPU count\n# Load = 4 on a 4-core system = fully utilized (good)\n# Load = 8 on a 4-core system = overloaded (processes waiting)\n","",[63,171,172,181,188,194,200,207,216,222],{"__ignoreMap":169},[173,174,177],"span",{"class":175,"line":176},"line",1,[173,178,180],{"class":179},"sdCPZ","# Complex Implementation: interpret load average correctly\n",[173,182,184],{"class":175,"line":183},2,[173,185,187],{"class":186},"sIsaT","uptime\n",[173,189,191],{"class":175,"line":190},3,[173,192,193],{"class":179},"# ... load average: 1.45, 0.92, 0.78\n",[173,195,197],{"class":175,"line":196},4,[173,198,199],{"class":179},"#                   1m   5m   15m\n",[173,201,203],{"class":175,"line":202},5,[173,204,206],{"emptyLinePlaceholder":205},true,"\n",[173,208,210,213],{"class":175,"line":209},6,[173,211,212],{"class":186},"nproc",[173,214,215],{"class":179},"                           # CPU count\n",[173,217,219],{"class":175,"line":218},7,[173,220,221],{"class":179},"# Load = 4 on a 4-core system = fully utilized (good)\n",[173,223,225],{"class":175,"line":224},8,[173,226,227],{"class":179},"# Load = 8 on a 4-core system = overloaded (processes waiting)\n",[156,229,231],{"id":230},"edge-case-high-load-isnt-always-cpu","Edge Case: High Load Isn't Always CPU",[161,233,234],{"language":163},[165,235,237],{"className":167,"code":236,"language":163,"meta":169,"style":169},"# Complex Implementation: diagnose \"high load but CPU looks fine\"\nuptime                          # load average: 16.20, 15.85, 15.70\ntop -b -n 1 | head -5           # CPU: 20% us, 80% id (mostly idle!)\nnproc                           # 4 cores → load 16 = 4x overloaded\n\n# But CPU is idle — where's the bottleneck?\nvmstat 1                        # check the \"b\" and \"wa\" columns\n#  r b  ... wa\n#  0 14 ... 65\n# b=14 (14 processes in D state = uninterruptible I\u002FO wait)\n# wa=65 (65% I\u002FO wait)\n# → The bottleneck is DISK I\u002FO, not CPU!\n# Load average includes D-state processes, so high load + low CPU = disk bottleneck\n",[63,238,239,244,252,279,286,290,295,304,309,315,321,327,333],{"__ignoreMap":169},[173,240,241],{"class":175,"line":176},[173,242,243],{"class":179},"# Complex Implementation: diagnose \"high load but CPU looks fine\"\n",[173,245,246,249],{"class":175,"line":183},[173,247,248],{"class":186},"uptime",[173,250,251],{"class":179},"                          # load average: 16.20, 15.85, 15.70\n",[173,253,254,256,260,263,266,270,273,276],{"class":175,"line":190},[173,255,65],{"class":186},[173,257,259],{"class":258},"snvgF"," -b",[173,261,262],{"class":258}," -n",[173,264,265],{"class":258}," 1",[173,267,269],{"class":268},"svdQ7"," |",[173,271,272],{"class":186}," head",[173,274,275],{"class":258}," -5",[173,277,278],{"class":179},"           # CPU: 20% us, 80% id (mostly idle!)\n",[173,280,281,283],{"class":175,"line":196},[173,282,212],{"class":186},[173,284,285],{"class":179},"                           # 4 cores → load 16 = 4x overloaded\n",[173,287,288],{"class":175,"line":202},[173,289,206],{"emptyLinePlaceholder":205},[173,291,292],{"class":175,"line":209},[173,293,294],{"class":179},"# But CPU is idle — where's the bottleneck?\n",[173,296,297,299,301],{"class":175,"line":218},[173,298,90],{"class":186},[173,300,265],{"class":258},[173,302,303],{"class":179},"                        # check the \"b\" and \"wa\" columns\n",[173,305,306],{"class":175,"line":224},[173,307,308],{"class":179},"#  r b  ... wa\n",[173,310,312],{"class":175,"line":311},9,[173,313,314],{"class":179},"#  0 14 ... 65\n",[173,316,318],{"class":175,"line":317},10,[173,319,320],{"class":179},"# b=14 (14 processes in D state = uninterruptible I\u002FO wait)\n",[173,322,324],{"class":175,"line":323},11,[173,325,326],{"class":179},"# wa=65 (65% I\u002FO wait)\n",[173,328,330],{"class":175,"line":329},12,[173,331,332],{"class":179},"# → The bottleneck is DISK I\u002FO, not CPU!\n",[173,334,336],{"class":175,"line":335},13,[173,337,338],{"class":179},"# Load average includes D-state processes, so high load + low CPU = disk bottleneck\n",[156,340,342,343,345,346,348],{"id":341},"cpu-states-from-vmstat-mpstat","CPU States (from ",[63,344,90],{}," \u002F ",[63,347,69],{},")",[28,350,351,361],{},[31,352,353],{},[34,354,355,358],{},[37,356,357],{},"State",[37,359,360],{},"Meaning",[47,362,363,373,383,393,403],{},[34,364,365,370],{},[52,366,367],{},[63,368,369],{},"us",[52,371,372],{},"User space (applications)",[34,374,375,380],{},[52,376,377],{},[63,378,379],{},"sy",[52,381,382],{},"System\u002Fkernel (syscalls, drivers)",[34,384,385,390],{},[52,386,387],{},[63,388,389],{},"id",[52,391,392],{},"Idle",[34,394,395,400],{},[52,396,397],{},[63,398,399],{},"wa",[52,401,402],{},"I\u002FO wait (waiting for disk)",[34,404,405,410],{},[52,406,407],{},[63,408,409],{},"st",[52,411,412],{},"Stolen (hypervisor took it — VM only)",[414,415,416,422,427,432],"ul",{},[417,418,103,419,421],"li",{},[63,420,369],{}," = CPU-bound app (optimize the app or scale).",[417,423,103,424,426],{},[63,425,379],{}," (>20%) = too many syscalls, kernel work, or driver issue.",[417,428,103,429,431],{},[63,430,399],{}," = disk bottleneck (not CPU!).",[417,433,103,434,436],{},[63,435,409],{}," = noisy neighbor on the VM host.",[156,438,440],{"id":439},"cpu-priority","CPU Priority",[161,442,443],{"language":163},[165,444,446],{"className":167,"code":445,"language":163,"meta":169,"style":169},"# Complex Implementation: low-priority backup job (CPU + I\u002FO)\nnice -n 19 ionice -c 3 tar -czf backup.tar.gz \u002Fhome\n# nice: low CPU priority (19 = lowest)\n# ionice -c 3: idle I\u002FO class (only uses disk when no one else does)\n",[63,447,448,453,485,490],{"__ignoreMap":169},[173,449,450],{"class":175,"line":176},[173,451,452],{"class":179},"# Complex Implementation: low-priority backup job (CPU + I\u002FO)\n",[173,454,455,458,460,463,467,470,473,476,479,482],{"class":175,"line":183},[173,456,457],{"class":186},"nice",[173,459,262],{"class":258},[173,461,462],{"class":258}," 19",[173,464,466],{"class":465},"sJ6F3"," ionice",[173,468,469],{"class":258}," -c",[173,471,472],{"class":258}," 3",[173,474,475],{"class":465}," tar",[173,477,478],{"class":258}," -czf",[173,480,481],{"class":465}," backup.tar.gz",[173,483,484],{"class":465}," \u002Fhome\n",[173,486,487],{"class":175,"line":190},[173,488,489],{"class":179},"# nice: low CPU priority (19 = lowest)\n",[173,491,492],{"class":175,"line":196},[173,493,494],{"class":179},"# ionice -c 3: idle I\u002FO class (only uses disk when no one else does)\n",[156,496,498,500],{"id":497},"perf-profiling",[63,499,72],{}," — Profiling",[161,502,503],{"language":163},[165,504,506],{"className":167,"code":505,"language":163,"meta":169,"style":169},"# Complex Implementation: find the exact function using CPU\nsudo perf top                    # live function-level profiling\nsudo perf record -p 1234 -- sleep 10   # record for 10s\nsudo perf report                 # analyze the recording\nsudo perf stat command           # counter stats (cache misses, branches)\n",[63,507,508,513,527,554,566],{"__ignoreMap":169},[173,509,510],{"class":175,"line":176},[173,511,512],{"class":179},"# Complex Implementation: find the exact function using CPU\n",[173,514,515,518,521,524],{"class":175,"line":183},[173,516,517],{"class":186},"sudo",[173,519,520],{"class":465}," perf",[173,522,523],{"class":465}," top",[173,525,526],{"class":179},"                    # live function-level profiling\n",[173,528,529,531,533,536,539,542,545,548,551],{"class":175,"line":190},[173,530,517],{"class":186},[173,532,520],{"class":465},[173,534,535],{"class":465}," record",[173,537,538],{"class":258}," -p",[173,540,541],{"class":258}," 1234",[173,543,544],{"class":258}," --",[173,546,547],{"class":465}," sleep",[173,549,550],{"class":258}," 10",[173,552,553],{"class":179},"   # record for 10s\n",[173,555,556,558,560,563],{"class":175,"line":196},[173,557,517],{"class":186},[173,559,520],{"class":465},[173,561,562],{"class":465}," report",[173,564,565],{"class":179},"                 # analyze the recording\n",[173,567,568,570,572,575,578],{"class":175,"line":202},[173,569,517],{"class":186},[173,571,520],{"class":465},[173,573,574],{"class":465}," stat",[173,576,577],{"class":465}," command",[173,579,580],{"class":179},"           # counter stats (cache misses, branches)\n",[14,582,583,585,586,590],{},[63,584,72],{}," shows ",[587,588,589],"em",{},"which function"," is using the CPU — essential for optimizing a slow app.",[23,592,79],{"id":593},"memory",[156,595,597,598],{"id":596},"understanding-free-h","Understanding ",[63,599,600],{},"free -h",[161,602,603],{"language":163},[165,604,606],{"className":167,"code":605,"language":163,"meta":169,"style":169},"free -h\n#               total   used    free   shared  buff\u002Fcache  available\n# Mem:           15G     4.2G    2.1G   210M    9.3G         10G\n# Swap:         2.0G     0B     2.0G\n",[63,607,608,615,620,625],{"__ignoreMap":169},[173,609,610,612],{"class":175,"line":176},[173,611,87],{"class":186},[173,613,614],{"class":258}," -h\n",[173,616,617],{"class":175,"line":183},[173,618,619],{"class":179},"#               total   used    free   shared  buff\u002Fcache  available\n",[173,621,622],{"class":175,"line":190},[173,623,624],{"class":179},"# Mem:           15G     4.2G    2.1G   210M    9.3G         10G\n",[173,626,627],{"class":175,"line":196},[173,628,629],{"class":179},"# Swap:         2.0G     0B     2.0G\n",[414,631,632,645],{},[417,633,634,637,638,641,642,644],{},[18,635,636],{},"available"," — estimate of RAM available for new apps (free + reclaimable cache). ",[18,639,640],{},"This is the number to watch",", not ",[63,643,87],{},".",[417,646,647,649,650,652],{},[18,648,87],{}," — completely unused RAM. Linux uses free RAM for cache (making things faster). ",[63,651,87],{}," near 0 is normal and fine.",[156,654,656,657,659],{"id":655},"edge-case-low-free-is-normal","Edge Case: Low ",[63,658,87],{}," Is Normal",[161,661,662],{"language":163},[165,663,665],{"className":167,"code":664,"language":163,"meta":169,"style":169},"# NAIVE: panic at low free RAM and add swap (unnecessary)\n# \"free is only 200 MB! We need more swap!\"\n# PRODUCTION: check \"available\" instead\n# available = 10 GB → plenty of memory. free is low because Linux uses RAM for cache.\n",[63,666,667,672,677,682],{"__ignoreMap":169},[173,668,669],{"class":175,"line":176},[173,670,671],{"class":179},"# NAIVE: panic at low free RAM and add swap (unnecessary)\n",[173,673,674],{"class":175,"line":183},[173,675,676],{"class":179},"# \"free is only 200 MB! We need more swap!\"\n",[173,678,679],{"class":175,"line":190},[173,680,681],{"class":179},"# PRODUCTION: check \"available\" instead\n",[173,683,684],{"class":175,"line":196},[173,685,686],{"class":179},"# available = 10 GB → plenty of memory. free is low because Linux uses RAM for cache.\n",[156,688,690],{"id":689},"swap","Swap",[161,692,693],{"language":163},[165,694,696],{"className":167,"code":695,"language":163,"meta":169,"style":169},"swapon --show                   # active swap\ncat \u002Fproc\u002Fsys\u002Fvm\u002Fswappiness     # tendency to swap (0-100, default 60)\nvmstat 1                        # si\u002Fso columns = swap in\u002Fout (should be 0)\n\n# Tune swappiness:\nsudo sysctl vm.swappiness=10    # servers: 10, databases: 1\necho \"vm.swappiness = 10\" | sudo tee \u002Fetc\u002Fsysctl.d\u002F99-swappiness.conf\n",[63,697,698,709,720,729,733,738,754],{"__ignoreMap":169},[173,699,700,703,706],{"class":175,"line":176},[173,701,702],{"class":186},"swapon",[173,704,705],{"class":258}," --show",[173,707,708],{"class":179},"                   # active swap\n",[173,710,711,714,717],{"class":175,"line":183},[173,712,713],{"class":186},"cat",[173,715,716],{"class":465}," \u002Fproc\u002Fsys\u002Fvm\u002Fswappiness",[173,718,719],{"class":179},"     # tendency to swap (0-100, default 60)\n",[173,721,722,724,726],{"class":175,"line":190},[173,723,90],{"class":186},[173,725,265],{"class":258},[173,727,728],{"class":179},"                        # si\u002Fso columns = swap in\u002Fout (should be 0)\n",[173,730,731],{"class":175,"line":196},[173,732,206],{"emptyLinePlaceholder":205},[173,734,735],{"class":175,"line":202},[173,736,737],{"class":179},"# Tune swappiness:\n",[173,739,740,742,745,748,751],{"class":175,"line":209},[173,741,517],{"class":186},[173,743,744],{"class":465}," sysctl",[173,746,747],{"class":465}," vm.swappiness=",[173,749,750],{"class":258},"10",[173,752,753],{"class":179},"    # servers: 10, databases: 1\n",[173,755,756,759,762,764,767,770],{"class":175,"line":218},[173,757,758],{"class":258},"echo",[173,760,761],{"class":465}," \"vm.swappiness = 10\"",[173,763,269],{"class":268},[173,765,766],{"class":186}," sudo",[173,768,769],{"class":465}," tee",[173,771,772],{"class":465}," \u002Fetc\u002Fsysctl.d\u002F99-swappiness.conf\n",[156,774,776],{"id":775},"oom-killer","OOM Killer",[161,778,779],{"language":163},[165,780,782],{"className":167,"code":781,"language":163,"meta":169,"style":169},"# Complex Implementation: protect critical services from OOM killer\n# The OOM killer picks the process with the highest oom_score (biggest memory consumer)\n# — which might be your database, not the misbehaving app\n\n# Check a process's OOM score:\ncat \u002Fproc\u002F\u003Cpid>\u002Foom_score\n\n# Protect a service (in systemd unit):\n# [Service]\n# OOMScoreAdjust=-500      # protect this service (lower = less likely killed)\n\n# Check OOM kills:\njournalctl -k | grep -i \"out of memory\"\njournalctl -k | grep -i \"killed process\"\n",[63,783,784,789,794,799,803,808,831,835,840,845,850,854,859,878],{"__ignoreMap":169},[173,785,786],{"class":175,"line":176},[173,787,788],{"class":179},"# Complex Implementation: protect critical services from OOM killer\n",[173,790,791],{"class":175,"line":183},[173,792,793],{"class":179},"# The OOM killer picks the process with the highest oom_score (biggest memory consumer)\n",[173,795,796],{"class":175,"line":190},[173,797,798],{"class":179},"# — which might be your database, not the misbehaving app\n",[173,800,801],{"class":175,"line":196},[173,802,206],{"emptyLinePlaceholder":205},[173,804,805],{"class":175,"line":202},[173,806,807],{"class":179},"# Check a process's OOM score:\n",[173,809,810,812,815,818,821,825,828],{"class":175,"line":209},[173,811,713],{"class":186},[173,813,814],{"class":465}," \u002Fproc\u002F",[173,816,817],{"class":268},"\u003C",[173,819,820],{"class":465},"pi",[173,822,824],{"class":823},"ssxIu","d",[173,826,827],{"class":268},">",[173,829,830],{"class":465},"\u002Foom_score\n",[173,832,833],{"class":175,"line":218},[173,834,206],{"emptyLinePlaceholder":205},[173,836,837],{"class":175,"line":224},[173,838,839],{"class":179},"# Protect a service (in systemd unit):\n",[173,841,842],{"class":175,"line":311},[173,843,844],{"class":179},"# [Service]\n",[173,846,847],{"class":175,"line":317},[173,848,849],{"class":179},"# OOMScoreAdjust=-500      # protect this service (lower = less likely killed)\n",[173,851,852],{"class":175,"line":323},[173,853,206],{"emptyLinePlaceholder":205},[173,855,856],{"class":175,"line":329},[173,857,858],{"class":179},"# Check OOM kills:\n",[173,860,861,864,867,869,872,875],{"class":175,"line":335},[173,862,863],{"class":186},"journalctl",[173,865,866],{"class":258}," -k",[173,868,269],{"class":268},[173,870,871],{"class":186}," grep",[173,873,874],{"class":258}," -i",[173,876,877],{"class":465}," \"out of memory\"\n",[173,879,881,883,885,887,889,891],{"class":175,"line":880},14,[173,882,863],{"class":186},[173,884,866],{"class":258},[173,886,269],{"class":268},[173,888,871],{"class":186},[173,890,874],{"class":258},[173,892,893],{"class":465}," \"killed process\"\n",[156,895,897],{"id":896},"overcommit",[63,898,896],{},[161,900,901],{"language":163},[165,902,904],{"className":167,"code":903,"language":163,"meta":169,"style":169},"cat \u002Fproc\u002Fsys\u002Fvm\u002Fovercommit_memory\n# 0 = heuristic (default — allow reasonable overcommit)\n# 1 = always (allow any allocation — dangerous)\n# 2 = strict (never overcommit — safer for databases)\n\n# For databases (PostgreSQL, Oracle): set vm.overcommit_memory=2\n# to get predictable allocation failures instead of OOM kills\n",[63,905,906,913,918,923,928,932,937],{"__ignoreMap":169},[173,907,908,910],{"class":175,"line":176},[173,909,713],{"class":186},[173,911,912],{"class":465}," \u002Fproc\u002Fsys\u002Fvm\u002Fovercommit_memory\n",[173,914,915],{"class":175,"line":183},[173,916,917],{"class":179},"# 0 = heuristic (default — allow reasonable overcommit)\n",[173,919,920],{"class":175,"line":190},[173,921,922],{"class":179},"# 1 = always (allow any allocation — dangerous)\n",[173,924,925],{"class":175,"line":196},[173,926,927],{"class":179},"# 2 = strict (never overcommit — safer for databases)\n",[173,929,930],{"class":175,"line":202},[173,931,206],{"emptyLinePlaceholder":205},[173,933,934],{"class":175,"line":209},[173,935,936],{"class":179},"# For databases (PostgreSQL, Oracle): set vm.overcommit_memory=2\n",[173,938,939],{"class":175,"line":218},[173,940,941],{"class":179},"# to get predictable allocation failures instead of OOM kills\n",[23,943,100],{"id":944},"disk-io",[156,946,948,951],{"id":947},"iostat-x-key-columns",[63,949,950],{},"iostat -x"," Key Columns",[161,953,954],{"language":163},[165,955,957],{"className":167,"code":956,"language":163,"meta":169,"style":169},"Device  r\u002Fs  w\u002Fs  rkB\u002Fs  wkB\u002Fs  %util  await\nsda     50   100  800    1600    85     15.2\n",[63,958,959,982],{"__ignoreMap":169},[173,960,961,964,967,970,973,976,979],{"class":175,"line":176},[173,962,963],{"class":186},"Device",[173,965,966],{"class":465},"  r\u002Fs",[173,968,969],{"class":465},"  w\u002Fs",[173,971,972],{"class":465},"  rkB\u002Fs",[173,974,975],{"class":465},"  wkB\u002Fs",[173,977,978],{"class":465},"  %util",[173,980,981],{"class":465},"  await\n",[173,983,984,987,990,993,996,999,1002],{"class":175,"line":183},[173,985,986],{"class":186},"sda",[173,988,989],{"class":258},"     50",[173,991,992],{"class":258},"   100",[173,994,995],{"class":258},"  800",[173,997,998],{"class":258},"    1600",[173,1000,1001],{"class":258},"    85",[173,1003,1004],{"class":258},"     15.2\n",[28,1006,1007,1019],{},[31,1008,1009],{},[34,1010,1011,1014,1016],{},[37,1012,1013],{},"Column",[37,1015,360],{},[37,1017,1018],{},"Concerning",[47,1020,1021,1033,1045],{},[34,1022,1023,1027,1030],{},[52,1024,1025],{},[63,1026,109],{},[52,1028,1029],{},"% of time the device was busy",[52,1031,1032],{},"near 100% = saturated",[34,1034,1035,1039,1042],{},[52,1036,1037],{},[63,1038,106],{},[52,1040,1041],{},"Average time (ms) for I\u002FO to complete",[52,1043,1044],{},"> 10-20 ms (SSD), > 50 ms (HDD)",[34,1046,1047,1055,1058],{},[52,1048,1049,66,1052],{},[63,1050,1051],{},"r\u002Fs",[63,1053,1054],{},"w\u002Fs",[52,1056,1057],{},"Reads\u002Fwrites per second",[52,1059,1060],{},"compare to device specs",[161,1062,1063],{"language":163},[165,1064,1066],{"className":167,"code":1065,"language":163,"meta":169,"style":169},"# Complex Implementation: disk bottleneck diagnosis\niostat -x 1 5                   # 5 samples, 1s apart — watch for sustained high %util\niotop -o                        # which process is doing the I\u002FO?\npidstat -d 1                    # per-process disk I\u002FO\n",[63,1067,1068,1073,1088,1098],{"__ignoreMap":169},[173,1069,1070],{"class":175,"line":176},[173,1071,1072],{"class":179},"# Complex Implementation: disk bottleneck diagnosis\n",[173,1074,1075,1077,1080,1082,1085],{"class":175,"line":183},[173,1076,115],{"class":186},[173,1078,1079],{"class":258}," -x",[173,1081,265],{"class":258},[173,1083,1084],{"class":258}," 5",[173,1086,1087],{"class":179},"                   # 5 samples, 1s apart — watch for sustained high %util\n",[173,1089,1090,1092,1095],{"class":175,"line":190},[173,1091,118],{"class":186},[173,1093,1094],{"class":258}," -o",[173,1096,1097],{"class":179},"                        # which process is doing the I\u002FO?\n",[173,1099,1100,1103,1106,1108],{"class":175,"line":196},[173,1101,1102],{"class":186},"pidstat",[173,1104,1105],{"class":258}," -d",[173,1107,265],{"class":258},[173,1109,1110],{"class":179},"                    # per-process disk I\u002FO\n",[156,1112,1114,1115],{"id":1113},"io-priority-ionice","I\u002FO Priority: ",[63,1116,1117],{},"ionice",[161,1119,1120],{"language":163},[165,1121,1123],{"className":167,"code":1122,"language":163,"meta":169,"style":169},"# Classes:\n# 1 (realtime) — highest, can starve others (NEVER on shared systems)\n# 2 (best-effort, default) — priority 0-7 (0 highest)\n# 3 (idle) — only when no one else is using the disk\n\nionice -c 3 -n 7 tar -czf backup.tar.gz \u002Fhome    # idle (safe)\nionice -c 2 -n 0 command                          # best-effort, high priority\n",[63,1124,1125,1130,1135,1140,1145,1149,1174],{"__ignoreMap":169},[173,1126,1127],{"class":175,"line":176},[173,1128,1129],{"class":179},"# Classes:\n",[173,1131,1132],{"class":175,"line":183},[173,1133,1134],{"class":179},"# 1 (realtime) — highest, can starve others (NEVER on shared systems)\n",[173,1136,1137],{"class":175,"line":190},[173,1138,1139],{"class":179},"# 2 (best-effort, default) — priority 0-7 (0 highest)\n",[173,1141,1142],{"class":175,"line":196},[173,1143,1144],{"class":179},"# 3 (idle) — only when no one else is using the disk\n",[173,1146,1147],{"class":175,"line":202},[173,1148,206],{"emptyLinePlaceholder":205},[173,1150,1151,1153,1155,1157,1159,1162,1164,1166,1168,1171],{"class":175,"line":209},[173,1152,1117],{"class":186},[173,1154,469],{"class":258},[173,1156,472],{"class":258},[173,1158,262],{"class":258},[173,1160,1161],{"class":258}," 7",[173,1163,475],{"class":465},[173,1165,478],{"class":258},[173,1167,481],{"class":465},[173,1169,1170],{"class":465}," \u002Fhome",[173,1172,1173],{"class":179},"    # idle (safe)\n",[173,1175,1176,1178,1180,1183,1185,1188,1190],{"class":175,"line":218},[173,1177,1117],{"class":186},[173,1179,469],{"class":258},[173,1181,1182],{"class":258}," 2",[173,1184,262],{"class":258},[173,1186,1187],{"class":258}," 0",[173,1189,577],{"class":465},[173,1191,1192],{"class":179},"                          # best-effort, high priority\n",[23,1194,128],{"id":1195},"network",[156,1197,1199],{"id":1198},"network-tuning","Network Tuning",[161,1201,1202],{"language":163},[165,1203,1205],{"className":167,"code":1204,"language":163,"meta":169,"style":169},"# \u002Fetc\u002Fsysctl.d\u002F99-network.conf — high-traffic server\nnet.core.somaxconn = 65535\nnet.core.rmem_max = 16777216\nnet.core.wmem_max = 16777216\nnet.ipv4.tcp_tw_reuse = 1\nnet.ipv4.tcp_max_syn_backlog = 65535\nnet.ipv4.tcp_congestion_control = bbr\n",[63,1206,1207,1212,1223,1233,1242,1252,1261],{"__ignoreMap":169},[173,1208,1209],{"class":175,"line":176},[173,1210,1211],{"class":179},"# \u002Fetc\u002Fsysctl.d\u002F99-network.conf — high-traffic server\n",[173,1213,1214,1217,1220],{"class":175,"line":183},[173,1215,1216],{"class":186},"net.core.somaxconn",[173,1218,1219],{"class":465}," =",[173,1221,1222],{"class":258}," 65535\n",[173,1224,1225,1228,1230],{"class":175,"line":190},[173,1226,1227],{"class":186},"net.core.rmem_max",[173,1229,1219],{"class":465},[173,1231,1232],{"class":258}," 16777216\n",[173,1234,1235,1238,1240],{"class":175,"line":196},[173,1236,1237],{"class":186},"net.core.wmem_max",[173,1239,1219],{"class":465},[173,1241,1232],{"class":258},[173,1243,1244,1247,1249],{"class":175,"line":202},[173,1245,1246],{"class":186},"net.ipv4.tcp_tw_reuse",[173,1248,1219],{"class":465},[173,1250,1251],{"class":258}," 1\n",[173,1253,1254,1257,1259],{"class":175,"line":209},[173,1255,1256],{"class":186},"net.ipv4.tcp_max_syn_backlog",[173,1258,1219],{"class":465},[173,1260,1222],{"class":258},[173,1262,1263,1266,1268],{"class":175,"line":218},[173,1264,1265],{"class":186},"net.ipv4.tcp_congestion_control",[173,1267,1219],{"class":465},[173,1269,1270],{"class":465}," bbr\n",[156,1272,1274],{"id":1273},"enable-bbr","Enable BBR",[161,1276,1277],{"language":163},[165,1278,1280],{"className":167,"code":1279,"language":163,"meta":169,"style":169},"# BBR (Bottleneck Bandwidth and RTT) — often better than cubic on high-latency links\necho \"net.core.default_qdisc = fq\" | sudo tee \u002Fetc\u002Fsysctl.d\u002F99-bbr.conf\necho \"net.ipv4.tcp_congestion_control = bbr\" | sudo tee -a \u002Fetc\u002Fsysctl.d\u002F99-bbr.conf\nsudo sysctl --system\n",[63,1281,1282,1287,1303,1321],{"__ignoreMap":169},[173,1283,1284],{"class":175,"line":176},[173,1285,1286],{"class":179},"# BBR (Bottleneck Bandwidth and RTT) — often better than cubic on high-latency links\n",[173,1288,1289,1291,1294,1296,1298,1300],{"class":175,"line":183},[173,1290,758],{"class":258},[173,1292,1293],{"class":465}," \"net.core.default_qdisc = fq\"",[173,1295,269],{"class":268},[173,1297,766],{"class":186},[173,1299,769],{"class":465},[173,1301,1302],{"class":465}," \u002Fetc\u002Fsysctl.d\u002F99-bbr.conf\n",[173,1304,1305,1307,1310,1312,1314,1316,1319],{"class":175,"line":190},[173,1306,758],{"class":258},[173,1308,1309],{"class":465}," \"net.ipv4.tcp_congestion_control = bbr\"",[173,1311,269],{"class":268},[173,1313,766],{"class":186},[173,1315,769],{"class":465},[173,1317,1318],{"class":258}," -a",[173,1320,1302],{"class":465},[173,1322,1323,1325,1327],{"class":175,"line":196},[173,1324,517],{"class":186},[173,1326,744],{"class":465},[173,1328,1329],{"class":258}," --system\n",[23,1331,1333,1336],{"id":1332},"cgroups-resource-limits",[63,1334,1335],{},"cgroups"," — Resource Limits",[161,1338,1339],{"language":163},[165,1340,1342],{"className":167,"code":1341,"language":163,"meta":169,"style":169},"# Complex Implementation: limit a service's resources via systemd\n# In a unit file:\n[Service]\nCPUQuota=50%              # max 50% CPU\nMemoryMax=512M            # hard memory limit (OOM-kill if exceeded)\nTasksMax=100              # max PIDs\nIOWeight=100              # I\u002FO weight (1-10000)\n\n# Ad-hoc:\nsudo systemd-run --unit=test --CPUQuota=25% --MemoryMax=256M stress --cpu 4\n",[63,1343,1344,1349,1354,1359,1373,1386,1399,1411,1415,1420],{"__ignoreMap":169},[173,1345,1346],{"class":175,"line":176},[173,1347,1348],{"class":179},"# Complex Implementation: limit a service's resources via systemd\n",[173,1350,1351],{"class":175,"line":183},[173,1352,1353],{"class":179},"# In a unit file:\n",[173,1355,1356],{"class":175,"line":190},[173,1357,1358],{"class":823},"[Service]\n",[173,1360,1361,1364,1367,1370],{"class":175,"line":196},[173,1362,1363],{"class":823},"CPUQuota",[173,1365,1366],{"class":268},"=",[173,1368,1369],{"class":465},"50%",[173,1371,1372],{"class":179},"              # max 50% CPU\n",[173,1374,1375,1378,1380,1383],{"class":175,"line":202},[173,1376,1377],{"class":823},"MemoryMax",[173,1379,1366],{"class":268},[173,1381,1382],{"class":465},"512M",[173,1384,1385],{"class":179},"            # hard memory limit (OOM-kill if exceeded)\n",[173,1387,1388,1391,1393,1396],{"class":175,"line":209},[173,1389,1390],{"class":823},"TasksMax",[173,1392,1366],{"class":268},[173,1394,1395],{"class":465},"100",[173,1397,1398],{"class":179},"              # max PIDs\n",[173,1400,1401,1404,1406,1408],{"class":175,"line":218},[173,1402,1403],{"class":823},"IOWeight",[173,1405,1366],{"class":268},[173,1407,1395],{"class":465},[173,1409,1410],{"class":179},"              # I\u002FO weight (1-10000)\n",[173,1412,1413],{"class":175,"line":224},[173,1414,206],{"emptyLinePlaceholder":205},[173,1416,1417],{"class":175,"line":311},[173,1418,1419],{"class":179},"# Ad-hoc:\n",[173,1421,1422,1424,1427,1430,1433,1436,1439,1442],{"class":175,"line":317},[173,1423,517],{"class":186},[173,1425,1426],{"class":465}," systemd-run",[173,1428,1429],{"class":258}," --unit=test",[173,1431,1432],{"class":258}," --CPUQuota=25%",[173,1434,1435],{"class":258}," --MemoryMax=256M",[173,1437,1438],{"class":465}," stress",[173,1440,1441],{"class":258}," --cpu",[173,1443,1444],{"class":258}," 4\n",[23,1446,1448],{"id":1447},"quick-diagnostic-flow","Quick Diagnostic Flow",[1450,1451,1452,1471,1485,1500],"ol",{},[417,1453,1454,1457,1458,1460,1461,1464,1465,1467,1468,1470],{},[18,1455,1456],{},"Is it CPU?"," ",[63,1459,248],{}," (high load?), ",[63,1462,1463],{},"vmstat 1"," (high ",[63,1466,369],{},"\u002F",[63,1469,379],{},"?).",[417,1472,1473,1457,1476,1478,1479,1481,1482,1484],{},[18,1474,1475],{},"Is it memory?",[63,1477,600],{}," (low ",[63,1480,636],{},"?), ",[63,1483,1463],{}," (si\u002Fso non-zero?).",[417,1486,1487,1457,1490,1464,1493,1467,1495,1481,1497,1499],{},[18,1488,1489],{},"Is it disk?",[63,1491,1492],{},"iostat -x 1",[63,1494,109],{},[63,1496,106],{},[63,1498,118],{}," (which process?).",[417,1501,1502,1457,1505,1507,1508,1510],{},[18,1503,1504],{},"Is it network?",[63,1506,136],{}," (bandwidth?), ",[63,1509,145],{}," (latency\u002Floss?).",[14,1512,1513],{},[18,1514,1515],{},"Don't tune until you've identified the bottleneck.",[23,1517,1519],{"id":1518},"tips-tricks","💡 Tips & Tricks",[414,1521,1522,1543,1558,1573,1582,1595,1613,1634],{},[417,1523,1524,1527,1528,1530,1531,1533,1534,1536,1537,1539,1540,1542],{},[18,1525,1526],{},"Idiom",": use ",[63,1529,600],{}," and watch ",[63,1532,636],{}," (not ",[63,1535,87],{},") — Linux uses free RAM for cache (good). ",[63,1538,636],{}," is what apps can actually use. Low ",[63,1541,636],{}," = memory pressure.",[417,1544,1545,1527,1547,1530,1549,1551,1552,1554,1555,1557],{},[18,1546,1526],{},[63,1548,1492],{},[63,1550,109],{}," + ",[63,1553,106],{}," — ",[63,1556,109],{}," near 100% = disk saturated. This is the #1 cause of \"the app is slow\" — usually disk, not CPU.",[417,1559,1560,1527,1562,1551,1565,1568,1569,1572],{},[18,1561,1526],{},[63,1563,1564],{},"nice -n 19",[63,1566,1567],{},"ionice -c3"," for non-urgent heavy jobs — backups, ",[63,1570,1571],{},"find \u002F",", indexing. Prevents heavy jobs from disrupting interactive work.",[417,1574,1575,1577,1578,1581],{},[18,1576,1526],{},": set ",[63,1579,1580],{},"vm.swappiness=10"," on servers (1 for databases) — default 60 swaps too eagerly for production.",[417,1583,1584,1586,1587,1590,1591,1594],{},[18,1585,1526],{},": use systemd ",[63,1588,1589],{},"MemoryMax="," to limit service memory — prevents a buggy service from eating all RAM and triggering OOM killer (which might kill the ",[587,1592,1593],{},"wrong"," process).",[417,1596,1597,1527,1600,1602,1603,1605,1606,1609,1610,1612],{},[18,1598,1599],{},"Debug",[63,1601,1463],{}," and check ",[63,1604,399],{}," (I\u002FO wait) + ",[63,1607,1608],{},"b"," (blocked) — if load is high but ",[63,1611,369],{}," (user CPU) is low, the bottleneck is disk I\u002FO, not CPU. This is the most common \"high load but CPU looks fine\" mystery.",[417,1614,1615,1527,1617,1620,1621,1623,1624,1627,1628,1623,1630,1633],{},[18,1616,1599],{},[63,1618,1619],{},"perf top"," to find the exact function using CPU — ",[63,1622,65],{}," shows which ",[587,1625,1626],{},"process"," is busy, ",[63,1629,1619],{},[587,1631,1632],{},"function"," within it.",[417,1635,1636,1527,1638,1641],{},[18,1637,1599],{},[63,1639,1640],{},"journalctl -k | grep -i oom"," after a mysterious process death — the OOM killer logs which process it killed and why.",[23,1643,1645],{"id":1644},"️-edge-cases-gotchas","⚠️ Edge Cases & Gotchas",[414,1647,1648,1666,1684,1705,1718,1741,1754,1771,1780,1793],{},[417,1649,1650,1653,1654,1657,1658,1554,1660,1662,1663,1665],{},[18,1651,1652],{},"High load average isn't always CPU",": load includes processes in ",[63,1655,1656],{},"D"," state (uninterruptible I\u002FO wait). High load + low CPU = disk bottleneck. Check ",[63,1659,90],{},[63,1661,1608],{}," (blocked) and ",[63,1664,399],{}," (I\u002FO wait) reveal the true cause.",[417,1667,1668,1673,1674,1676,1677,1679,1680,1683],{},[18,1669,1670,1672],{},[63,1671,87],{}," being low is normal",": Linux uses free RAM for page cache. ",[63,1675,87],{}," near 0 is expected. Watch ",[63,1678,636],{}," — if ",[587,1681,1682],{},"that's"," low, you're out of memory.",[417,1685,1686,1689,1690,1467,1693,1696,1697,1699,1700,1467,1702,1704],{},[18,1687,1688],{},"Swapping kills performance silently",": even small ",[63,1691,1692],{},"si",[63,1694,1695],{},"so"," in ",[63,1698,90],{}," causes huge latency spikes (disk is ~1000x slower than RAM). If ",[63,1701,1692],{},[63,1703,1695],{}," is non-zero, you have memory pressure.",[417,1706,1707,1710,1711,1714,1715,644],{},[18,1708,1709],{},"OOM killer may kill the wrong process",": it picks the highest ",[63,1712,1713],{},"oom_score"," (biggest memory user) — which might be your database. Protect with ",[63,1716,1717],{},"OOMScoreAdjust=-1000",[417,1719,1720,1725,1726,1729,1730,1732,1733,1467,1735,1737,1738,1740],{},[18,1721,1722,1724],{},[63,1723,457],{}," doesn't affect I\u002FO or memory",": a ",[63,1727,1728],{},"nice 19"," process still hammers the disk. Use ",[63,1731,1567],{}," for I\u002FO and ",[63,1734,1335],{},[63,1736,1377],{}," for memory. ",[63,1739,457],{}," is CPU-only.",[417,1742,1743,1749,1750,1753],{},[18,1744,1745,1748],{},[63,1746,1747],{},"ionice -c1"," (realtime) can starve the disk",": it blocks all other I\u002FO. Never use on a shared system. Use ",[63,1751,1752],{},"-c3"," (idle).",[417,1755,1756,1762,1763,1766,1767,1770],{},[18,1757,1758,1761],{},[63,1759,1760],{},"noatime"," can break some apps",": a few apps (like ",[63,1764,1765],{},"mutt",") rely on access times. ",[63,1768,1769],{},"relatime"," (default) is safer.",[417,1772,1773,1779],{},[18,1774,1775,1778],{},[63,1776,1777],{},"barrier=0"," risks data corruption on power loss",": faster but risks filesystem corruption. Don't use in production unless you have a battery-backed cache.",[417,1781,1782,1785,1786,66,1789,1792],{},[18,1783,1784],{},"Tuning can make things worse",": changing ",[63,1787,1788],{},"tcp_tw_reuse",[63,1790,1791],{},"dirty_ratio",", scheduler without measuring can degrade performance. Always benchmark before and after. Keep changes small and test one at a time.",[417,1794,1795,1798],{},[18,1796,1797],{},"BBR can hurt on some networks",": great on high-latency\u002Flossy links but can be aggressive on local networks. Test before deploying.",[23,1800,1802],{"id":1801},"spot-the-bug","🧠 Spot the Bug",[14,1804,1805,1806,1808],{},"A server is slow. The admin checks ",[63,1807,248],{},":",[161,1810,1811],{"language":163},[165,1812,1814],{"className":167,"code":1813,"language":163,"meta":169,"style":169},"load average: 16.20, 15.85, 15.70\n",[63,1815,1816],{"__ignoreMap":169},[173,1817,1818,1821,1824,1827,1830],{"class":175,"line":176},[173,1819,1820],{"class":186},"load",[173,1822,1823],{"class":465}," average:",[173,1825,1826],{"class":465}," 16.20,",[173,1828,1829],{"class":465}," 15.85,",[173,1831,1832],{"class":258}," 15.70\n",[14,1834,1835,1836,1838,1839,1841,1842,1844,1845,1847],{},"They check ",[63,1837,65],{}," — CPU usage is 20% (",[63,1840,369],{}," 15%, ",[63,1843,379],{}," 5%, ",[63,1846,389],{}," 80%). They conclude \"the load is wrong, CPU is mostly idle.\" They check CPU count: 4 cores. What's actually happening, and what should they check next?",[1849,1850,1851,1855,1867,1874,1879,1955,1958,1997],"details",{},[1852,1853,1854],"summary",{},"Answer",[14,1856,1857,1863,1864,1866],{},[18,1858,1859,1860,1862],{},"The load average includes processes in ",[63,1861,1656],{}," state (uninterruptible I\u002FO wait), not just CPU-bound processes."," Load 16 on a 4-core system with 80% idle CPU means ~14 processes are stuck in I\u002FO wait (state ",[63,1865,1656],{},"), not waiting for CPU.",[14,1868,1869,1870,1873],{},"The bottleneck is ",[18,1871,1872],{},"disk I\u002FO",", not CPU.",[14,1875,1876],{},[18,1877,1878],{},"Check:",[161,1880,1881],{"language":163},[165,1882,1884],{"className":167,"code":1883,"language":163,"meta":169,"style":169},"vmstat 1\n#  r  b  swpd  free  buff  cache  si  so  bi  bo  in  cs  us  sy  id  wa  st\n#  0  14     0 200M   1G    8G     0   0  40  80  ...  ...  15   5  20  60   0\n#                    ↑                                                ↑\n#  b=14 (14 processes in D state)                      wa=60 (60% I\u002FO wait)\n\niostat -x 1\n# Device  %util  await\n# sda      98     45.2\n# → disk is 98% utilized, 45ms average wait = saturated\n\niotop -o\n# → find which process is doing the I\u002FO\n",[63,1885,1886,1892,1897,1902,1907,1912,1916,1924,1929,1934,1939,1943,1950],{"__ignoreMap":169},[173,1887,1888,1890],{"class":175,"line":176},[173,1889,90],{"class":186},[173,1891,1251],{"class":258},[173,1893,1894],{"class":175,"line":183},[173,1895,1896],{"class":179},"#  r  b  swpd  free  buff  cache  si  so  bi  bo  in  cs  us  sy  id  wa  st\n",[173,1898,1899],{"class":175,"line":190},[173,1900,1901],{"class":179},"#  0  14     0 200M   1G    8G     0   0  40  80  ...  ...  15   5  20  60   0\n",[173,1903,1904],{"class":175,"line":196},[173,1905,1906],{"class":179},"#                    ↑                                                ↑\n",[173,1908,1909],{"class":175,"line":202},[173,1910,1911],{"class":179},"#  b=14 (14 processes in D state)                      wa=60 (60% I\u002FO wait)\n",[173,1913,1914],{"class":175,"line":209},[173,1915,206],{"emptyLinePlaceholder":205},[173,1917,1918,1920,1922],{"class":175,"line":218},[173,1919,115],{"class":186},[173,1921,1079],{"class":258},[173,1923,1251],{"class":258},[173,1925,1926],{"class":175,"line":224},[173,1927,1928],{"class":179},"# Device  %util  await\n",[173,1930,1931],{"class":175,"line":311},[173,1932,1933],{"class":179},"# sda      98     45.2\n",[173,1935,1936],{"class":175,"line":317},[173,1937,1938],{"class":179},"# → disk is 98% utilized, 45ms average wait = saturated\n",[173,1940,1941],{"class":175,"line":323},[173,1942,206],{"emptyLinePlaceholder":205},[173,1944,1945,1947],{"class":175,"line":329},[173,1946,118],{"class":186},[173,1948,1949],{"class":258}," -o\n",[173,1951,1952],{"class":175,"line":335},[173,1953,1954],{"class":179},"# → find which process is doing the I\u002FO\n",[14,1956,1957],{},"The fix depends on the cause:",[414,1959,1960,1966,1978,1991],{},[417,1961,1962,1965],{},[18,1963,1964],{},"Disk too slow",": upgrade to SSD, add more disks (RAID), or use a faster filesystem.",[417,1967,1968,1971,1972,1974,1975,1977],{},[18,1969,1970],{},"One process hogging I\u002FO",": ",[63,1973,1567],{}," the offender, or use ",[63,1976,1335],{}," to limit I\u002FO.",[417,1979,1980,1983,1984,1986,1987,1990],{},[18,1981,1982],{},"Memory pressure causing swap I\u002FO",": check ",[63,1985,600],{}," and ",[63,1988,1989],{},"vmstat si\u002Fso"," — add RAM or reduce memory usage.",[417,1992,1993,1996],{},[18,1994,1995],{},"Too many concurrent I\u002FO operations",": tune the application to batch writes or use async I\u002FO.",[14,1998,1999,2000],{},"The key insight: ",[18,2001,2002],{},"load average is not a CPU metric — it's a \"processes waiting for resources\" metric. High load + low CPU = I\u002FO bottleneck.",[2004,2005,2006],"style",{},"html pre.shiki code .sdCPZ, html code.shiki .sdCPZ{--shiki-default:#6A737D;--shiki-github-dark:#6A737D}html pre.shiki code .sIsaT, html code.shiki .sIsaT{--shiki-default:#6F42C1;--shiki-github-dark:#B392F0}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .github-dark .shiki span {color: var(--shiki-github-dark);background: var(--shiki-github-dark-bg);font-style: var(--shiki-github-dark-font-style);font-weight: var(--shiki-github-dark-font-weight);text-decoration: var(--shiki-github-dark-text-decoration);}html.github-dark .shiki span {color: var(--shiki-github-dark);background: var(--shiki-github-dark-bg);font-style: var(--shiki-github-dark-font-style);font-weight: var(--shiki-github-dark-font-weight);text-decoration: var(--shiki-github-dark-text-decoration);}html pre.shiki code .snvgF, html code.shiki .snvgF{--shiki-default:#005CC5;--shiki-github-dark:#79B8FF}html pre.shiki code .svdQ7, html code.shiki .svdQ7{--shiki-default:#D73A49;--shiki-github-dark:#F97583}html pre.shiki code .sJ6F3, html code.shiki .sJ6F3{--shiki-default:#032F62;--shiki-github-dark:#9ECBFF}html pre.shiki code .ssxIu, html code.shiki .ssxIu{--shiki-default:#24292E;--shiki-github-dark:#E1E4E8}",{"title":169,"searchDepth":183,"depth":183,"links":2008},[2009,2010,2019,2028,2034,2038,2040,2041,2042,2043],{"id":25,"depth":183,"text":26},{"id":154,"depth":183,"text":56,"children":2011},[2012,2013,2014,2016,2017],{"id":158,"depth":190,"text":159},{"id":230,"depth":190,"text":231},{"id":341,"depth":190,"text":2015},"CPU States (from vmstat \u002F mpstat)",{"id":439,"depth":190,"text":440},{"id":497,"depth":190,"text":2018},"perf — Profiling",{"id":593,"depth":183,"text":79,"children":2020},[2021,2023,2025,2026,2027],{"id":596,"depth":190,"text":2022},"Understanding free -h",{"id":655,"depth":190,"text":2024},"Edge Case: Low free Is Normal",{"id":689,"depth":190,"text":690},{"id":775,"depth":190,"text":776},{"id":896,"depth":190,"text":896},{"id":944,"depth":183,"text":100,"children":2029},[2030,2032],{"id":947,"depth":190,"text":2031},"iostat -x Key Columns",{"id":1113,"depth":190,"text":2033},"I\u002FO Priority: ionice",{"id":1195,"depth":183,"text":128,"children":2035},[2036,2037],{"id":1198,"depth":190,"text":1199},{"id":1273,"depth":190,"text":1274},{"id":1332,"depth":183,"text":2039},"cgroups — Resource Limits",{"id":1447,"depth":183,"text":1448},{"id":1518,"depth":183,"text":1519},{"id":1644,"depth":183,"text":1645},{"id":1801,"depth":183,"text":1802},"Linux performance tuning is about finding the bottleneck (CPU, memory, disk I\u002FO, network) and addressing it — without making things worse. This chapter covers the tools to identify bottlenecks, the tuning knobs, and the kernel's built-in responses (OOM killer, swappiness).","md",{},"\u002Flinux\u002F15-performance-and-tuning",{"title":5,"description":2044},"linux\u002F15-performance-and-tuning","9qtNesJnROhIZVzWVM5STjmncSOxg711u8amDODOOmA",1789924650119]