Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

PHP Scales As Well As Java

michael posted about 11 years ago | from the emperor-has-no-clothes dept.

PHP 627

mactari writes "Jack Herrington at the O'Reilly Network has had the audacity to claim that both PHP and J2EE architecture... are converging on the same design [regarding scalability]. Can it be that he's disproven the idea that 'Java scales and scripting languages don't' when he says, 'The idea that PHP does not scale is clearly false at the performance level'? Even if a little oversimplified (ignores horizontal scaling), it's an interesting comparison that takes a peek at the architecture beneath both hypes."

Sorry! There are no comments related to the filter you selected.

Pathetic Heap of Poop (-1, Offtopic)

Anonymous Coward | about 11 years ago | (#7240334)

That's all I have to say.

Actually, I have one more thing too. First Post!

Re:Pathetic Heap of Poop (1)

Foofoobar (318279) | about 11 years ago | (#7240436)

ASP = Ass Sandwich Provider

Take your FUD elsewhere Microsoftie.

Re:Pathetic Heap of Poop (-1)

Anonymous Coward | about 11 years ago | (#7240665)

FooFooBar = Jackass.

HI, I'm Timmy's Boi! (-1, Troll)

Anonymous Coward | about 11 years ago | (#7240592)

Yup, yup, Timmy is OUT! SlashModding will never be the same! HEY TIIMY, those crotchless leather chaps look SMART on you! Just one thing, when you drop by the highschool hangout, make sure you use a RUBBER, those cute 14 year olds get around!

Re:Pathetic Heap of Poop (2)

KDan (90353) | about 11 years ago | (#7240659)

The article repeats that it just scales as well as Java quite a bit. Maybe it does. At runtime. But it sure doesn't at maintenance time!!!


Pathetic Heap of Poop YOU ARE BRAIN DEAD (0, Flamebait)

jbottero (585319) | about 11 years ago | (#7240690)

So, what you are REALLY saying is that you have not taken the time to learn the language?

What's the PHP equivalent to Java NIO? (2, Insightful)

Anonymous Coward | about 11 years ago | (#7240339)

And the other recent additions that add to the scalability of Java?


Anonymous Coward | about 11 years ago | (#7240400)

Last week, our fav SlashMod TIMOTHY came out! YES IT'S TRUE. He likes the firm young cock! It all came out last week when a certain person ("MOM") saw him at the MALL with boy-toy-in-tow, buying his boi some baggy jeans! Go figure! More room to hide that "40" incher! No need to get in a fluster, TIM! Just be yourself! And really, eating cum is not as foul as people say, is it?

Re:What's the PHP equivalent to Java NIO? (3, Insightful)

bigjocker (113512) | about 11 years ago | (#7240508)

What I would love to see is a 100,000+ lines project written in PHP being mantained by one or two developers. You can't do that without strict typing.

PHP is perfect for small projects, but when you have huge requerements and a ton of lines to mantain, that's when the real scalability shows off. You can build a 1,000,000+ lines project in PHP and run it on a distrubuted server and whatnot. But who the hell is going to mantain it??

What is your point? (1, Insightful)

jbottero (585319) | about 11 years ago | (#7240636)

I'm not sure what your point is or how you got there. How is maintaining 100,000 libes of PHP any different than 100,000 lines of any other code? The fact that PHP has very much in common with C syntax should make it even easier. But really, what are you, a VB programmer?

Re:What's the PHP equivalent to Java NIO? (3, Insightful)

Waffle Iron (339739) | about 11 years ago | (#7240638)

What I would love to see is a 100,000+ lines project written in PHP being mantained by one or two developers. You can't do that without strict typing.

Maybe with dynamic typing, that would only be a 30,000 line project.

It may scale (-1)

slash-tard (689130) | about 11 years ago | (#7240340)

But does it run java?

Re:It may scale (1)

twoslice (457793) | about 11 years ago | (#7240399)

But does it run java?

Yes, but does it run PHP?

Scaling (2, Insightful)

stanmann (602645) | about 11 years ago | (#7240341)

Java and PHP Scale equally well... Well that isn't a big surprise since Java as I understand it doesn't scale very well..

wonderful comment (0)

Anonymous Coward | about 11 years ago | (#7240396)

Especially since you have no first hand experience with Java, making you qualified to have an opinion.


Re:wonderful comment (1)

stanmann (602645) | about 11 years ago | (#7240442)

And you are an Anonymous Retard making you qualified to fling your feces...

Re:Scaling (2, Insightful)

Frymaster (171343) | about 11 years ago | (#7240419)

Java and PHP Scale equally well.

as a corollory, it is much easier in php to write code that itself does not scale well. contrary to popular belief, php is not a language for sloppy or new programmers - to write a robust, secure, scalable app in it you have to know what you are doing!

Re:Scaling (1)

letxa2000 (215841) | about 11 years ago | (#7240485)

to write a robust, secure, scalable app in it you have to know what you are doing!

That's the case in any language, not just PHP.

Re:Scaling (0)

Anonymous Coward | about 11 years ago | (#7240533)

Java as I understand it doesn't scale very well
So either Java, a technology used in production applications by enterprises of all sizes the world over, doesn't scale, or your understanding is flawed. Let's guess which.

Re:Scaling (0)

Anonymous Coward | about 11 years ago | (#7240676)

Java and PHP Scale equally well... Well that isn't a big surprise since Java as I understand it doesn't scale very well..

I think a better subject to study would be how the languages scale (as I'm sure there are plenty of scalability articles already). Java scales well as a language, but I really only know basic PHP. An in depth discussion on how the language scales to complex requirements and applications would be great. Can PHP be utilized to create robust backends? How hard is this process? How consise is the code to do this? Scaling in terms of being able to compute is important, but scaling in tems of being able to write the computation is just as important.

Of course.... (1)

IonPanel (714617) | about 11 years ago | (#7240363)

Of course PHP scales as well as Java. Don't listen to those who don't like PHP. End of story.

Re:Of course.... (0)

fussman (607784) | about 11 years ago | (#7240421)

to be fair, don't listen to those who like PHP.
Abuse of PHP. []

And in other news.. (2, Funny)

Keck (7446) | about 11 years ago | (#7240365)

pudding is as good of a building material as tofu..

Re:And in other news.. (0)

Anonymous Coward | about 11 years ago | (#7240408)

Modpoints modpoints, my kingdom for modpoints.

Re:And in other news.. (0)

Anonymous Coward | about 11 years ago | (#7240450)

The parent succinctly captures the essence of the article - very well put!

Props to PHP (1)

w3weasel (656289) | about 11 years ago | (#7240382)

Why do 'serious' programmers poo-poo PHP? And why are programmers filled with such zeal for their preferred language and disgust for all others? For people who are supposed to work logically, you'd think they would see that (nearly) all languages have their good and bad points.

Re:Props to PHP (1, Informative)

marmoset (3738) | about 11 years ago | (#7240439)

PHP is certainly cool, but there are some fairly major gaps [] to be filled.

Re:Props to PHP (0)

Anonymous Coward | about 11 years ago | (#7240662)

You're right, there are. Here's another gap that needs filled [] .

Here's why... (1, Troll)

jbottero (585319) | about 11 years ago | (#7240491)

Programmers generally pooh-pooh languages that common folk can understand and use. VB is a very powerful language that many people use to build enterprise class applications, but an idiot can understand and use it as well. The result? "VB SUX". And as an example, a C programmer is essentially a God, and don't even think about reminding people here at Slashdot that Perl has been dead for a few years. But show off something better and easier? Sacrilege.

Re:Here's why... (1)

sporty (27564) | about 11 years ago | (#7240604)

no.. perl is really really easy to program in. same w/ pyton and ruby. basic as well. Problem with VB and php are they were badly designed yet widley used as an all purpose solution.

For instance, I worked on a company that shunned java thinking it'd never get big, and promoted php. When things started to go awry because php didn't scale w/o some obtuse compiler. Then there were things like the error messages you got back. Once, php had a problem with number of includes (not memory size, just # of includes).

Same thing with VB. There were little quirks in it that made it so dog slow, but "commercial apps" were written in it.

Now lets step back and look at java. Java only has a slow startup time, just like netscape. It has it's set of issues. But you can easily work around them by using different methods. SWT is (I think) based off of JINI so you that IBM created it's own native widget set. If I didn't like swing? I could create my own widget set with the language.

PHP and VB didn't create languages first. They created solutions first and then tried to backport to everything.

Re:Here's why... (1)

sporty (27564) | about 11 years ago | (#7240635)

When things started to go awry because php didn't scale w/o some obtuse compiler.

They had to use some obtuse compiler.

Mental blip.

Re:Props to PHP (1)

Pfhreakaz0id (82141) | about 11 years ago | (#7240528)

In my experience, there is a large portion of programmers who "poo-poo" anything that is a "slam it out" langugage because they have been left to try to maintain it and/or scale it up. (to be fair often times it is the WAY it is written, not the language that determines scalability. It is certainly poossible to write a classic ASP app that scales with MTS and COM objects to allow clustering/load balancing for instance, but most aren't written that way).

The problem is, there is a place for this technology. Not everything needs the features of Enterprise Java Beans, for instance. Some projects have such changing business requirements that spending months investigating them and designing object models is fruitless. Bang out a demo and if you need to fix it later, fix it.

I can't tell you how many times I have been given two weeks to write an application and/or add major functionality to an app, but I can sure count the number of times I've been given what I consider a deep enough spec that I would consider actually give serious thought to the object model: once.

of course it does... (2, Interesting)

joeldg (518249) | about 11 years ago | (#7240386)

we use PHP here for huge web applications.. we have six servers pumping out one website and it connects to a redundant database server.

The same system in java probably would not work, and if so would take up so many resources as to be no efficient.

If you are interested in more examples of some somewhat crazy things you can do in PHP check here [] to see examples of using it on the commandline for ncurses (which I wrote the primary tutorials on for) and for handling sysv shared memory.


Re:of course it does... (1)

Fweeky (41046) | about 11 years ago | (#7240445)

The same system in java probably would not work, and if so would take up so many resources as to be no efficient.

Um, why not? A JIT compiled Java application server with the ability to perform object pooling and the like should outscale PHP in it's sleep, and probably be significantly faster at all levels to boot. If it does anything else, you did something wrong.

(Personally, however, I'm really favouring Ruby/FastCGI over both at the moment)

Re:of course it does... (1)

joeldg (518249) | about 11 years ago | (#7240495)

our one java server at present that is running jacarta and tomcat is a huge resource hog and is slow on top of that, we are actually porting java code to PHP left and right because of issues with it being slow.

saying that it is actually a much faster box than the php boxes we have, and that those php boxes can outperform the java ones (at every turn, the benchmarks are ridiculous) we are not considering java at all.

Re:of course it does... (3, Informative)

FattMattP (86246) | about 11 years ago | (#7240650)

Tomcat is pretty slow in general. Why don't you try Resin [] ?

Re:of course it does... (1)

richarst1414 (584975) | about 11 years ago | (#7240494)

we use PHP here for huge web applications.. we have six servers pumping out one website and it connects to a redundant database server.

Uhm ok.... only 6 we've had over 20 servers running our site using java, jsp and servlet tech's.

The systems works quite well...

Re:of course it does... (1)

joeldg (518249) | about 11 years ago | (#7240530)

what site?

we are a large domain name registrar (not the largest, but close).

Right... Like E-Bay/Amazon! (0)

Anonymous Coward | about 11 years ago | (#7240554)

I have nothing against PHP, but don't claim things about Java when you just don't understand neither the language or its platform.

In websites PHP is reasonable but when talking about enterprise application and transaction management then it doesn't cut it and the article author was obviously completely ignorant of features like that not to mention a deep and unified component environment and API that is unmatched in the field!

yeah whatever (1, Informative)

TedCheshireAcad (311748) | about 11 years ago | (#7240387)

I call bullshit.

PHP is a useful language, and it certainly has its place. But for large enterprise applications, it can't hold a candle to J2EE, in terms of speed and scalability. If you drop some serious bank on an application server, you'll know what you're paying for.

Moderators, have mercy.

Re:yeah whatever (1)

Foofoobar (318279) | about 11 years ago | (#7240482)

Yeah... I LOVE PHP but I have to agree. Without a web server, PHP is still pretty good but it just doesn't scale. Now if he said PERL was as scaleable, Id say he was a bit closer.

Re:yeah whatever (1)

Prowl (554277) | about 11 years ago | (#7240625)

Agreed. We use mod_perl, and all our logic is implemented as Perl Modules. Web sites are just wrappers around the logic.

We chose this because it eliminated the requirement for the web site. We could quite easily interface in Perl/Tk, command line, or curses etc...and because Perl is just cool.

Obviously Java can be used standalone, not sure about PHP. Can it operate with the presence of a web server?

Re:yeah whatever (1)

Prowl (554277) | about 11 years ago | (#7240649)



They got it backwards (1)

defile (1059) | about 11 years ago | (#7240390)

I thought the shocking revelation would have been "Java scales as well as PHP" under pathologically slanted circumstances.

Yes but can it... (0, Flamebait)

inteller (599544) | about 11 years ago | (#7240394)

..scale Mt. Everest. ...when it does .NET will be waiting at the top.

Java owns PHP (0, Flamebait)

JavaLord (680960) | about 11 years ago | (#7240409)

Real programmers use Java. PHP is total garbage, as is every other programming langauge. Ok, maybe I'm a little biased.

Not exactly... [Re:Java owns PHP] (1)

quadelirus (694946) | about 11 years ago | (#7240474)

Have you used PHP?

I program a number of different languages. Java is my first love, and I know it better than any other, but both PHP and ColdFusion do an excellent job at writing very dynamic web sites. I'm not much of a PHP programmer, only becuase its something I do on my spare time, and not for work (we are a macromedia/windows shop unfortunately :'( ) but at least with CF its much easier to connect to a database than with Java, and I've heard argument that PHP is even better than CF.

Of course in CF, you write custom tags in Java...

Anyway, why write 50 lines of Java when 5 lines of PHP will do?

No.. (1)

sporty (27564) | about 11 years ago | (#7240410)

W/o fine grain controls such as managing the persistent connection pool to resources...

No, it's not.

That's not to mention all the other architectual mishaps within the language. You thought perl was bad..

Given a choice (1)

jniver (91943) | about 11 years ago | (#7240411)

But given a choice which would you prefer to use.

I've used both, and for database access I would prefer PHP.

New pole option?

PHP Vs. Java (1)

mattboy99 (637246) | about 11 years ago | (#7240413)

PHP by itself is a superfast scripting engine, both in installation and use. Java on the otherhand requires a lot of setup and maintainance, and usually requires one machine dedicated to hosting its applications. Now tell me how they equally scale?

Re:PHP Vs. Java (1)

blogboy (638908) | about 11 years ago | (#7240479)

Java on the otherhand requires a lot of setup and maintainance... Read: "What's a classpath?" Give me Java or give me a life!

Re:PHP Vs. Java (1)

Frymaster (171343) | about 11 years ago | (#7240498)

Java on the otherhand requires a lot of setup and maintainance

java also requires a lot of development time! writing php is so damn fast that you can shave some serious time off your development and debugging cycles. for anecdotal evidence witness two dot coms. i work for one. my friend worked for another. we both started our more-or-less equally-sized apps at the same time. my dot com went to market [] . his went bankrupt at the 90% mark three weeks after we were done.

Re:PHP Vs. Java (1)

poot_rootbeer (188613) | about 11 years ago | (#7240697)

Why should "easier to install" be a factor in choosing PHP over Java? If you do it right, you'll only have to do the installation once during the life of the server.

You should be more concerned with which platform is more powerful and scaleable once the installation is complete.

Kiss and say goodbye to Java language!! (0, Troll)

Anonymous Coward | about 11 years ago | (#7240414)

No Java, no JSP man. Simply use PHP for web development.
Forget Java man and go to PHP!

PHP is 4 times faster than Java technology 'JSP' (Java server pages).
This tallies because compiled "C" program is 4 times faster than Java.

Moreover, PHP is getting the object oriented features of Java language.

The real usefulness of Java is 'Java applets' which run on client browsers but on the server side you simply use PHP.

PHP is a very lightening fast object oriented scripting language. PHP is 100% written in "C" and there is no virtual machine as in Java. Nothing can beat "C" language ("C" is a language which never dies!!)

(Java is just another language. The PHP project needs millions of Java programmers who can add the Java's language features like inner classes, static, private, protected and others to PHP. PHP already has some of java' features).
Java programmers will really "LOVE" PHP as PHP class is identical to Java's class keyword.

Read the benchmars of Java JSP and PHP. PHP tops in the speed!!

Read the doc here [] and mirrors at [1] [] , [2] [] , [3] [] , [4] [] .

Re:Kiss and say goodbye to Java language!! (1)

quadelirus (694946) | about 11 years ago | (#7240507)

I already wrote one post in favor of PHP. So here is my post in favor of Java. Don't dismiss Java too easily, it has a lot of libraries for doing things that are more difficult to do in Scripting languages... Anyway I like Java for client side apps, not for applets. I write code on my linux box, and it runs on my MS Laptop and on my Apple Titanium, end of story... The performance boost from C is really neglegable on the client side with computers running as fast as they do today.

Re:Kiss and say goodbye to Java language!! (0)

Anonymous Coward | about 11 years ago | (#7240628)

"The performance boost from C is really neglegable on the client side with computers running as fast as they do today."

Bull shit. C and even C++ blow away Java in any performance critique even on high end machines. Facts is, Java requires a virtual machine to interpret the bytecode. C executables run natively without the help of any VM, hence the wide performance gap.

Java was not designed client apps; using it as such is as pointless as using xml as a file system.

Re:Kiss and say goodbye to Java language!! (1)

quadelirus (694946) | about 11 years ago | (#7240644)

do you use Java applications or are you speaking from what youve read, since everything on the internet is true? I actually use a lot of Java apps.

Re:Kiss and say goodbye to Java language!! (1)

mannionh (669223) | about 11 years ago | (#7240511)

Actually they both run on virtual machines. You might know this if you read the article.

Best typo ever (1)

thaddjuice (235568) | about 11 years ago | (#7240416)

"...a peek at the architecture beneath both hypes."

Assuming this is a typo, it's the most appropriate one I've ever seen.

PHP (1)

grub (11606) | about 11 years ago | (#7240420)

print "0wn5 j00";

Get out the Zell Gel (1)

w3weasel (656289) | about 11 years ago | (#7240427)

Here comes the flame war

Meaning? It doesn't scale at all... (0)

Anonymous Coward | about 11 years ago | (#7240433)

Right, right, that makes sense. It's only after hearing horror stories coming from the telecom
industry that you realize how much Java scales. Around 50 servers to run a network for a
pool of about 1 mil customers ISN'T what i call scaling!

You can compare PHP to Java all you want, both of those technologies have serious flaws
and aren't that interresting. You want to create another .com bubble, sure why not. Don't
come in afterwards complaining that the market went down again. I'd like the market to
evolve a little bit and for this to happen, the suits will have to listen to the jeans.

Re:Meaning? It doesn't scale at all... (1)

quadelirus (694946) | about 11 years ago | (#7240541)

so what exactly would you say DOES scale? ASP.NET? Perl maybe?


Anonymous Coward | about 11 years ago | (#7240437)

Hey what has happened to moderating??

Usually ~5% of the messages get five points, 10% get four points and so on.. Recently ONLY 0.5% of the posts get five points and couple of percents four points. I used to read only 4-5 point messages but nowadays there are only few of them!!!

It seems that users don't get five-point-moderator status anymore so often. Why?!?!?

perl (1)

SCHecklerX (229973) | about 11 years ago | (#7240444)

I'll stick with mod_perl and HTML::Embperl, thanks.

Could someone explain instead of just flaming? (2, Interesting)

Faramir (61801) | about 11 years ago | (#7240458)

Okay, talk about asking for a flaming! I'm a PHP developer whose done a bit of Java but knows nothing about J2EE. Can someone explain how this is relevant to me, as I start looking at larger applications with hundreds, perhaps thousands of users?

Re: Could someone explain instead of just flaming? (0)

Anonymous Coward | about 11 years ago | (#7240568)

Basically, if you want any sort of decent database access (connection pooling, caching, etc) with PHP you are going to have to use some mysterious 3rd party products.

If you need isolated transactions that involve multiple resources, you are shit out of luck with PHP.

If your code design is at all complex, or you have a large team, you probably want to go with Java.

On the other hand, if you just have some simple data that you want to splat onto a web page, PHP has the potential of being much faster under a large user load. J2EE doesn't really help you there.

They each have their purpose (0)

Anonymous Coward | about 11 years ago | (#7240646)

As a Java developer:
PHP is good enough for a website, if you know it then either stick with it or learn Java but I think its best to stick to what you know.

However if your project is enterprise level requireing things like distributed transactions complex authentication integration with mainframes and ERM then your only "real" choice is J2EE where the alternative is a huge stack of propriatery technologies that don't play nice together.

Yahoo! (3, Interesting)

nocomment (239368) | about 11 years ago | (#7240464)

Well seeing as Yahoo is switching [] over to php, from C no less! Plus if you want to, you could use slashdot as an example of scripted sites. Of course slashdot at random interval won't load for about 10 or 15 minutes (rarely longer).

Re:Yahoo! (1)

kevin_conaway (585204) | about 11 years ago | (#7240583)

If you read the article, they mention the only reason they arent using Java is because FreeBSD doesnt have decent threads support. Perhaps if the major bulk of their systems ran a different OS, they might use j2ee?

More importantly... (1)

CooCooCaChoo (668937) | about 11 years ago | (#7240465)

People compare PHP to Java. That isn't PHP's main competitor. The main competitor is ASP and so there fore, a better comparision would actually be between ASP/ASPX and PHP in regards to scalability. Once Mono is feature complete, then compare MS ASPX to Mono, then compare the two to PHP.

Once those comparisons are made, one can then decide whether the superior one is due to either the design/architecture or simply because one is better implemented than the other.

Personally, I find that both have a place depending on what you want to do. That is why there is diversity, because there isn't one product out there that is everything to everyone. Toasters for example all pretty much all the same. There is no difference between the taste of toast cooked in an elcheapo tiffany toaster vs and expensive Sunbeam, it is simply personal taste that dictates what is bought.

We can continue arguing which is superior but deep down inside every person here, things aren't done on technical superiority, it is done because the PHB got his creative juices following when he heard a marketer promote their "solution" over another.

there is convergence (0)

Anonymous Coward | about 11 years ago | (#7240466)

PHP is a simple language complicating with every release and moving towards a scalable compiled architecture.

Java is a complex compiled language that scales well with J2EE and is moving towards a simpler design with technologies such as JSP 2.0 and JSF.

Which is better just depends on your viewpoint.

Perl (2, Interesting)

rmohr02 (208447) | about 11 years ago | (#7240468)

Perl seems to scale as well--it runs a very busy site [] I frequent with few problems.

Re:Perl (1)

ProtonMotiveForce (267027) | about 11 years ago | (#7240700)

Uhh, right... Ever tried to maintain half a million lines of Perl? 3 million lines?

The overhead of maintenance for Perl rises exponentially with the number of lines.

The Superiority of PHP over Perl (-1, Flamebait)

Anonymous Coward | about 11 years ago | (#7240475)

Recently I've had a chance to do some web design with PHP. Previously I'd used Perl because I'd heard from many people that Perl was the end all and be all of scripting languages for the web. Imagine my suprise to discover that PHP was vastly superior! I know this is a bold statement, but I have solid arguements to support it.

Before I begin, let me just clarify something. I'm not arguing that PHP is better than Perl in all cases. There is certainly still a use for Perl. Also, PHP isn't perfect but it does manage to fix many of the shortcomings I've had with Perl. Here are a few of the things I've noticed about PHP. Finally, I'm not the most talented Perl programmer out there. I generally prefer to use the vastly superior Python, but can use Perl if I have to.
  • Ease of use. After about a day I had an excellent understanding of both PHP and SQL. I was able to get a stable, useable and presentable website up within 24 hours of reading the basics of PHP. Learning Perl took me weeks and I'm still not even as good with it as I am with PHP.
    I would definitely not recommend anyone new to programming begin with Perl.
  • The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work (whether or not OO is all that great is another discussion.) Hopefully Perl will be patched up so it supports such must-have OO features like introspection, reflection, self-replication and ontological data-points.
  • Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl seems limited to MySQL and PostgreSQL, and its really a kludge for the later. I've heard that this will be fixed in upcoming versions of Perl though.
  • Speed. PHP is one of the fastest languages I've ever used. While it won't be replacing assembly or C, its definitely faster than Perl in almost every case, particularly in regex which has long been Perl's strongest point. I'm sure there are cases where Perl is equal to PHP, but I can't think of any at the moment.
  • Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl requires that much rewriting.
  • Graphics. PHP comes with a nice little graphics library. While I wouldn't use its to code the new Doom (VB would be a better choice) its adequate for most web pages, and should be considered as a substitute for Flash for certain things. Perl lacks a graphics library of any kind.
  • Data Structures. Under PHP you can create any type of datastructure you need: Linked lists, binary trees, hash tables, queues, inverse Reiser-biased recursion trees, etc. Under Perl you're extremely limited in what you can do. This is because Perl isn't OO (so you can't create Node classes, for example, usefull in a linked list) and because it lacks pointers. Some of you may notice that PHP lacks pointers, but look deeper! Behind the scenes, hidden from the user pointers are used. Because of this, PHP can support complex data structures.
Again this is just my experience. I don't mean to offend any Perl coders because Perl was an excellent language. However, in certain cases it may behoove one to write the back end in PHP instead of Perl.

Some facts (5, Informative)

vlad_petric (94134) | about 11 years ago | (#7240477)

1. Scaling != performance. Scaling simply means that if you multiply the hardware by n you should be getting (ideally) close to throughput *n.

2. DB is the bottleneck for most websites. A good connection pooling and caching system are critical. Ahem ... last time I checked, Java did considerably better than PHP in terms of both.

3. As PHP was not designed as a multipurpose language, sometimes a PHP-only solution is simply a kludge. PHP's power is in writing webpages quickly, if you want to do, for instance, something more complex like charting in a web page (well, in a .PNG), things can get messy. Yeah, you can do that in C, but what's the point ?

Re:Some facts (0)

Anonymous Coward | about 11 years ago | (#7240598)

> Scaling simply means that if you multiply the hardware by n you should be getting (ideally) close to throughput *n.

That'd be the definition of linear scaling. Scaling can apply to n, .5n, or other rates. So, saying X and Y scale at the same rate could they both scale at 0 (ie, adding machines have no effect).

Re:Some facts (2, Informative)

consumer (9588) | about 11 years ago | (#7240637)

PHP provides persistent connections, so the system does not need to reconnect to the database on each hit. It also provides various caching tools, like memcached [] . Charts and graphs are typically handled with third-party libraries. It's not exactly hard.

Re:Some facts (4, Insightful)

vlad_petric (94134) | about 11 years ago | (#7240682)

But connection pooling scales much, much better than persistent connections ... Especially when each user makes only a couple of requests.

No way Jose (0)

Anonymous Coward | about 11 years ago | (#7240489)

What a load of crap...
PHP is an awesome and very useful language...but when it comes to way.
Want facts? Go look at PHP Nuke vs JBoss' Nukes. Nukes was a Java rewrite of PHP Nuke. They did it because PHP didn't scale very well at all.
Read about it here: JBoss Nukes []
and here
O'Rielly Article on Nukes []

Hmmmmm (1)

Ranma (3995) | about 11 years ago | (#7240501)

We just had an ask slashdot discussion about this a while ago. Its kinda weird when you read an article posted on a site about a discussion on the same site... I got nothing....

They scale differently (4, Insightful)

digidave (259925) | about 11 years ago | (#7240536)

Java scales up very well, PHP scales down better.

If you're trying to run on a budget where you can't add a ton of servers and are limited to aging technology, Java will not scale to that environment very well. PHP can do quite well there.

Sun isn't interested in that market, which is a shame because there are a lot of companies still cutting budgets. I'd love to buy a server newer than a P2 1ghz, but it's not going to happen until at least next fiscal and even then, unlikely. We don't all work for technology companies who understand or care.

IF you accept the underlying assumptions... (4, Insightful)

Dr. Bent (533421) | about 11 years ago | (#7240560)

...then yes, it does. However:

"PHP can use the database as the back-end session store."


"The ideal multi-server model is a pod architecture, where the router round-robins each of the machines and there is only a minimal session store in the database."

are pretty tough assumptions to swallow. Storing session state in a database only works when you have a small amount of session state to store. Otherwise the database quickly becomes the bottleneck for any operation you need to perform. The alternative is that you have to have your session state distribuited in a cluster, which is something that, AFAIK, you cannot do in PHP. You can, however, do it Java. In fact, some of things that JBoss is trying to do [] will make session replication across a cluster fairly easy.

PHP can be very useful. I think PHP as a view layer sitting on top of a a J2EE controller and object model would be a wonderful idea. But to say "PHP scales as well as Java" is a huge oversimplification of the extremely complex problem that is enterprise computing.

Re:IF you accept the underlying assumptions... (1)

consumer (9588) | about 11 years ago | (#7240685)

All of the Java "best practices" stuff is full of warnings about how storing anything significant in the session will kill your performance. It's a huge mistake. Only truly transient data belongs in the session, regardless of language. And yes, PHP has various ways of doing distributed sessions, but frankly this sort of thing is overrated. It's VERY hard to go faster than MySQL with MyISAM tables for this kind of simple shared data.

Scripting not scalable? (0)

Anonymous Coward | about 11 years ago | (#7240562)

You mean scripts are composed of a special class of dancing angels so unlike other languages?

Scripting has benefited me and my clients with languages as lowly as vbscript. There are things you can do with these languages that are scalable and not scalable. There are architectures that are better for scaling than others, but it has nothing to do with the scripting language itself. This is not news.

PC vs Mac (0)

Anonymous Coward | about 11 years ago | (#7240572)

the whole article should be modded down -1 flamebait

oh and ALL computers suck, now let me get back to my 1.2gb word processor and listen to my mp3's on my 80mb player

Oh, so that's why he said that... (2, Insightful)

DrEldarion (114072) | about 11 years ago | (#7240573)

When I read the story above, I saw "Jack Herrington at the O'Reilly Network has had the audacity to claim that ..." and thought to myself, "why would the person who submitted this write it like that?".

Then I read the comments, and it seems that people actually get seriously OFFENDED by statements like that! You're reacting almost as if the guy insulted your mom! Calm down... breathe...

-- Dr. Eldarion --

where I stopped reading (5, Insightful)

BigGerman (541312) | about 11 years ago | (#7240584)

"A page showing ten fields from twenty objects would make two hundred RMI calls before it was completed."
Sure if it was coded by former vb guy w/o a clue.
Even naive J2EE applications I saw would be smart enough to use a view object (containing all twenty business objects and their fields) to come back from the buisness layer in one call.
A person to use argument like this about J2EE scalability has no credibility whatsoever.

mod parent +5 informative (1)

jasonbowen (683345) | about 11 years ago | (#7240658)

nuff said

Re:where I stopped reading (2, Funny)

tmhsiao (47750) | about 11 years ago | (#7240664)

Sure if it was coded by former vb guy w/o a clue.

Welcome to the Real World.

The framework is not the problem (0)

heironymouscoward (683461) | about 11 years ago | (#7240602)

Scaling is not a language or framework issue.

Both Java and PHP scale because they run on scalable hardware, and this is the real key. Can you create instant resource pools using stuff like OpenMosix, or do you have to glue your servers painfully together following the "standard" clustering models?

If you can scale your hardware, and if your framework follows suit (by nicely splitting work over many processes and handling the database correctly) then of course you can scale the application.

It's not magic: the more portable your underlying framework, the more you can scale.

Again, this is not a language or framework issue except insofar as they hamper portability. Like, yes, .NET.

Web stuff again (1)

mccalli (323026) | about 11 years ago | (#7240603)

From the article: "Yet another area of efficiency concern is in the connection between the language and the web server. "

Only for web applications. If the argument is that PHP can serve up HTML as fast as Java can, then I imagine he's right. But there's a lot more to the world of programming than shoving out HTML.


Is this a JOKE? PHP doesn't even support UNICODE! (1)

sproketboy (608031) | about 11 years ago | (#7240608)

From the PHP manual []

Is that good? (0, Flamebait)

Pan T. Hose (707794) | about 11 years ago | (#7240626)

PHP Scales As Well As Java -- is that a good thing? I'm not sure how well Java scales. How does it compare to Perl or Smalltalk?

No numbers? (0)

Anonymous Coward | about 11 years ago | (#7240633)

Ugh, that article contains only theoretical arguments for why PHP might or might not scale as well as Java. The problem with those purely theoretical arguments is that more often than not they go wrong...

I have assumeed the "Java scales, PHP doesn't" rumors to be talk from the field, where people tried both and found Java to work better than PHP for them. I'm happy to believe that, and would be happy to change my mind, given supporting evidence.

The article should have contained at least some kind of measurements, e.g. telling us how many hits/minutes a simple sample application in PHP and Java could sustain on a given platform. I don't see how the author expects to be taken seriously, when he theoretizes on measurable quantities, but doesn't bother to measure them.

P.S.: First law of optimization: Measure!

Performance vs. Scalability (1)

shmert (258705) | about 11 years ago | (#7240651)

This article doesn't talk about scaling, but about performance. As one poster commented on the article, performance measures how long it takes to process a single request. Scaling is how well it handles many concurrent requests.

Also, the lack of any solid numbers is annoying. The author basically points to various levels of abstraction in the Java model and says "See! This is slowing things down" without any concrete comparison to PHP.

I use both Java (WebObjects) and PHP, and I actually really like both of them. As has been said many times before by sensible people, use the right tool for the right job. For a low-traffic website with a lot of static content and a couple dynamic forms, I'd much rather use PHP. For a huge app with a very large database, I'd rather do something in WebObjects.

PHP performs well, except for the fact that each page hit re-parses the script into executable php "bytecode". Using Zend Optimizer can make this much less of an issue.

However, the other big downside to PHP is that it's difficult to share data at the application level. Session-level storage works well, using $_SESSION variables, but if you want to have some application-wide information, your choices are to either:
* Store it in the database
* Use the filesystem
* Use some 3rd party application-level cache, or roll your own.

The first option leads to, you guessed it, NONSCALABILITY. By making the database the bottleneck, it makes it much more difficult to add extra servers to handle the load.

The second or third option would probably work O.K. but it's not quite as self-contained (or speedy) as using shared Java objects. Also, tacking on 3rd party shared-memory solutions to handle what should be a very simple thing seems, well, tacky.

Disclaimer: I've not used J2EE or JSP, nor do I want to. I'm a WebObjects programmer. Which uses Java. I think a lot of confusion results in people who say "Java" and really mean "JSP".

if Linux can make it, (0)

Anonymous Coward | about 11 years ago | (#7240656)

why can't PHP

Oh dear.. (1)

ProtonMotiveForce (267027) | about 11 years ago | (#7240657)

I didn't read the article (too lazy), but the synopsys is sadly confused.

Java scales well in the design side - it's a cleaner language and it's easier to develop large systems without losing yourself in a shitload of unmanageable code. PHP, umm, doesn't.

Which scales better in terms of performance depends, of course, on what you're doing. I'm sure there are areas where PHP scales much better than Java. Conversely, in most real-world areas Java probably scales better.

Pointless (1)

ymenager (171142) | about 11 years ago | (#7240683)

This is pointless discussion.

You only really have to worry about scaling if you have a HUGE project.

Now if you do have a huge project, PHP doesn't even hold a candle to J2EE due to lack of features like JTA ( distributed transactions ), and all the rack of clustering capabilities of J2EE .... But even more importantly, PHP is nowhere as MAINTAINABLE as Java, which is just as important ( if not *more* )

Hrm (4, Insightful)

Etriaph (16235) | about 11 years ago | (#7240689)

The issue with PHP is not whether or not it scales as well as Java, but whether or not it's useful in a real-world application. In my opinion, it isn't that useful.

PHP offers us no way to build an application server (unless you write one in C or C++ and send commands to it via a cli or directly through sockets). If you embed Tomcat in your application server, you can simply create contexts and mount them with mod_jk. Quite simply, you can take any server that you've written in Java and web enbale it fairly quickly. PHP lacks persistence, and I'm not talking about sessions.

Let's say that we want to add a request to our application from the web. With Java I can toss the request on a queue which a thread picks up and balances to several other worker threads who interpret the request and works with it. With PHP I would have to enter data into a flat file, or a database, and have a cronjob setup to run every minute or so and do something with data in the database. Even then, at that point, I can only have one thread unless I want to mix and match several cronjobs to run at seperate times (or unless I want to fork the process off very uncleanly using exec() or system()). In any case, does PHP scale as well as Java? Maybe, I'd need to do more tests. Is it nearly as useful? No, not right now, probably not ever. Unless you are willing to write your own custom PHP module in C and play with PHP that way, I think big jobs should be left to the heavyweight in this discussion.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?