How to calculate memory usage in SPU or PFE in dataplane from CLI output of ‘show security monitoring fpc X’.
- To calculate memory in SPU or PFE in dataplane
- To provide a guideline for understanding memory map in SPU and figure out what modules are using SPU memory
Memory utilization from CLI ‘show security monitoring fpc X’ is based on the output of ‘show memory’ and ‘show arena’ in PFE/SPU.
This formula is based on kernel and global data SHM memory:
Memory utilization =('global data SHM'.Total + 'Kernel'.Total - 'global data SHM'.Free - 'Kernel'.Free) / ('global data SHM'.Total + 'Kernel'.Total)
Example of SRX-Branch (SRX210) running 12.1X44-D35, Memory Utilization of PFE is 57%:
Memory Utilization = (66060284 + 204419584 - 37899304 - 76833544)/(66060284 + 204419584) ~= 57.5% --- JUNOS 12.1X44-D35.5 built 2014-05-19 21:36:43 UTC [email protected]> show security monitoring fpc 0 FPC 0 PIC 0 CPU utilization : 0 % Memory utilization : 57 % Current flow session : 2 Current flow session IPv4: 2 Current flow session IPv6: 0 Max flow session : 32768 Total Session Creation Per Second (for last 96 seconds on average): 0 IPv4 Session Creation Per Second (for last 96 seconds on average): 0 IPv6 Session Creation Per Second (for last 96 seconds on average): 0 [email protected]> start shell user root Password: [email protected]% vty fwdd BSD platform (OCTEON processor, 416MB memory, 8192KB flash) FLOWD_OCTEON(SRX210.HK vty)# show memory ID Base Total(b) Free(b) Used(b) % Name -- ---------- ----------- ----------- ----------- --- ----------- 0 4dd0ce00 204419584 76833544 127586040 62 Kernel 1 4dc00000 1048576 1023776 24800 2 USB DMA desc FLOWD_OCTEON(SRX210.HK vty)# show arena ID Base Total(b) Free(b) Used(b) % Name -- ---------- ------------ ------------ ------------ --- ---- 0 4890ce00 69206012 7216 69198796 99 jsf shm arena 1 4890d1a8 3137532 577432 2560100 81 global cntl SHM 2 48c0b1c0 66060284 37899304 28160980 42 global data SHM 3 48c23678 262140 259744 2396 0 Services control arena 4 52b37a98 2097148 2096224 924 0 IDP Arena 5 4e6435b8 15728636 15727712 924 0 UTM RT Arena
Another example for SRX5600 with SPU in Slot 3. Memory Utilization is 66%:
Memory Utilization = (49283072 + 2562478464 - 43555328 - 821383592)/(49283072 + 2562478464) ~= 66.9% lab@srx5600a> show security monitoring fpc 3 node0: -------------------------------------------------------------------------- FPC 3 PIC 0 CPU utilization : 0 % Memory utilization : 66 % Current flow session : 0 Current flow session IPv4: 0 Current flow session IPv6: 0 Max flow session : 0 Current CP session : 8 Current CP session IPv4: 8 Current CP session IPv6: 0 Max CP session : 10485760 root@srx5600a% vty node0.fpc3.pic0 BSD platform (XLR processor, 4096MB memory, 16384KB flash) [flowd64]FPC3.PIC0(vty)# show memory ID Base Total(b) Free(b) Used(b) % Name -- ---------- ----------- ----------- ----------- --- ----------- 0 272a3e00 2562478464 821383592 1741094872 67 Kernel 1 271a3e00 1048576 1048576 0 0 User [flowd64]FPC3.PIC0(vty)# show arena ID Base Total(b) Free(b) Used(b) % Name -- ---------- ------------ ------------ ------------ --- ---- 0 ffce00000 51380224 1046656 50333568 97 jsf shm arena 1 ffce00730 1048576 1036480 12096 1 global cntl SHM 2 ffcf00760 49283072 43555328 5727744 11 global data SHM 3 ffcf0cf80 262144 260256 1888 0 Services control arena
The total available memory in SPU is divided into segments for buffers, platform queues, Heap, SHM (Shared Heap Manager), etc. when the SRX device boots up. In most cases, the memory for services grows either into the Heap or Services SHM segment. Other segments are platform/memory dependent; but tend to stay constant across releases.
The services segment is used to create two SHM blocks for control and data. The Control SHM is used by modules to allocate objects from the control thread and the Data SHM is used by modules to allocate from the real-time threads, in which packet processing occurs.
To display overall heap or data SHM usage, run the following from CLI:
[flowd64]FPC3.PIC0(vty)# show usp memory segment heap modules Module Name Memory Usage Memory & Overhead alloc free (byte) (Kb) (Mb) (byte) count count --------------------------------------------------------------------------------------------------- alg 168 0 0 208 1 0 da 2108608 2059 2 2108888 7 0 flow 27806744 27155 26 27809384 66 0 flow session 0 0 0 0 0 0 flow gate 10485856 10240 10 10485936 2 0 flow jsf 0 0 0 0 0 0 flow ipv6 0 0 0 0 0 0 flow cp 1468006400 1433600 1400 1468006520 3 0 fwauth 130000 126 0 130080 2 0 idp 2034632 1986 1 2045512 272 0 utm 873992 853 0 880632 168 2 interface 1248 1 0 1968 18 0 ipsec 852072 832 0 852312 6 0 p2mp 418888 409 0 419208 8 0 l2flow 39553648 38626 37 39601488 1196 0 mgcp 0 0 0 0 0 0 nat 590416 576 0 601336 273 0 policy 8015864 7827 7 8018744 73 1 appdef 5941264 5802 5 5943984 68 0 resmgr 0 0 0 0 0 0 screen 1390568 1357 1 1390808 7 1 sip 0 0 0 0 0 0 syn-atk 1671168 1632 1 1671288 3 0 toolkits 11296256 11031 10 11299216 74 0 rtux 8415944 8218 8 8418784 71 0 voip 0 0 0 0 0 0 zone 672 0 0 912 6 0 sae driver 0 0 0 0 0 0 dpq 157464 153 0 158704 31 0 mbuf 1512 1 0 3192 42 0 trace 0 0 0 0 0 0 rtm 0 0 0 0 0 0 lsys 24 0 0 64 1 0 sccp 0 0 0 0 0 0 gtp 0 0 0 0 0 0 sctp 0 0 0 0 0 0 gfm 0 0 0 0 0 0 ds-lite 4008336 3914 3 4008536 5 0 rjmpi 134144 131 0 134184 1 0 npcache 0 0 0 0 0 0 --------------------------------------------------------------------------------------------------- Total 1593895888 1556538 1520 1593991888 2404 4 40 memory modules registered [flowd64]FPC3.PIC0(vty)# show usp memory segment shm data module Module name id usage(b) (Kb) (Mb) default module id 0 0 0 0 JSF Event Module 1 0 0 0 jsf trace 2 3344 3 0 Flow-Host Traffic Registry 3 54624 53 0 junos-alg-msrpc 4 1072 1 0 JSF_CTRS 5 72928 71 0 JSF Flow Module 6 0 0 0 JSF TCP OPTION 7 32 0 0 jsf-objcache 8 640 0 0 utm_dns 9 144 0 0 timer 10 0 0 0 utm uf ng 11 63456 61 0 junos-utm 12 512 0 0 junos-utm 13 0 0 0 JSF Crypto Library 14 0 0 0 jsf nat lib 15 6512 6 0 JSF_RJMPI 16 0 0 0 ----- ---------- ---------- ---------- ---------- Total 17 203264 198 0