Linux – Optimizing image serving using nfs for a system with a high read to write ratio

apache-2.2imageslinuxnfssquid

Our system use NFS primarily for replicating and serving images from multiple nodes.

New images are not added very frequently. Hence writes are rare. Almost all requests will be read
requests.

How can i optimize my system to get the maximum read performance(with nfs alone). Any quick reliable tests to verify if system is performing better ?

Are there better ways to serve images quickly ?
Can squid/caching mechanism be used on top of nfs mount to speed things up ?

We are already using memory caching modules of apache.

server & client use – nfs v3, all running RHEL 4.

h/w config of server : RAM : 3GB, Quad core Intel(R) Xeon(TM) @ 3 Ghz.

cat /proc/net/rpc/nfsd" on server gives :

rc 0 3584710 221921733
fh 1506 0 0 0 0
io 4274869225 1474485090
th 8 581669 39835.922 7449.989 1396.547 0.000 879.767 604.030 436.573 320.797 0.000 1362.017
ra 16 3454951 13954 4091 8186 3920 6990 6421 3003 5574 2727 2467399
net 225510008 0 225488411 41217
rpc 225506272 0 0 0 0
proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
proc3 22 57 144259928 359775 11723001 58910204 0 5977165 2145920 546253 3829 0 0 509776 3718 15256 165 21497 79725 10067 59 0 867450
proc4 2 0 0

Best Answer

Instead of using NFS, consider using rsync to push out the content to all image-serving nodes. Writes can occur at one central point and then be rsynced out either when necessary (i.e, when images are added) or with a cron job.

This will give better performance overall, and allow for the usual filesystem cache to be used instead of having to implement something on top of NFS.

Related Topic