top tells me:

last pid: 64807;  load averages:  0.99,  0.97,  0.92                                          up 189+04:47:22 09:16:17
45 processes:  1 running, 44 sleeping
CPU:  0.4% user,  0.0% nice,  0.2% system,  6.4% interrupt, 93.0% idle
Mem: 222M Active, 2151M Inact, 2008M Wired, 823M Buf, 3499M Free
Swap: 8192M Total, 8192M Free

Munin shows a this a little more clearly:

rtr1 yearly memory usage

As you can see, the server has around 8GB of ram. I wondering if I can cram this beast into a more modest 2GB server. Now I know what active and buffers mean, I think. But I am really concerned about the "wired" and "inactive" blobs of memory. Those do not map to any existing process as far as I know.

Note how the green "active" line went up in December: that's when we started using a BGP daemon on this router. I don't exactly understand what happened in April and May, but I remember doing a system upgrade and switching to pkgng around that time.

Here's the spare router for the first one, with less ram (4GB):

rtr0 yearly memory usage

It seems this one lives perfectly well with half the RAM and still leaves around 2GB free, which leads me to believe I could switch to a 2GB box for this server, lowering costs and maintenance...

Any suggestions? What do the various memory counters shown in top mean? More specifically, what does:

  • Active
  • Inactive
  • Cache
  • Buffers
  • Wired
  • Free

...really mean? I have found some posts explaining bits of the VM subsystem works, and I remember having a "ah-ah!" moment understanding all of this about 12 years ago, but I forgot. :) Even the faithful FreeBSD handbook failed to answer my question...

Can I downgrade to 2GB?


1 Answer 1

  • Active: Memory currently being used by a process
  • Inactive: Memory that has been freed but is still cached since it may be used again. If more Free memory is required, this memory can be cleared and become free. This memory is not cleared before it is needed, because "free memory is wasted memory", it doesn't cost anything to keep the old data around in case it is needed again.
  • Wired: Memory in use by the Kernel. This memory cannot be swapped out
  • Cache: Memory being used to cache data, can be freed immediately if required
  • Buffers: Disk cache
  • Free: Memory that is completely free and ready to use. Inactive, Cache and Buffers can become free if they are cleaned up.

So, you can just add Inactive to your Free count and consider it unused. Wired is memory in use by the kernel, which includes the networking stack. running netstat -m will give you a summary of memory usage by the network stack.

Based on your graphs, other than the concerning jump in wired memory at the start of March, yes, you should be able to run that workload on 2GB of ram. If you do, consider running i386 instead of amd64, as each memory allocation will take less space, since the pointers will be 32bit instead of 64bit.

  • 1
    'Inactive' memory "Cannot be re-allocated to other processes", so it should not be considered 'unused'. See wiki.freebsd.org/Memory
    – humbads
    Commented Mar 22, 2017 at 15:59
  • 1
    The 'Inactive' counter has been split into 2 separate items in newer FreeBSD. 'Inactive' and 'Laundry' (memory that still needs to be flushed to swap or disk before it can be freed). Additional Explanation here: lists.freebsd.org/pipermail/freebsd-arch/2016-November/…
    – Allan Jude
    Commented Sep 6, 2018 at 0:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .