Stas Bekman wrote:
> 
> Well, I've got a performance question
> 
> We all know that mod_perl is quite hungry for memory, but when you have
> lots of SQL requests, the sql engine (mysql in my case) and httpd are
> competing for memory (also I/O and CPU of course). The simplest solution
> is to bump in a stronger server until it gets "outgrown" as the loads
> grow and you need a more sophisticated solution.

That is the simplest solution but it doesn't scale very highly.

> My question is a cost-effectiveness of adding another cheap PC vs
> replacing with new expensive machine. The question is what are the
> immediate implications on performace (speed)? Since the 2 machines has to
> interact between them. e.g. when setting the mysql to run on one machine
> and leaving mod_perl/apache/squid on the other. Anyone did that?

It is commonplace to operate the database and the web server on
different machines.

> Most of my requests are served within 0.05-0.2 secs, but I afraid that
> adding a network (even a very fast one) to deliver mysql results, will
> make the response answer go much higher, so I'll need more httpd processes
> and I'll get back to the original situation where I don't have enough
> resources. Hints?

Your latency concerns are unwarranted.  On my mostly empty switched 100
Mbps ethernet segment, packet latency between two fast machines is on
the order of 1 millisecond.

I like to put the database and the httpd on different machines because
that allows you to scale two requirements independently.  If your httpd
processes are heavyweights with respect to RAM consumption, you can
easily add another machine to accomodate more httpd processes, without
changing your database machine.  If your database is somewhat CPU
intensive, but your httpd doesn't need much CPU time, you can get low
end machines for the httpd and a nice CPU for the database.  Finally, in
the extreme case that your system is database-limited, you can use one
or more cheapo web servers (Cobalt Raqs for instance) and some giant
database machine like a UE10K.

With the database and the httpd on the same machine, you have
conflicting interests.  During your peak load, you will spawn more
processes and use RAM that the database might have been using, or that
the kernel was using on its behalf in the form of cache.  You will
starve your database of resources at the time when it needs those
resources the most.

If you've outgrown one box, go ahead and move the database to another
machine.  You won't regret the latency penalty, and you will gain a good
deal of felxibility.

Regards,
Jeffrey

Reply via email to