[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: performance issues with apache + php + nfs?



Quoting Adrian (absd_(_at_)_electronicforge_(_dot_)_net):
> I'm wondering if anyone can share their experiences or offer suggestions
> running an apache web server with web pages (in this case PHP pages)
> sourced from an NFS mounted file system.
> 
> I am having problem with the speed at which PHP pages are generated and
> returned to clients, when the PHP pages that are processed are on an NFS

...
> I'm sure many people will simply say "don't use NFS", however I do have
> some reasons for this. The backend server system with the NFS shares is
> more robust and has SCSI hardware RAID 5, while the front end system has
So why not run apache on THAT server?

It really depends on your site and data.  And how/why you use PHP.
Templating and referring to lots and lots of files?  Perhaps you
can get those files local (and upgrade "aging IDE").

If the network isn't the choke point, then perhaps the server
or the client config is. This is basic Sage level II system admin
coming in: Identify your bottlenecks, mitigate, repeat.


NFS, on a 100Mb/s network will give you data, realistically, at
around 8-10MB(ytes)/second.  Tops.  Or slow SCSI speeds.  My good
RAID boxes do 60-80MB/s with real (random seek) data.

Where's the bottleneck?
Server? Client? Network? Disk? Badly written code (really common).


On Irix and Solaris, you can mitigate this with CacheFS (nfs through
a cache) for read mostly file systems.  But that's sort of a reach.

Better is to look at your architecture and recognize that your NFS
is a bottleneck.

Is the data mainly static?  Ponder web serving from the big machine
and running a caching proxy on the front?  It will cache images
and many of the pages (as you tell it to).

Or keep the data that's NOT dynamic on the local disk (rsync as
someone suggested).  IDE disk too old?  $200 gets you 2 x consumer
quality 80GB disks.  Your time is worth something.

Running SQL or something over NFS?  Desist.


You can write good code and bad code.  I've dealt with folks where
they use php to get today's info.  Every hit does SQL lookups that
don't change.  renaming the file and in cron running 
  php inputfile.php > file.html
turns it into a static file that takes no work to serve.

I've dealt with good SQL guys who took queries that took 3-4 seconds
to respond to and made them into 1/4second queries.  100k hits/day
and that adds up to real time and load.