Explaining high(1) on FreeBSD

Explaining high(1) on FreeBSD

All and sundry is aware of and comprise no much less than once outmoded the high(1) recount to trace files about our cpu and processes, but how many of what every field way? This day we are going to have the option to files you thru every of those fields. By default, high(1) shows the ‘high’ processes on every procedure and periodically updates this files every 2.0 seconds utilizing the raw cpu utilize share to risky the processes in the list.


Default high(1) Output

Here’s study how to default high(1) recount output appears to be like. We can utilize it as a execrable to characterize every field and column.

final pid: 95139;  load averages:  0.21,  0.25,  0.25     up 17+06: 17: 12  21: 01: 34
22 processes:  1 working, 21 napping
CPU:  0.1% user,  0.0% nice,  0.0% procedure,  0.0% interrupt, 99.9% slothful
Mem: 5968K Titillating, 285M Inact, 2918M Wired, 584K Buf, 552M Free
ARC: 101M Entire, 32M MFU, 24M MRU, 392K Anon, 1286K Header, 44M Other
     12M Compressed, 52M Uncompressed, 4.46:1 Ratio
Swap: 1024M Entire, 1024M Free
 
  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
95139 klarabsd      1  23    0    14M  3988K CPU3     3   0: 01   0.42% high
91467 klarabsd      1  20    0    21M  9536K buy   1   0: 00   0.04% sshd
79666 root          1  20    0    13M  3024K buy   2   5: 05   0.02% mountd
66928 root          1  20    0    13M  2312K buy   2   4: 32   0.02% powerd
86590 ntpd          1  20    0    21M  5452K buy   2   2: 46   0.01% ntpd
88853 root          1  21    0   173M   146M buy   1   2: 29   0.00% smbd
62176 root          1  20    0    13M  2812K buy   1   2: 16   0.00% syslogd
88570 root          1  20    0    39M    16M buy   0   0: 41   0.00% nmbd
91145 root          1  20    0    13M  2728K nanslp   3   0: 26   0.00% cron
80942 root          4  52    0    12M  2300K rpcsvc   0   0: 05   0.00% nfscbd
83679 root         32  52    0    12M  2788K rpcsvc   1   0: 05   0.00% nfsd
77923 root          1  20    0    13M  2680K buy   1   0: 04   0.00% rpcbind
90750 root          1  20    0    20M  8268K buy   1   0: 04   0.00% sshd
93654 root          2  20    0   136M   104M buy   0   0: 03   0.00% smbd
93831 root          1  20    0   131M   104M buy   0   0: 03   0.00% smbd
45020 root          1  20    0    11M  1488K buy   0   0: 01   0.00% devd
91568 klarabsd      1  29    0    15M  6196K quit    2   0: 00   0.00% zsh
91342 root          1  41    0    21M  9508K buy   3   0: 00   0.00% sshd
  312 klarabsd      3  20    0    31M    12M buy   0   0: 00   0.00% mocp
83547 root          1  52    0    12M  3036K buy   2   0: 00   0.00% nfsd
 7478 root          1  52    0    12M  2196K quit    1   0: 00   0.00% adjkerntz
80887 root          1  52    0    12M  2252K accept   0   0: 00   0.00% nfscbd
PID/Load/Uptime/Time

The final pid:  presentations the PID of the final (latest) process, which is 95139 in our example.

The load averages:  field shows the weight moderate of the procedure over the final 1, 5, and 15 minutes respectively. The subject of load moderate is in total very massive and it is calculated otherwise on a range of UNIX programs, so a separate article is seemingly to be dedicated for apt that. The up field presentations the procedure uptime which is 17 days, (+) six hours, seventeen minutes and twelve seconds 06: 17: 12. The final field on the tip lovely is the new time 21: 01: 34 displayed in HH:MM:SS format.

Processes States

We comprise now lined the first line of output from high(1). Time for the 2d line. This one contains files about the new count of processes and their impart. On this methodology, there are 22 processes with 1 working and 21 napping processes.

CPU Exhaust

The third line presentations a summary breakdown of what is currently working on the procedure CPUs. The user field presentations the utilization of userspace processes. The nice field presentations how principal CPU time is taken by processes with various nice(1) priorities. The procedure field presentations how principal CPU time is outmoded by the FreeBSD kernel. The interrupt field presentations how principal CPU time is delegated to interrupt pork up. Final but not least the slothful field presentations how principal CPU time is unused or free.

Memory

The fourth line of the high(1) recount marked Mem:  presentations a detailed summary of the memory files. The next bodily memory stats non-public this files:

Titillating presentations the selection of bytes outmoded by actively working processes. Inact presentations the selection of bytes not only currently outmoded by a process (while the process itself would possibly maybe perchance well presumably serene live active – apt some parts of its memory has not been outmoded just currently). If the procedure desires more memory, then this lazy memory is seemingly to be swapped out or freed to raze room. The Laundry queue presentations the amount of memory that is “dirty”, needing to be laundering sooner than it ought to also be reused. Records that has been modified because it used to be study from disk, or has not but been saved on disk, cannot be with out pronounce recreated, so it would possibly maybe perchance well presumably serene be written to swap or the modified file sooner than that memory is also reused. For more principal positive aspects about how the lazy memory and the laundry procedure work, seek files from Exploring Swap on FreeBSD . The Wired count presentations the selection of bytes wired down which, unlike the other varieties, CANNOT be swapped out. Buf presentations the selection of bytes outmoded for buffers and caches. As a change of being swapped out, they are going to be apt freed. Free presentations the free memory.

You would possibly maybe well presumably additionally be drawn to

Salvage more out of your FreeBSD style

Kernel style is mandatory to many companies. When you comprise a FreeBSD implementation otherwise you’re having a seek files from at scoping out work for the lengthy flee, our team can abet you additional allow your efforts.

To receive the customary idea of how principal procedure memory is admittedly outmoded versus free, here’s a hint. The outmoded memory is in total the sum of Titillating and Wired fields. As Inact/Laundry/Buf fields is also swapped out, they would possibly maybe perchance presumably serene all be handled as ‘buffers’ or ‘cached’ files in memory that would possibly maybe perchance well (and would possibly maybe perchance well presumably) be freed when principal. FreeBSD, as any other wise UNIX procedure, follows the motto of ‘Unused memory is wasted memory.’ so when the memory just will not be principal, FreeBSD retains it in case an lazy process will attempt to entry it again.

ZFS ARC

The fifth line contains ZFS Adaptive Change Cache or, briefly, ARC. Here’s the amount or RAM that ZFS makes utilize of as cache. We would possibly maybe perchance well presumably buy what desires to be the minimum and maximum ARC size in the /and so on/sysctl.conf file with vfs.zfs.arc_min and vfs.zfs.arc_max parameters.

The ZFS ARC stats fields uncover the next files.

The Entire field presentations the selection of wired bytes outmoded for the ZFS ARC. The MRU field presentations the selection of ARC bytes holding Most Nowadays Ancient files. The MFU field presentations the selection of ARC bytes holding Most Continuously Ancient files. The Anon field presentations the selection of ARC bytes holding in flight files that doesn’t fit into other lessons. The Header field presentations the selection of ARC bytes holding headers. The Other field presentations other miscellaneous ARC bytes principal for ZFS to operate properly.

The sixth line is a continuation of the ZFS ARC stats but, as ARC is compressed on FreeBSD, it presentations stats of how principal memory has been saved in consequence of utilizing the compression algorithm on all that ZFS cache. The Compressed field presentations bytes of memory outmoded by ARC caches. From the total memory outmoded by ARC, the 12M(megabytes) is compressed and in consequence of 4.46:1 compress Ratio displayed in a while the lovely, it makes utilize of ‘handiest’ 12M in preference to 52M (megabytes) confirmed in the Uncompressed field that would possibly maybe perchance be outmoded with out compression.

SWAP

The closing Swap:  field on the seventh line, as you practically surely guessed, presentations the SWAP files. Here, it is admittedly easy – it apt presentations Entire size of SWAP home and how principal of it is admittedly Free.

The 2d segment of the high(1) recount is the list of processes. These are the displayed columns.

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND

Here’s the segment the place files about particular particular person processes is displayed. The PID is the process identification. The USERNAME presentations the name of the process’s proprietor. The PRI column presentations the new precedence of the process while NICE is the amount of nice(1) a process has. SIZE presentations the textual suppose/files/stack of process. RES is the new amount of resident memory while SWAP is the amount of swap outmoded – every in kilobytes. STATE is the new impart of the process – it ought to START/SLEEP/STOP/ZOMB/WAIT/LOCK. When a process is ready on one thing to happen, this can uncover the ‘waitchan’, describing what it is looking ahead to. There are a massive selection of imaginable values for this, lets want to attain an total article on one of the most important total values. Withhold in mind that RUN is confirmed as CPUn (as an instance, CPU3) on programs with plenty of CPU cores. The C is the logical processor on which the process is currently working – here’s visible handiest on SMP programs. The TIME column presentations the selection of seconds that the process outmoded. The WCPU presentations the weighted cpu share. The COMMAND presentations the name of the recount that the process is currently working.

Cores Monitoring

To apt take a look at which CPU is doing what, we are in a position to utilize the recount underneath to uncover every CPU new utilization stats. Here’s the way it’s going to seek files from:

% high -P 0

### Output

final pid: 23091;  load averages:  0.66,  0.50,   up 0+01: 12: 58 912: 44: 49
107 processes: 2 working, 104 napping, 1 ready
CPU 0:  1.6% user,  0.0% nice,  0.0% procedure,  0.0% interrupt, 98.4% slothful
CPU 1:  2.4% user,  0.0% nice,  0.4% procedure,  0.0% interrupt, 97.3% slothful
CPU 2:  0.0% user,  0.0% nice,  0.0% procedure,  1.2% interrupt, 98.8% slothful
CPU 3:  1.1% user,  0.0% nice,  1.5% procedure,  0.0% interrupt, 97.3% slothful
CPU 4:  0.4% user,  0.0% nice,  0.4% procedure,  0.0% interrupt, 99.2% slothful
CPU 5:  2.7% user,  0.0% nice,  1.2% procedure,  0.0% interrupt, 96.1% slothful
CPU 6:  0.4% user,  0.0% nice,  0.8% procedure,  0.0% interrupt, 98.8% slothful
CPU 7:  1.2% user,  0.0% nice,  0.0% procedure,  0.0% interrupt, 98.8% slothful
Mem: 1650M Titillating, 2263M Inact, 278M Laundry, 2623M Wired, 24G Free
ARC: 354M Entire, 109M MFU, 92M MRU, 1508K Anon, 3657K Header, 147M Other
     87M Compressed, 313M Uncompressed, 3.58:1 Ratio
Swap: 1024M Entire, 1024M Free

Interactive Mode Alternatives

To preserve away from citing your total high(1) man net page, we are going to have the option to characterize the ‘most titillating’ switches that we are in a position to toggle in the interactive (default) mode. Regardless of to what extend (with letter s) the refresh is determined, we are in a position to repeatedly refresh the display cloak manually utilizing the [CTRL]+[L] shortcut. We can additionally refresh the stats utilizing the biggest ‘key’ on the keyboard – the more convenient [SPACEBAR]. The letter m will toggle between the ‘cpu’ mode (which is the default) and the ‘io’ mode. Excellent kind  ‘cpu’ or ‘io’ after pressing the m key. The letter S will toggle the uncover of procedure processes – which is terribly helpful. We can additionally raze(1) a process utilizing the letterokay or renice(1) one with the letter r. For sorting the uncover of processes, utilize the letter o after which utilize one amongst those columns for the sorting exclaim: cpu/res/size/time – the default is cpu. The utilization of the capital P letter, we are in a position to alter to uncover per CPU stats in preference to summary percentages of CPU utilization. With capital J we are in a position to uncover processes owned handiest by a particular penal advanced. The letter i can toggle showing the slothful processes.

The I/O Mode

Whereas the default high(1) mode is CPU associated, the high(1) on FreeBSD additionally has one more mode – the I/O mode which is terribly helpful in tracking processes that attain principal I/O. To commence the high(1) in the I/O mode together with engrossing sorting on the TOTAL column, utilize this recount:

# high -S -m io -o total

The recount above additionally contains the -S possibility to uncover the procedure processes on yarn of after we commence the ZFS scrub process, this cannot uncover as any separate process. Nonetheless, with the -S possibility, we are going to have the option to seek files from high I/O process of the zfskern procedure process – here’s the place ZFS scrub does its work.

Here’s how the high(1) I/O mode appears to be like like on FreeBSD.

final pid:  9572;  load averages:  0.40,  0.20,  0.17       up 17+21: 37: 30  12: 21: 52
75 processes:  2 working, 72 napping, 1 ready
CPU:  0.9% user,  0.0% nice,  8.6% procedure,  3.4% interrupt, 87.1% slothful
Mem: 32M Titillating, 298M Inact, 2922M Wired, 584K Buf, 512M Free
ARC: 191M Entire, 58M MFU, 64M MRU, 7201K Anon, 3024K Header, 60M Other
     84M Compressed, 1179M Uncompressed, 14.01:1 Ratio
Swap: 1024M Entire, 1024M Free
 
  PID USERNAME     VCSW  IVCSW   READ  WRITE  FAULT  TOTAL PERCENT COMMAND
  806 root        1745     78      0    465      0    465  81.72% pkg
   19 root         104     26      0     38      0     38   6.68% zfskern
 9298 klarabsd      37     12     37      0      0     37   6.50% rsync
 1303 klarabsd      29      1     29      0      0     29   5.10% dd
    2 root           0      0      0      0      0      0   0.00% KTLS
    3 root           0      0      0      0      0      0   0.00% crypto
77923 root           0      0      0      0      0      0   0.00% rpcbind
64387 klarabsd       4      0      0      0      0      0   0.00% sshd
    4 root           0      0      0      0      0      0   0.00% crypto returns 0
 9572 klarabsd       6      0      0      0      0      0   0.00% rsync
    5 root           0      0      0      0      0      0   0.00% crypto returns 1
    6 root           0      0      0      0      0      0   0.00% crypto returns 2
68006 root           0      0      0      0      0      0   0.00% sshd
    7 root           0      0      0      0      0      0   0.00% crypto returns 3
93831 root           1      0      0      0      0      0   0.00% smbd
    8 root         147     54      0      0      0      0   0.00% cam
    9 root           0      0      0      0      0      0   0.00% soaiod1
91145 root           0      0      0      0      0      0   0.00% cron
   10 root           0      0      0      0      0      0   0.00% audit
   11 root        4429   4798      0      0      0      0   0.00% slothful
71883 klarabsd       4      0      0      0      0      0   0.00% sshd
  427 root           0      0      0      0      0      0   0.00% pkg
68331 klarabsd       0      0      0      0      0      0   0.00% zsh

It has a little bit various columns than the default CPU mode high(1) recount. These are the displayed columns in the IO mode.

  PID USERNAME     VCSW  IVCSW   READ  WRITE  FAULT  TOTAL PERCENT COMMAND

Let’s characterize the fields we did not beforehand characterize. VCSW way Voluntary Context SWitches and it is the assemble of context change that happens when process yields sooner than it has outmoded its allotted time quantum. IVCSW way InVoluntary Context SWitches – it is the assemble of context change that happens when the process makes utilize of all of its allocated time quantum and it is forcibly switched out of CPU by scheduler, to let other processes flee. The READ column presentations the study operations (study IOPS) and WRITE presentations the write IOPS. FAULT presentations how many faults there were and the TOTAL column is the sum of READ and WRITE columns. The PERCENT column presentations the proportion of I/O process for every process.

We Want to Run Deeper

Withhold in mind that process (and I/O) monitoring doesn’t discontinuance on high(1) recount on FreeBSD. To receive the next peep of what happens in the FreeBSD procedure at CPU and/or IO degree, you would possibly maybe well serene additionally attempt no much less than one amongst the next instructions:

·  htop(1)

·  gstat(1)

·  systat(1)

·  vmstat(1)

Summary

Whereas high (1) is a advanced instrument that offers various files, we are hopeful that this article will provide some perception into study how to make utilize of high(1) more successfully.

Cherish this article? Fragment it!

Read Extra

Share your love