Re: CGI PHP vs. FastCGI vs. mod_php vs. application server?



Vincent Delporte wrote:

I'd rather know up-front what's available to raise performance
should I have the problem,

The best thing you can do as a developer is come up with good
data architecture, write efficient SQL and, to borrow a phrase
from Yahoo's Michael Radwin, "use abstraction sparingly".
Most bottlenecks in Web applications come from the database
sever anyway... Beyond that, it's basic programming: efficient
memory use, fast algorithms, etc. Beyond that, it's pure system
administration: use a PHP accelerator, consider enabling
query cache, make sure you have adequate memory on your
system, fine-tune your database server, etc.

With application software already written and deployed, the
only way to "raise performance" (especially in response to
increasing loads) is to change the hardware architecture. First,
you split the front end and the back end (i.e., you have a
dedicated HTTP server and a dedicated database server, each
properly configured for the task). Eventualy, the load may
surpass the capacity of this architecture, and you will have to
further transition to a server cluster (a layer of HTTP servers
and a layer of database servers with load balancing all around).

So there's no good real-life comparison available to compare those
four solutions to write web applications? For instance, I'd be
intested in hearing about business apps written in PHP in (CGI |
FastCGI | mod_php) vs. Java as an application server.

CGI is patently inferior compared to both FastCGI and mod_php.
On Apache, both FastCGI and mod_php work well. Most ISPs
prefer mod_php, but Yahoo!, for one, likes FastCGI better
(perhaps it has something to do with the fact that most ISPs
run on Linux, whereas Yahoo! prefers FreeBSD). On Zeus,
developers recommend FastCGI.

As to Java, it is not an application server; you can use it with
different application servers (Tomcat, JBOSS, PowerTier,
WebLogic, WebSphere, etc.) Those may have vastly different
performance (and vastly different price tags).

Does it make a difference?

Here's what Joel Spolsky once had to say on the subject:

the bottom line is that there are three and a half platforms
(C#, Java, PHP, and a half Python) that are all equally
likely to make you successful, an infinity of platforms
where you're pretty much guaranteed to fail spectacularly
when it's too late to change anything (Lisp, ISAPI DLLs
written in C, Perl), and a handful of platforms where The
Jury Is Not In, So Why Take The Risk When Your Job Is On
The Line? (Ruby on Rails)... Python get a half because
it's on the border, about to cross the line from an
"interesting" choice to a "safe" choice.

http://www.joelonsoftware.com/items/2006/09/01.html

If not, did all those companies choose Java because of the
libraries?

No, because they had developers well-versed in Java and
a nice round budget for a big-ticket items such as WebLogic/
WebSphere and Oracle. Companies that tried developing
high-load Java applications on a low budget (as in Tomcat +
MySQL) didn't get very far; Friendster, for one, was plagued
with performance problems so pervasive that they had to
switch to PHP. There probably was an alternative, to switch
from MySQL to Oracle and from Tomcat to a commercial
application server, but they may have figured that the licenses
are going to cost more than a complete rewrite of the front
end...

What I'm driving at, is that I'd like to choose a technology
based on real-life data,

There is no real-life data. There is only anecdotal evidence.
And you almost never know whether a particular project failed
to meet the requirements because of the poor platform choice
or because developers were inept, or because the planets
were aligned unfavorably... Even people who worked on such
projects often disagree as to the cause of failure; what can
outsiders know for sure?

Cheers,
NC

.



Relevant Pages

  • Re: concurrency, threads and objects
    ... Yes, for example in high performance server design, where the server should be able to handle between thousand and ten thousand transactions per second. ... Threads are very cheap in linux 2.6, when they changed the kernel thread model, they did a test where they created one hundred thousand threads. ... Its almost exclusively coming from java developers, but also from developers of other languages, although not as much. ...
    (comp.lang.java.programmer)
  • Re: How can I get involved
    ... There isn't too much technical documentation there yet, ... Python) from Java. ... Since the server process uses Pyro for IPC and I ... developers of Jython might appreciate the help a bit more. ...
    (comp.lang.python)
  • Re: About FP, folder permissions, and sysops...
    ... Perhaps my "Shame, shame, etc.. ... Your contention was that ASP is some evil scheme to entice developers to use ... 4.> Even if you allowed an unmonitored FTP upload to your server ... Bob Lehmann ...
    (microsoft.public.frontpage.addins)
  • Re: Best configuration for a web developer
    ... I don't agree with you where you say the server extensions method was "clunky", but it does seem 999 out of 1000 developers didn't understand it, don't know how to set it up properly, and probably never will. ... Up to and including VS.NET 2003 the web developer model made a lot of sense and you could switch online/offline between remote and local IIS and all using HTTP. ...
    (microsoft.public.vsnet.general)
  • Re: AJAX devtool using Cobol
    ... managed by a Java Applet. ... Server Affinity is completely under ... just enter an asterix "*" for the Queue Name and then click ... Applet Java code is application-neutral and completely reusable. ...
    (comp.lang.cobol)