Re: OT: why are LAMP sites slow?

From: Kartic (removethis.kartic.krishnamurthy_at_gmail.com)
Date: 02/04/05


Date: Fri, 04 Feb 2005 02:46:16 GMT

Paul Rubin said the following on 2/3/2005 7:20 PM:
> LAMP = Linux/Apache/MySQL/P{ython,erl,HP}. Refers to the general
> class of database-backed web sites built using those components. This
> being c.l.py, if you want, you can limit your interest to the case the
> P stands for Python.
>
> I notice that lots of the medium-largish sites (from hobbyist BBS's to
> sites like Slashdot, Wikipedia, etc.) built using this approach are
> painfully slow even using seriously powerful server hardware. Yet
> compared to a really large site like Ebay or Hotmail (to say nothing
> of Google), the traffic levels on those sites is just chickenfeed.
>

If you are talking about Wikipedia as a prime example, I agree with you
that it is *painfully* slow.

And the reason for that I probably because of the way the language is
used (PHP) (this is a shot in the dark as I have not looked into
Mediawiki code), and compounded by probably an unoptimized database. I
don't want to start flame wars here about PHP; I use PHP to build client
sites and like it for the "easy building of dynamic sites" but the
downside is that there is no "memory"...every page is compiled each time
a request is made. I doubt if Wikipedia site uses an optimizer (like
Zend) or caching mechanisms. Optimizers and/or PHP caches make a huge
performance difference.

Also, PHP has put dynamic sites within easy reach of several programmers
who slap together sites in no time. These sites may have spaghetti code
and even the best infrastructure is not enough to support shabby design
(code, db setup and even server tuning). I have seen people become
programmers overnight! There are also LAMP sites that use Apache 1.3
that is a resource hog; I guess production sites do not want to upgrade
to Apache 2.x/PHP combo!

Coming to python, to be honest, I have not seen many LAMPy sites. I use
blogspot.com frequently and it is pretty reliable; I hear that it is
written in Python but I have no idea about the server and database software.

The way to go is to build around application servers, IMHO. I like the
Twisted.web/Nevow methodology, though for simple situations it may be an
overkill. I like the Webware with Apache-thru-Webware-Adapter setup -
that is what I am considering implementing for my organization. (Even in
the App Server arena, I have seen Websphere with JSP/Servelets sites to
be soooo slow that I could finish my breakfast and still wait for the page)

 From my experience it is an overall tuning thing. Usual culprits are
untuned Linux boxes, unoptimized database design, poorly designed
queries and/or poor application logic...and ah! table-driven pages.
Pages built on tables for the layout kill the browser. CSS is the way to go.

Thanks,
-Kartic



Relevant Pages

  • Web Developers - Happy Hearts And HDTV! - Lockergnome
    ... Certificate on your MSIIS Web server. ... getting data from a database is only half the problem. ... Zend recently started a series about building rock solid code in PHP. ... which provides bulk database conversion. ...
    (freebsd-questions)
  • RE: Access denied for user root@localhost (using password: NO)
    ... >> Do you run php database driven apps on the same server as you use to ... are selling/giving/whatever customer access to php on this server, ...
    (freebsd-questions)
  • Re: Multithreading for standalone php
    ... I'm working on a project that will need to connect to 2 different servers and to speed things up (being ssl) I was hoping to be able to do this simultaneously. ... I need my web visitor to hit a button and be able to enter information on another server while at the same time my system is looking up data ... Would this be the sort of thing possible with PHP or would it have to use threads? ... You probably could still spawn a C/C++ program to do the database work, but I'm not sure it's worth the extra effort and complications. ...
    (comp.lang.php)
  • Re: Sending Lots of Emails in the BACKGROUND?
    ... The way I do it is to have my PHP fork off ... server is busy, so I fork off a process in RAM and then return the user ... You can build the queue with a database and a cron ... go back to sleep again until the next cron wakeup time. ...
    (comp.lang.php)
  • Re: Security design questions
    ... I'm not using mySQL for the record, the database itself will be ... the UNIX user id that Apache or PHP runs as). ... web server won't serve it, and if it is NOT broken, PHP will interpret ... Keeping track of what user is logged in is best done with sessions ...
    (comp.lang.php)