Subject: Re: OT: recommendation for vm tuning for anoncvs mirror?
To: None <tls@rek.tjls.com>
From: Jeff Rizzo <riz@tastylime.net>
List: netbsd-users
Date: 02/26/2005 16:04:09
Thor Lancelot Simon wrote:

>On Sat, Feb 26, 2005 at 03:06:42PM -0600, Tracy Di Marco White wrote:
>  
>
>>In message <4220E340.6000601@tastylime.net>, Jeff Rizzo writes:
>>    
>>
>>>I'm setting up a machine for a mirror of anoncvs, and it has 4G of RAM.  
>>>I'm trying to take maximum advantage of it to keep the CVS repository in 
>>>RAM (in case it's not clear, this is the NetBSD CVS repository, which is 
>>>over 3G is size) to maximize performance.
>>>
>>>Despite various tweaks I've made to things, I'm having a hard time 
>>>getting the file cache (which is the one I assume I should care about) 
>>>much over 1.5G - consequently things get pretty slow at times.  Can 
>>>anyone who might already be running an anoncvs mirror suggest some 
>>>settings to start with?  I've also bumped kern.maxvnodes to 500000.
>>>      
>>>
>>The applicable things in /etc/sysctl.conf:
>>kern.maxvnodes=524288
>>vm.filemax=90
>>vm.anonmin=5
>>vm.anonmax=10
>>    
>>
>
>You will need some other things, too.
>
>
>  
>

<snip>

>Note that with a very very small change to vfs_bio to add a buffer size for
>512-byte fragments (the way the code is now, they will take up 1k) you
>will get significantly more efficient use of the metadata cache.
>  
>


hm, does this involve just tweaking MEMPOOL_INDEX_OFFSET in 
kern/vfs_bio.c, or is there more to it?

>All this will help, but it will not be enough, by itself, to give you
>acceptable performance on a busy anoncvs server.
>
>For that, you will need at least one other thing:  You will need to put
>/anon-root/tmp on a separate physical disk or disks.  Again, make this a
>4k/512 filesystem.  Mount it async and newfs it fresh at every boot (mark
>it noauto in /etc/fstab, newfs and mount it from /etc/rc.local or a separate
>rc script).
>  
>

Is the purpose of this for LockDir?  Not knowing a tremendous amount 
about CVS's internals myself, I wonder if some of the read-only 
repository patches available in later (than the 1.11.17 that comes 
w/NetBSD) CVS might help with this?  I wasn't originally planning on 
having separate spindles, but clearly I need to rethink this... I 
suppose I can simply not raid the disks, as all the data is mirrored 
from other sources anyway - I'll live with a dead disk taking the system 
offline.

>If you have separate disk(s) for the anoncvs data itself, you can
>probably get away with putting /anon-root/tmp  on the same physical
>disk(s) as / (if you are running without a chroot for the anoncvs data,
>you are living very dangerously but in that case apply what I said about
>"/anon-root/tmp" to "/tmp").
>  
>

Yeah, there is a chroot.  I wouldn't set something this hairy up without 
one.  :-)

>You'll want to be sure all filesystems on the machine are mounted noatime,
>and I would strongly recommend mounting the actual anoncvs data softdep to
>keep the cost of syncing down.
>
>If all this does not prove to be enough we have a modified cvs executable
>available that we could provide to you.  But try the stuff Tracy and I have
>described first and see how it goes.
>  
>

These are some incredibly useful tips that I'm sure would have taken me 
months to come by (if I came by them at all) on my own.  Thanks a 
_lot_.  I think it might be useful to have some of it in the mirrors FAQ...

I'll proceed with rearranging my disks now.  - I suppose I should have 
done this _before_ installing in a colo 50 miles from here.  :)

Thanks again,
+j