Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Apple thinks secret, but the net never forgets...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Apple thinks secret, but the net never forgets...
Authored by: voldenuit on Oct 05, '03 05:26:47AM

As I saw this coming, I kept a local copy, no idea how much of the thread will fit in one comment, here we go, there were more messages in the thread but nothing really brilliant as far as I remember :

Discussions >Mac OS X >Getting Started and General Use >Using Mac OS X >Tuning maxvnodes for better performance

Topic: Tuning maxvnodes for better performance
Outline
Charles Richmond
Original Message
(Posted Jul 1, 03 5:41 am)
***

Posts: 783
Powerbook G4 17
Mac OS X (10.2.x)
+30 yrs S/W, O/S & H/W design
If you are seeing too many spinning beachballs or your system seems to get slower and slower and only a reboot fixes it. (or MacJanitor or running the Weekly script) If you have already added RAM then tuning the kernel parameter maxvnodes may help. If you are running on less than 512M do not do this. Buy RAM instead. If you have less than 1G RAM then instead of 84672 use 51904 instead of 84672 and use 36032 instead of 68800. If you are confused by this post, do not do anything until you fully understand the edits that you will be doing.
The following instructions must be followed exactly! A typo could interfere with the efficiency of your system. Use cut/paste or type very carefully and slowly in your text editor. When editing /etc/rc make a backup copy first by:
sudo cp /etc/rc /etc/rc.bck
First to see if the change will be beneficial, wait unto your system is being sluggish and in a terminal window do the following commands:
pstat -T
sysctl kern.maxvnodes
If the numbers are close then you likely will benefit from increasing the maximum number of vnodes by tuning.
To try the tuning change without making it permanent:
sudo sysctl -w kern.maxvnodes=84672
Run with this for awhile, but if you reboot it will be gone. Lets see if things get better. If you want it to survive a reboot then add similar lines to /etc/rc just below where is says, ConsoleMessage "Starting virtual memory"
## by cmr (put your initials if you like)
/usr/sbin/sysctl -w kern.maxvnodes=68800
## end cmr
So the finished area will look like:
##
# Start the virtual memory system.
##
ConsoleMessage "Starting virtual memory"
## by cmr
/usr/sbin/sysctl -w kern.maxvnodes=68800
## end cmr
swapdir=/private/var/vm
if [ "${netboot}" = "1" ]; then
    sh /etc/rc.netboot setup_vm ${swapdir}
fi
Even though the number '68800' is used above after a reboot the value of maxvnodes will go to 84672 because the SystemStart adds 512*(number of 32M segments of RAM - 1) to the number we set. If it doesn't make sense, don't worry about it :) An even higher number is working fine on my machine.
Hope this is Helpful

Messages 51 - 57 of 57    Previous  |  View All
Charles Richmond
RE(1): RE: Tuning maxvnodes for better performance
(msg # 11.1 : Posted Jul 11, 03 5:27 am)
*

 
Posts: 783
Powerbook G4 17
Mac OS X (10.2.x)
+30 yrs S/W, O/S & H/W design
Think you could write this into an Applescript?
It would be a fairly complex script as there are a lot of decisions to be made.
1. Is `sysctl kern.maxvnodes` *close to* `pstat -T`
 no == forget it
yes == how much RAM in the system
<512M == forget it
  other amounts -- assign values and edit file...
But I have an idea for a scriptable solution... let me try it out and get back to you.
In the meantime, if you have any applescript examples that modify the contents of text files, it might help me to look at them.

a brody
(Helper )
RE(2): RE: Tuning maxvnodes for better performance
(msg # 11.1.1 : Posted Jul 11, 03 7:36 pm)
*

 
Posts: 6732
iMac G4/800 Superdrive
Mac OS X (10.2.x)
http://www.macm aps.com Olympus C-700, iPod 20
You could probably tell the terminal to cat two files together using Applescript!
http://ftp.crihan.fr/mirrors/ftp.redhat.com/redhat/linux/8.0/en/doc/RH-DOCS/rhl-gsg-en-8.0/s1-navigating-usingcat.html
explains how to use cat to concatenate two files together.
As for individual line editing through Applescript that's beyond what I know.

Charles Richmond
RE(3): RE: Tuning maxvnodes for better performance
(msg # 11.1.1.1 : Posted Jul 11, 03 9:35 pm)
*

 
Posts: 783
Powerbook G4 17
Mac OS X (10.2.x)
+30 yrs S/W, O/S & H/W design
For what I have in mind, con cat tenating 2 files won't do it. I can do it with UNIX scripting languages like perl or bython or with a hybrid like sed.... I'll think on it and put it on one of my web sites.

P T Withington
RE: Tuning maxvnodes for better performance
(msg # 12. : Posted Jul 16, 03 1:59 pm)
*

 
Posts: 8
Just curious, how did you come up with the numbers you suggest?

Charles Richmond
RE(1): RE: Tuning maxvnodes for better performance
(msg # 12.1 : Posted Jul 16, 03 4:26 pm)
*

 
Posts: 783
Powerbook G4 17
Mac OS X (10.2.x)
+30 yrs S/W, O/S & H/W design
Just curious, how did you come up with the numbers you suggest?
Empirically :) I was helping someone who had a really bad case of vnode starvation and trying to balance the really big values suggested for the various other BSDs with Apple's really low numbers. I tried to err on the side of caution by using smaller numbers than the BSDs were suggesting. Then I ran with the higest values for a couple of weeks to verify with my own system.

andre santos1
RE: Tuning maxvnodes for better performance
(msg # 13. : Posted Jul 16, 03 4:05 pm)
*

 
Posts: 10
iMac G3 700 CDRW
Mac OS X (10.2.x)
512 RAM
Hi Charles !
look at this : pstat -T
223/12288 files
   5519 vnodes
swapmode is not (yet) available under Mach
 andreluiz% sysctl kern.maxvnodes
kern.maxvnodes = 9008
What do you thing about ? Do i need the tuning or not ? If yes , what values ? Thanks for all help

Charles Richmond
RE(1): RE: Tuning maxvnodes for better performance
(msg # 13.1 : Posted Jul 16, 03 4:36 pm)
*

 
Posts: 783
Powerbook G4 17
Mac OS X (10.2.x)
+30 yrs S/W, O/S & H/W design
What do you thing about ? Do i need the tuning or not ? If yes , what values ? Thanks for all help
No you are only using 61% of your available vnodes. But if that was when your system was lightly loaded, then do the pstat command when the system is sluggish and see what you get. From the look of things, you have 512M RAM so you could use the smaller set of numbers that I give in the first post.



[ Reply to This | # ]
Apple thinks secret, but the net never forgets...
Authored by: Cecily on Nov 14, '03 11:28:24AM

Silly question, quite probably - but my rc file doesn't contain the line ConsoleMessage "Starting virtual memory" - it says echo "Starting Virtual Memory" (I'm running Panther). Is it safe to add the extra lines to the rc file just before this line?



[ Reply to This | # ]
Apple thinks secret, but the net never forgets...
Authored by: bluehz on Nov 14, '03 08:54:23PM

Works just fine in Panther. I say "works" meaning it causes no ill effects. Whether it actually does anything is anyones guess. Just a note though - if you are running the default crontasks for os x that run at 3am or so - all bets are off. This process completely whacks out maxvnodes and when you get up in the morning it is ALWAYS at 100%. I guess I shouldn't say "whacks out" what I mean is - it completely obliterates any maxvnodes tuning you have done. Something about touching/accessing hundreds of files so I've read.



[ Reply to This | # ]
pstat -T = 51883 vnodes
Authored by: kupietz on Mar 16, '04 07:41:10PM
I can confirm this. Don't know which script causes this, but I just entered the maxvnodes adjustment, then ran all 3 (daily, weekly, monthly) and now I get:
Mike-Kupietzs-Computer:~ Kupietz$ pstat -T
612/12288 files
  51883 vnodes
swapmode is not (yet) available under Mach
Mike-Kupietzs-Computer:~ Kupietz$ sysctl kern.maxvnodes
kern.maxvnodes = 51904
So... does someone more knowledgable want to comment on what this might mean in terms of performance?

[ Reply to This | # ]