vmstat buckets
John Baldwin
jhb at freebsd.org
Thu Dec 26 16:38:14 UTC 2013
On Wednesday, December 25, 2013 6:02:42 am Mark van der Meulen wrote:
> Hi All,
>
> I have question about buckets in vmstat -z output which I haven’t been able
to find an answer for online…
>
> I have 6 FreeBSD 9 boxes running as routers and they are seeing varying
results in vmstat -z. I’m interested in understanding what the Buckets
represent/mean and how I can influence usage of them.
>
> Some of the routers show 0 free buckets under 64 or 128 Bucket and so I did
some research and haven’t been able to find out what it means - most people
who have asked online have received an answer that it is nothing to worry
about, which is meaningless to me.
>
> It seems that the higher the usage of the router, especially when it is also
running userspace applications the less Bucket availability there is. Also I
found someone speculating it was related to free kernel memory so that was
updated on some routers however I saw little difference(although not sure if
adding it in /etc/sysctl.conf actually does anything as some haven’t had the
vm.kmem_size value change at all, despite reboots).
>
> Can anyone explain what the buckets (16,32,64,128) do and what they
represent? Also if you know anything about troubleshooting bucket failures?
There doesn’t appear to be anything useful online despite many searches.
>
> I am aware that it may not have anything to do with the problems I am
seeing, but I would still like to understand.
They are used to back malloc(9). The in-kernel malloc(2) rounds allocations
smaller than a page up to the next power of two and then allocates that from
a UMA zone for that power of two. For example, the '128' bucket is used for
all calls to malloc(9) for a size between 65 and 128.
vmstat -m can give you a sense of which buckets each malloc type uses, but
it doesn't give you a very detailed breakdown. However, if you compare
snapshots of vmstat -m taken along with your vmstat -z snapshots, you might
be able to infer which malloc buckets are seeing activity and use that to see
which malloc types correspond to the stats you care about from vmstat -z.
--
John Baldwin
More information about the freebsd-hackers
mailing list