This post originated from an RSS feed registered with Java Buzz
by Russell Beattie.
Original Post: Is PHP Really More Scalable Than JSP?
Feed Title: Russell Beattie Notebook
Feed URL: http://www.russellbeattie.com/notebook/rss.jsp?q=java,code,mobile
Feed Description: My online notebook with thoughts, comments, links and more.
Friendster's switched from JSP to PHP. Specifically, they've moved from Tomcat to a LAMP solution. Is this a good thing? I mean, they're the guys with 9 million members, a large majority bitching about sluggish response times, etc. so they should know, but it seems awfully strange to me.
Can anyone shed some light on this? First, is PHP really that much more scalable in general, or is this based on a specific server solution? I mean, are these guys not willing to spend on the hardware (and really, should they?). Does PHP just out perform if you're running on a bunch of used 486s or is there other things at work here? Is it just Tomcat? Would WebSphere and WebLogic done the job, but they didn't feel like dropping $10k per server-seat when PHP could be used instead? Are they going to hit a plateau with PHP? Are they going to regret spaghetti code and pseudo-objects, or is PHP past that now?
I guess this just breaks with my little world view. In my mind, projects start with PHP and then move to more established technologies like J2EE, right? According to Sun marketing, eBay is running on J2EE and are quite happy about it and we all know that eBay is 1) Huge and 2) handling *really* important data (i.e. MONEY). For Friendster to go in reverse? It just seems strange.
I'm not looking for a rant fest, I'm looking to learn. Should I be putting up my JSP tights and reaching for my PHP cape instead? What parts of the decision am I missing? I'd love to learn more about this.
PHP will certainly not outperform JSP in general. That myth is perpetuated by the anti-Java crowd only.
JSP does require more RAM to run nicely because there is less disk use (hint, one reason why PHP performs less...). If your machines are low on RAM but have fast harddisks PHP might therefore in some conditions be faster.
PHP code is spaghetti code, I've seen some and it made me think back to the days of JSP 0.92.
It's also a security disaster. I helped out for a few months as an editor at one site running PHP and in that interval alone we suffered 3 serious intrusions (and that's only the ones that succeeded). I know some of the operators and they have probably a century or more of running websites in between them so they know darn well how to tighten down their machines, but PHP is just too leaky (but they're comitted, having a major investment in it by now).
Of course Tomcat (especially the early versions) isn't the best in terms of performance. They'd be better off running Orion which is cheap, secure and fast.
> JSP does require more RAM to run nicely because there is > less disk use (hint, one reason why PHP performs > less...).
It depends a lot on the programmer too. When doing Java it is easy to make a wrong decision about e.g. what Collection type you're going to use, copying String objects too much etc. Sometimes I tend to think there simply aren't enough good Java coders.
> PHP code is spaghetti code, I've seen some and it made me > think back to the days of JSP 0.92.
That is a strange statement. You can create very maintainable code in PHP. I've seen some pretty ugly Java code too. It depends on the programmer. Granted, writing clean code in PHP requires a bit more discipline, especially in terms of OO.
> > It's also a security disaster. I helped out for a few > months as an editor at one site running PHP and in that > interval alone we suffered 3 serious intrusions (and > that's only the ones that succeeded).
As with most tools - be careful when you use them. Most PHP leaks that I've seen were caused by a lack of understanding of the programmer.
> I know some of the operators and they have probably a > century or more of running websites in between them so > they know darn well how to tighten down their machines, > but PHP is just too leaky (but they're comitted, having a > major investment in it by now).
Care to elaborate? It sounds to me that they don't know, or if they did, they were not committed enough to file a bug report at php.net