Score:1

vm.swappiness in RedHat Enterprise Linux

tr flag

I don't often post, so apologies in advance if my etiquette is poor.

I'm being directed to add vm.swappiness=0 in /etc/sysctl.conf.

When I view the contents of that file, I see the comments below. I'm not clear on if I should just append vm.swappiness=0 to the bottom of the file, or if I need to place that in one of the other files referenced by the comments:

# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).```
djdomi avatar
za flag
usually in /etc/sysctl. dbut remember that zero is a really bad choice, and at least in my experience is at least 1 a better solution for your specific situation
Score:0
cn flag

On Linux with systemd, /etc/sysctl.d/*.conf is the site specific directory, and is a good place to put your tuning as the system administrator. See the man pages cited in the comments.

Drop in directories are easier to manage, each set of tuning can be installed as a file. Ensuring one particular line exists in a file is non-trivial to automate.

Create file /etc/sysctl.d/vm.conf that contains the line vm.swappiness=1

swappiness of 1, because swap space should be used if it exists. If a system is to never swap, delete paging spaces.

For completeness, note that tuned is a separate performance profiles thing that can tweak sysctl. Unlikely you are using it, however.

FubarOtter avatar
tr flag
Thanks. What I ended up doing was adding `/etc/sysctl.d/vm.conf` with the line vm.swappiness=0. This seemed to do the trick. This server runs commercial software and the vendor wants that line specifically so the JVM can keep more pages in memory without RHEL swapping them out so often.
FubarOtter avatar
tr flag
PS @John Mahowald: tried to give your answer an upvote but the site wouldn't let me (not enough reputation or some such)!
John Mahowald avatar
cn flag
Yes, a reputation system exists. Two voted up good questions or answers and you can also up vote.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.