At my system always available some "Free" and "Inactive" memory, but sometimes system move couple megabytes to swap. Per night it maybe around 100MB, but for a few days in swap could be more than 4000MB.
How can I determine required memory for my system?
Best Answer
FreeBSD divides memory into 5 lists:
Some of those have minimum free and target free levels, e.g.
(Source: The Design and Implementation of the FreeBSD Operating System', rather dated: 2004 covering FreeBSD 5.2 -- these numbers have changed since then, but the general approach has not I believe.)
The pagedaemon is tasked with maintaining the levels, and paging out as need.
From a FreeBSD 9.0 VM I have here, these are some of the relevant numbers:
(I'm not certain how they are calculated, it depends on physical memory and presumably
kern.maxusers
).FreeBSD will proactively pageout to increase available cache so just because swap is used doesn't mean your system is under pressure. It's far more useful to inspect (and graph!) the rates of paging and other indicators of load such disk I/O and CPU ticks,
systat -io
is a start. Running locate/updatedb is a good way to shift memory usage around overnight.Using swap even when there is free memory is normal behaviour, it's effectively preparing for possible future memory demands while idle, so swap usage alone is not a reliable way to determine RAM requirements. FreeBSD is quite good at telling you when you need to tune something (grep "see tuning" in the
messages
file).Other useful reading: