This section of the Linux tuning guide says:
vm.swappiness: This parameter controls relative weight given to swapping out runtime memory by limiting the kernel to swap out SQL Server process memory pages.
I found this phrasing confusing and wanted to understand more about what the setting does and why 1 is the recommended value. Some references are below - would it be possible to use these to expand and clarify this part of the documentation?
I have a rough draft description of what might have helped me, though it can surely be improved:
vm.swappiness: When a process on Linux requests memory and none is available, there is a choice of what happens next: removing cached filesystem data (a quick task), or writing memory pages to the disk swapfile (a slower task).
vm.swappinessadjusts this balance by setting one side of a ratio that totals 200, so the default setting of60prefers removing items from the filesystem cache at a ratio of 140:60. A setting of1is the strongest preference towards clearing down the filesystem cache and away from swapping process memory to disk. This setting is optimal because SQL Server has its own internal caching that can use information about the contents of the database files to make better caching decisions than the operating system, so the priority is to avoid the slowness of SQL Server memory being written to swap disk. (Settingvm.swappinessto 0 blocks the use of swap even in extreme situations where it would avoid a crash, and increases the risk of an Out Of Memory handler forcibly ending SQL Server instead; this is not recommended).
(I am not certain of this reasoning, it is my best current understanding)
fp = (200 - swappiness) * (total_cost + 1) giving the ratio involving 200.⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@HumanEquivalentUnit -- thank you for your well-researched feedback. Excellent alias too.
@tejasaks -- please look into this issue.
@HumanEquivalentUnit , thank you for your research and feedback. We were trying to keep the individual description concise while trying to give some context into recommendation. I agree with you that our text could be improved and we will look into it. It may not be too elaborate though as we would like to keep it just descriptive without making it a tutorial on that one parameter.
@amvin87 to help review the comment and content.
Thank you :)
I understand it's not a place for a huge tutorial, it would be a very long page if that happened for every parameter. The parts I wanted to understand more about were:
1 a value that can always be confidently recommended - and yet it's not the default value?Trying to focus on these, I can rewrite to half the size, is that any better and is it clear?
vm.swappiness: adjusts how the Linux kernel reclaims used memory, either by writing some memory pages out to disk (swapping), or by removing data from its filesystem cache. The default is to compromise between them, weighted against the extra IO cost of swapping to disk. A database workload performs best when avoiding swapping, and setting
1most strongly prioritises reclaim from filesystem cache instead. (Setting0increases the risk of reclaiming memory by stopping processes, and is not recommended)