Article:
  The PHP Scalability Myth
Subject:   Major differences
Date:   2003-10-16 10:39:44
From:   altjeringa
PHP is purely stateless. processing can not live beyond the life cycle of the request response loop. The article downplays this as though the only thing persistance is used for is storing cookies and session data, very backward thinking. This is trivial when building old school web applications but is a huge deal when running real applications which have a web interface. Try building an application in PHP which takes a data set, processes it for and hour and then stores the results for the user when they return. You could hack together a php / c application that'd probably involved a couple of shell scripts, a cron entry, and some major security holes. JAVA makes this relatively easy, secure and self contained.


Another issue totally ignored is that php is strictly a webpage tool. Try writting a client app that does it's core busness logic on a server, let's say via SOAP. That's not very scalable. Yes I'm familiar with the cli and that quirky tk interface.


php is not scalable precisely because it is not an end to end solution. it does simple web apps and does them very well. it shouldn't try to be Java, they are two totally seperate beasts.

Main Topics Oldest First

Showing messages 1 through 7 of 7.

  • Re: Major differences
    2003-10-17 15:12:17  anonymous2 [View]

    "Try building an application in PHP which takes a data set, processes it for and hour and then stores the results for the user when they return. You could hack together a php / c application that'd probably involved a couple of shell scripts, a cron entry, and some major security holes. JAVA makes this relatively easy, secure and self contained."
    Uh, no. Don't talk if you have no clue what you're talking about. I could do this in 5 minutes minus the C application, shell scripts, cron entry, and major security holes. If you want me to prove it I will. In the meanwhile I suggest you introduce yourself to PHP's set_time_limit(), exec(), and while.
  • Major differences
    2003-10-17 11:19:47  anonymous2 [View]

    it does simple web apps and does them very well. it shouldn't try to be Java, they are two totally seperate beasts.


    exactly. different tools for different jobs. you *could* use java to create simple dynamic web pages, but you'd be insane.
  • Major differences
    2003-10-17 10:17:16  anonymous2 [View]

    [snip]"php is strictly a webpage tool."[/snip]



    PHPMole

    php-gtk was not written as a joke. PHP is more then "strictly a webpage tool" its a powerful scripting language.

  • Major differences
    2003-10-16 13:42:51  anonymous2 [View]

    I have done exactly what your talking about using modified database based sessions.
  • Major differences
    2003-10-16 13:18:31  anonymous2 [View]

    Try building an application in PHP which takes a data set, processes it for and hour and then stores the results for the user when they return.

    Please tell me you haven't exposed said application to the Internet. This kind of processing is</is> outside the realm of PHP but if you're placing that kind of application online, you're heading for trouble.

    This is where PHP and Java can interact (hence the specification request). You have your lightweight but robust web interface in PHP. When the user returns to ask their data, PHP spots the cookie and makes a call to the protected Java App Server to deliver the data, PHP acting as a go between.

    "php is not scalable precisely because it is not an end to end solution."

    By end to end solution one assumes you mean you can write all tiers of your application in Java (and the messaging as well). Simply using all Java doesn't make your application scalable. Java is a generalist, PHP is a specialist.

    The presentation tier in particular, in web applications, tends to be where the most "lines of code" are produced (including XHTML or whatever). Do you invest a huge development effort by using a verbose, statically typed language save that time with a dynamic, minimalist langauge, designed specifically for the job? Sun have realised this. So have Oracle. Even Borland.
  • Major differences
    2003-10-16 10:53:17  anonymous2 [View]

    What would do differently for this theoretical long-processing app in Java? Would you make a thread sit around waiting for the user to come back and somehow reconnect to it? Probably not. More likely you would store the result in a database or filesystem, which is just what you'd do with PHP.

    Your estimation of the need for non-web client applications is greatly exaggerated. Most apps are written as web apps these days to take advantage of the cross-platform ubiquity of browsers. If that's your justification of why Java is the only option, it's a pretty weak one, and has nothing to do with scalability of web apps (which is what this article is about).
  • Jack Herrington photo Major differences
    2003-10-16 10:51:26  Jack Herrington | O'Reilly Author [View]

    I wasn't purposely ignoring those issues. The point of the article was to debunk the scalability myth based specifically on performance. I agree that there are a number of distinguishing factors between the two platforms outside of the performance criteria.

    On the stateless issue, there are a number of methods for providing background processing for PHP. There are message queues, background process servers, and batch processing just to name a few.

    However, that is outside of the scope of the article, which is just about performance.