Tuning MacOSX
cmr164
Registered Users Posts: 1,542 Major grins
Memory usage on the Mac can improve markedly with the following. I first wrote this up for the Apple forums, had it picked up by macosxhints Here is the tuning:
In a terminal or xterm window: sudo vi /etc/rc
go to the line that starts: # System tuning and change to 512 multiplier into a 2048 multplier.
# System tuning
#ORIG-CMR
#sysctl -w kern.maxvnodes=$(echo $(sysctl -n hw.physmem) '33554432 / 512 * 1024 +p'|dc)
#NEW-CMR
sysctl -w kern.maxvnodes=$(echo $(sysctl -n hw.physmem) '33554432 / 2048 * 1024 +p'|dc)
In a terminal or xterm window: sudo vi /etc/rc
go to the line that starts: # System tuning and change to 512 multiplier into a 2048 multplier.
# System tuning
#ORIG-CMR
#sysctl -w kern.maxvnodes=$(echo $(sysctl -n hw.physmem) '33554432 / 512 * 1024 +p'|dc)
#NEW-CMR
sysctl -w kern.maxvnodes=$(echo $(sysctl -n hw.physmem) '33554432 / 2048 * 1024 +p'|dc)
Charles Richmond IT & Security Consultant
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
0
Comments
Thanks,
Dave
http://www.lifekapptured.com (gallery)
Nice work, Charlie.
"The Edge... there is no honest way to explain it because the only people who really know where it is are the ones who have gone over."-Hunter S.Thompson
In laymens terms what does this do?
From what I understand. It caches more to your RAM than to the HD, helping speed things up a bit.
Dave
http://www.lifekapptured.com (gallery)
This is one of the posts on macosxhints.com in reference to Charles' patch.
Dgrin FAQ | Me | Workshops
and so, if one is using say, a powermac g5 2.5ghz proc, 3.5 gigs or ram, 500 gigs of hd, and one's primary use of the machine is for photoshop and internet, then would you recommend doing this modification?
Portfolio • Workshops • Facebook • Twitter
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
charles, i seriously doubt if the average joe has any clue as to what you are talking about. put it in layman's terms, so that the rest of us can understand, will you?
Portfolio • Workshops • Facebook • Twitter
Because of the default Apple tuning, when the system want to open a new file (and everything is file in UNIX) it has no available resource. The vnodes are used up but everything needs a vnode. So the system pages out and acts just like it ran out of memory even though plenty is available.
Think of it this way... You have 25 magnum of champagne (ram) and 100 guests (files) but only 30 glasses (vnodes) so when someone needs a drink you take someone elses glass (vnode) and toss their champagne out to get some for the new drinker. Because every one want to drink the host (system) spends all the time rotating glasses and dumping/filling them.
I actually think I did a good gob with this Who will buy me a drink?
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
"The Edge... there is no honest way to explain it because the only people who really know where it is are the ones who have gone over."-Hunter S.Thompson
I'm assuming that my Dual 2ghz G5, 2.5GB ram, 320GB Hard drive would also need this.
If, for some reason, this turns out to make my mac run slower, is there a reversal?
Change it back to 512
Dave
http://www.lifekapptured.com (gallery)
sudo sysctl -w kern.maxvnodes=$(echo $(sysctl -n hw.physmem) '33554432 / 2048 * 1024 +p'|dc)
Enter the admin password when prompted
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
BTW, I haven't been using your hint (just out of laziness) but this second part is interesting. Did you read this post of mine? I am forming a new theory. PS gets into the state where it can't save files if it is open over a Sunday night. That's when these scripts run, right? Does that make any sense to you?
How to change the frequency, time when the man pages and locate database are updated?
Here is the section of the /etc/weekly script that is the problem:
#if [ -x /usr/libexec/locate.updatedb ]; then
# echo ""
# echo "Rebuilding locate database:"
# locdb=/var/db/locate.database
# touch "${locdb}"; chown nobody "${locdb}"; chmod 644 "${locdb}"
# echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody 2>&1 | sed -e '/Permission denied/d'
# chmod 444 "${locdb}"
#fi
#if [ -x /usr/libexec/makewhatis.local ]; then
# echo ""
# echo "Rebuilding whatis database:"
# if [ -d /usr/X11R6/man ]; then
# #MANPATH=${MANPATH:-/usr/share/man:/usr/X11R6/man:/usr/local/man}
# else
# MANPATH=${MANPATH:-/usr/share/man:/usr/local/man}
# fi
#
# makewhatis.local "${MANPATH}"
#fi
You will notice that I have completely commented out these. There isn't anything Mac users do that need a complete update of the locate database and whatis database. The normal Mac user probably NEVER uses either. If this was a once a year script it would be enough.
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph
Here is the script that is the problem:
What file is this script in?
/etc/weekly
It is a link to /etc/periodic/weekly/500.weekly , but ignore that.
Operating System Design, Drivers, Software
Villa Del Rio II, Talamban, Pit-os, Cebu, Ph