Saturday, March 26, 2016

How to generate memory load?

The command below is going to hold memory for 600 seconds (10 minutes). I was looking for this command to find how can we artificially load the memory:

bash-3.00# perl -e '$m = "x" x 1_000_000_000; sleep 600';


On another terminal, I tried to see vmstat output which looked like below:

bash-3.00# vmstat 5
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr -- -- -- -- in sy cs us sy id
0 0 0 10853224 7653896 0 2 1 0 0 0 1 0 0 0 0 296 37 103 0 0 100
0 0 0 1119400 204088 0 1 0 0 0 0 267 0 0 0 0 373 122 250 0 12 88
0 0 0 1119336 204024 0 0 0 0 0 0 276 0 0 0 0 372 101 235 0 12 88
0 0 0 1119336 204024 0 0 0 0 0 0 276 0 0 0 0 371 115 246 0 12 88
0 0 0 1119336 204024 3 21 0 0 0 0 267 0 0 0 0 379 114 269 0 12 88
0 0 0 1119440 204152 0 0 0 0 0 0 276 0 0 0 0 374 113 254 0 12 88
0 0 0 1119480 204192 0 0 0 0 0 0 275 0 0 0 0 370 102 246 0 12 88
0 0 0 1119480 204192 3 20 0 0 0 0 267 0 0 0 0 385 133 276 0 12 88
0 0 0 1119480 204192 0 0 0 0 0 0 276 0 0 0 0 372 104 249 0 12 88
0 0 0 1119480 204192 0 0 0 0 0 0 275 0 0 0 0 374 117 252 0 12 88
0 0 0 1119480 204192 0 0 0 0 0 0 267 0 0 0 0 368 97 245 0 12 88
^C


and below is the 'top' command output during this run:


# top
last pid:   429;  load avg:  0.90,  0.32,  0.12;       up 6+15:55:22   09:47:05
37 processes: 36 sleeping, 1 on cpu
CPU states: 87.8% idle,  0.0% user, 12.2% kernel,  0.0% iowait,  0.0% swap
Memory: 8192M phys mem, 191M free mem, 4099M total swap, 4099M free swap

   PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
   425 root       1  59    0 2944K 2104K cpu/3    0:00  0.02% top
   398 root       1  59    0   10M 3576K sleep    0:00  0.00% sshd
     7 root      13  59    0   12M 9576K sleep    0:12  0.00% svc.startd
   115 root      25  59    0 4640K 4296K sleep    0:20  0.00% nscd
   228 root       4  59    0 7888K 4664K sleep    0:07  0.00% inetd
     9 root      17  59    0   10M 9736K sleep    0:22  0.00% svc.configd
   212 root       1  59    0 1360K 1176K sleep    0:01  0.00% utmpd
   428 root       1  47    4 2054M 2009M sleep    0:22  0.00% perl
   427 root       1  47    4 2054M 2051M sleep    0:21  0.00% perl
   426 root       1  47    4 2054M 2051M sleep    0:21  0.00% perl
   429 root       1  60    4 2054M 1143M sleep    0:19  0.00% perl
   300 root      16  59    0   15M 9384K sleep    0:07  0.00% fmd
   253 root       2  59    0 7464K 3152K sleep    0:02  0.00% automountd
   183 daemon     1  59    0 2848K 2360K sleep    0:02  0.00% rpcbind
     1 root       1  59    0 2512K 1920K sleep    0:01  0.00% init

No comments:

Post a Comment