210 lines
7.6 KiB
HTML
210 lines
7.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
|
|
<meta http-equiv="X-Content-Type-Options" content="nosniff">
|
|
<link rel="stylesheet" href="../assets/css/style.css">
|
|
<link rel="icon" type="image/x-icon" href="../favicon.ico">
|
|
<script>
|
|
// Apply theme immediately to prevent flash
|
|
(function() {
|
|
const theme = localStorage.getItem('theme') ||
|
|
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
})();
|
|
</script>
|
|
<title>stress-ng Cheatsheet - Cheatsheets - Launch Pad</title>
|
|
</head>
|
|
<body>
|
|
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
|
|
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
|
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
|
|
</button>
|
|
<br/><br/>
|
|
<div class="name">
|
|
__ _______________________ _________._________________________
|
|
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
|
|
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
|
|
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
|
|
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
|
|
\/ \/ \/ \/ \/ \/ \/
|
|
</div>
|
|
<div class="blog-page-header">
|
|
<div class="blog-header-content">
|
|
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
|
|
</a>
|
|
<h1 class="blog-page-title">stress-ng Cheatsheet</h1>
|
|
</div>
|
|
</div>
|
|
<div class="blog-post-container">
|
|
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
|
|
<div class="blog-post">
|
|
<div class="blog-post-content">
|
|
<p><a href="index.html">← Back to cheatsheets</a></p>
|
|
<p><a href="../index.html">← Home</a></p>
|
|
<hr>
|
|
<p>stress-ng is a system stress testing tool. Tests various system components including CPU, memory, I/O, disk, and network under load. Useful for system testing, benchmarking, and thermal testing.</p>
|
|
<hr>
|
|
<h2>Basic Usage</h2>
|
|
<ul>
|
|
<li>stress-ng --cpu <num> - Stress CPU with specified workers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --vm <num> - Stress virtual memory</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --io <num> - Stress I/O</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --timeout <time> - Run for specified time</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --metrics-brief - Show brief metrics</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --verbose - Verbose output</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>CPU Stress</h2>
|
|
<ul>
|
|
<li>stress-ng --cpu <num> - Number of CPU workers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --cpu-load <percent> - CPU load percentage</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --cpu-method <method> - CPU stress method</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --cpu-ops <num> - Stop after N operations</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Memory Stress</h2>
|
|
<ul>
|
|
<li>stress-ng --vm <num> - Number of memory workers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --vm-bytes <size> - Memory per worker</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --vm-method <method> - Memory stress method</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --vm-ops <num> - Stop after N operations</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>I/O Stress</h2>
|
|
<ul>
|
|
<li>stress-ng --io <num> - Number of I/O workers</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --hdd <num> - Stress hard disk</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --hdd-bytes <size> - Disk write size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --hdd-ops <num> - Stop after N operations</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Timing and Control</h2>
|
|
<ul>
|
|
<li>stress-ng --timeout <time> - Run for specified time</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --timeout <time>s - Time in seconds</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --timeout <time>m - Time in minutes</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --timeout <time>h - Time in hours</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --kill-after <time> - Kill after timeout</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Output Options</h2>
|
|
<ul>
|
|
<li>stress-ng --metrics - Show metrics</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --metrics-brief - Brief metrics</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --verbose - Verbose output</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --quiet - Quiet mode</li>
|
|
</ul>
|
|
<ul>
|
|
<li>stress-ng --dry-run - Show what would be done</li>
|
|
</ul>
|
|
<hr>
|
|
<h2>Common Examples</h2>
|
|
<h3>CPU Stress</h3>
|
|
<pre><code>stress-ng --cpu 4 --timeout 60s</code></pre>
|
|
<p>Stress 4 CPUs for 60 seconds.</p>
|
|
<h3>Memory Stress</h3>
|
|
<pre><code>stress-ng --vm 2 --vm-bytes 1G --timeout 30s</code></pre>
|
|
<p>Stress memory with 2 workers, 1GB each, for 30 seconds.</p>
|
|
<h3>I/O Stress</h3>
|
|
<pre><code>stress-ng --io 4 --timeout 60s</code></pre>
|
|
<p>Stress I/O with 4 workers for 60 seconds.</p>
|
|
<h3>Disk Stress</h3>
|
|
<pre><code>stress-ng --hdd 1 --hdd-bytes 1G --timeout 120s</code></pre>
|
|
<p>Stress disk with 1GB writes for 120 seconds.</p>
|
|
<h3>Combined Stress</h3>
|
|
<pre><code>stress-ng --cpu 2 --vm 1 --io 1 --timeout 60s</code></pre>
|
|
<p>Stress CPU, memory, and I/O simultaneously.</p>
|
|
<h3>With Metrics</h3>
|
|
<pre><code>stress-ng --cpu 4 --timeout 60s --metrics-brief</code></pre>
|
|
<p>Show brief metrics during stress test.</p>
|
|
<h3>CPU Load Percentage</h3>
|
|
<pre><code>stress-ng --cpu 4 --cpu-load 50 --timeout 60s</code></pre>
|
|
<p>Stress CPUs at 50% load.</p>
|
|
<h3>Verbose Output</h3>
|
|
<pre><code>stress-ng --cpu 2 --timeout 30s --verbose</code></pre>
|
|
<p>Show detailed output.</p>
|
|
<hr>
|
|
<h2>Tips</h2>
|
|
<ul>
|
|
<li>Use --timeout to limit test duration</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use --metrics-brief to monitor performance during test</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Start with low worker counts and short timeouts</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Monitor system temperatures while running stress tests</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use watch sensors to monitor temperatures in real-time: watch -n 1 sensors</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use --cpu-load to control CPU utilization percentage</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use --vm-bytes to control memory stress size</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Use --dry-run to see what would be executed</li>
|
|
</ul>
|
|
<ul>
|
|
<li>Essential for thermal testing and system stability verification</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script async type="text/javascript" src="../blog/analytics.js"></script>
|
|
<script src="../theme.js"></script>
|
|
</body>
|
|
</html>
|
|
|