Loading

How to Generate 100% CPU Usage on Any Linux System or Docker Container

게시 일자: Jul 22, 2025
단계

CONTENTS

You need to do some testing and require a Linux system or Docker container to be at 100% CPU. Here is how to force the system or container into that state.

STEPS TO FOLLOW

1. (Optional) Run the following command to find out how many CPUs your system has:
lscpu
You should get something like below showing the number of CPUs. CPU(s) is listed at 2:
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    2
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
Stepping:              1
CPU MHz:               2300.148
BogoMIPS:              4600.08
Hypervisor vendor:     Xen
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              46080K
NUMA node0 CPU(s):     0,1
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt

2. Run the following command once for each CPU on your system:
yes > /dev/null &
3. You should see confirmation of the process ID:
bash-4.2$ yes > /dev/null &
[1] 74
4. Now run the "top" command:
 top

You should see almost at 100% CPU usage from each "yes" command:
top - 01:51:27 up  8:46,  0 users,  load average: 1.16, 0.50, 0.24
Tasks:   6 total,   3 running,   3 sleeping,   0 stopped,   0 zombie
%Cpu(s): 98.0 us,  1.0 sy,  0.0 ni,  0.2 id,  0.0 wa,  0.8 hi,  0.0 si,  0.0 st
KiB Mem :  7952428 total,  1740332 free,   749644 used,  5462452 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  6897300 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                            
     74 app       20   0    4384    684    612 R  97.7  0.0   0:14.79 yes                                                                                
     75 app       20   0    4384    652    576 R  95.3  0.0   0:13.47 yes                                                                                
      1 app       20   0  165444  57880   9752 S   0.7  0.7   1:22.44 python3




 


 

 

Knowledge 기사 번호

001115179

 
로드 중
Salesforce Help | Article