How is Memory Utilization calculated for FreeBSD server?

How is Memory Utilization calculated for FreeBSD server?

Overview

For FreeBSD servers monitored using Telnet/SSH mode, Applications Manager calculates memory utilization using the output of the following command:

export UNIX95; top -d 1 -n 2

From the command output, the following line is used for memory calculation:

Mem: 67M Active, 351M Inact, 2690M Wired, 4703M Free

Memory Values Used for Calculation

The memory values are converted into bytes before performing the calculation:

Memory TypeValueConverted to Bytes
Active67M67 × 1024 × 1024 = 70,254,592 B
Inact351M351 × 1024 × 1024 = 368,050,176 B
Wired2690M2690 × 1024 × 1024 = 2,820,669,440 B
Free4703M4703 × 1024 × 1024 = 4,931,452,928 B

Memory Utilization Calculation Logic

The memory usage calculation depends on the global configuration key:

am.freebsd.memory.used.with.wired

Case (i): When am.freebsd.memory.used.with.wired = true

If the key is present and set to true, Wired memory is included in Used memory.

Formula

Used = Active + Inact + Wired
Used % = Used / (Used + Free) × 100

Calculation

Used = 70,254,592 + 368,050,176 + 2,820,669,440
Used = 3,258,974,208 bytes

Used % = 3,258,974,208 / (3,258,974,208 + 4,931,452,928) × 100
Used % ≈ 39%

Case (ii): When am.freebsd.memory.used.with.wired = false (Default Behavior)

If the key is not present or set to false, Wired memory is considered as Free memory.

Formula

Used = Active + Inact
Free = Free + Wired
Used % = Used / (Used + Free) × 100

Calculation

Used = 70,254,592 + 368,050,176
Used = 438,304,768 bytes

Free = 4,931,452,928 + 2,820,669,440
Free = 7,752,122,368 bytes

Used % = 438,304,768 / (438,304,768 + 7,752,122,368) × 100
Used % ≈ 5%

How to Check the Configuration Key

To verify whether the key is enabled, execute the following query in the Query Tool:

Quote
select * from AM_GLOBALCONFIG where NAME='am.freebsd.memory.used.with.wired';

                  New to ADSelfService Plus?