PHP Scales As Well As Java
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."
And the other recent additions that add to the scalability of Java?
Java and PHP Scale equally well... Well that isn't a big surprise since Java as I understand it doesn't scale very well..
Food not Bombs is a nice platitude but it breaks down when you notice that the Bombees are usually well fed
Of course PHP scales as well as Java. Don't listen to those who don't like PHP. End of story.
Dave Bell
pudding is as good of a building material as tofu..
A computer without Microsoft is like ice cream without ketchup.
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.
Just as irrigation is the lifeblood of the Southwest, lifeblood is the soup of cannibals. -- Jack Handy
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 zend.com for) and for handling sysv shared memory.
Cheers
anime+manga together at last.. in real time.
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.
I thought the shocking revelation would have been "Java scales as well as PHP" under pathologically slanted circumstances.
..scale Mt. Everest. ...when it does .NET will be waiting at the top.
Especially since you have no first hand experience with Java, making you qualified to have an opinion.
Wonderful.
Yes, but does it run PHP?
From excellent karma to terible karma with a single +5 funny post...
Real programmers use Java. PHP is total garbage, as is every other programming langauge. Ok, maybe I'm a little biased.
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..
-
ping -f 255.255.255.255 # if only
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?
Jason
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?
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].
"...a peek at the architecture beneath both hypes."
Assuming this is a typo, it's the most appropriate one I've ever seen.
Find me in ~/.sig
print "0wn5 j00";
?>
Trolling is a art,
Here comes the flame war
Just as irrigation is the lifeblood of the Southwest, lifeblood is the soup of cannibals. -- Jack Handy
Right, right, that makes sense. It's only after hearing horror stories coming from the telecom
.com bubble, sure why not. Don't
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
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.
ASP = Ass Sandwich Provider
Take your FUD elsewhere Microsoftie.
This is my sig. There are many like it but this one is mine.
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?!?!?
I'll stick with mod_perl and HTML::Embperl, thanks.
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?
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).
/* oops I accidentally made a comment, sorry */
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.
"The difference between pornography and erotica is the lighting" - Woody Allen
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 seems to scale as well--it runs a very busy site I frequent with few problems.
Have you used PHP?
:'( ) 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.
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
Of course in CF, you write custom tags in Java...
Anyway, why write 50 lines of Java when 5 lines of PHP will do?
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 ?
The Raven
What a load of crap...
PHP is an awesome and very useful language...but when it comes to scaling...no 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
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.
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....
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.
The global economy is a great thing until you feel it locally.
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!
...then yes, it does. However:
"PHP can use the database as the back-end session store."
and
"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.
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.
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
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 --
"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.
Scaling is not a language or framework issue.
.NET.
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,
Ceci n'est pas une signature
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.
Cheers,
Ian
From the PHP manual
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?
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
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!
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?
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.
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".
You drank my drink, you drunk!
why can't PHP
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.
nuff said
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!!!
Daniel
Carpe Diem
This is pointless discussion.
.... But even more importantly, PHP is nowhere as MAINTAINABLE as Java, which is just as important ( if not *more* )
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
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.
"It's here, but no one wants it." - The Sugar Speaker
So, what you are REALLY saying is that you have not taken the time to learn the language?
Back when I was concerned about whether BRL had decent performance, I did a simple benchmark on a 586 Debian box with Apache/php3 vs Apache/Jserv/BRL. PHP could beat BRL if BRL used Sun's JRE, but BRL beat PHP using IBM's JRE. When I switched from Apache/JServ to a Jetty server, BRL totally blew PHP away. I tried again when PHP4 made it into Debian, and surprisingly saw no significant difference.
BRL's architecture is much like JSP, except BRL may be faster on the first request as it compiles a simpler language with no intermediate Java source. I would expect JSP to perform as well against PHP as BRL did, if not better.
The article doesn't ignore horizontal scaling. It scales to over twice the width of my browser.
You can make really big sites with PHP and you can make really big sites with Java, that's the fact. Each has advantages and disadvantages. Use what you want. Personally I use Java and while PHP lacks many facilities that Java has, Java also lacks things that PHP has. I would never look down on someone who uses PHP or any other language, because every language has trade offs. One thing that you get with PHP is a platform that is more tolerant of shitty code, when Java will blow, the PHP server will keep chugging along. With Java you have to use a more rigorous build and testing process, while with PHP you can deploy individual files here and there without too much worry. To me these sorts of consideration are as important, or even more important than distributed transactions, and session sharing. Not every site needs distributed transactions, or CMP or any of the other cool Java things. They are nice to have but they may not be required to make a specific site.
Now, Mozart-oz hasn't had the trial by fire that PHP or Java have had--you won't see it used in a lot of commercial sites-but Mozart does show how the type of applications that folks think could only be done in Java, C# or C++, using an army of programmers can be done by a smaller team. Can it be done? Sure. Will it be done? Well, that depends on the will of the community ultimately.
I personally think this is the type of thing that is key to reducing the complexity of large software systems, but it is a _hard_ problem and will take a while to sort out.
There have been requests for getting some of the key features of Mozart-Oz, namely logic variables, into Python. I include this to show some of the difficulties in the discussion here(i.e. we get a lot of really smart folks that don't come to an obvious consensus on how to proceed here). I'm sure that there are some things that you can do in Java that PHP can't do yet-and some of these deal with needs of key markets like banks. Can those features be added? Well, that seems to be contention of some serious researchers in the field.
Python Logic SIG
Applying Logic Variables to Conventional Languages
The infamous Logic Variable PEP
I like PHP, I'd like to work more with PHP in the future. But until the IBM products that I make my living on are built on PHP, I don't have much choice. Which is not to say that I don't like the Java that IBM is using -- I'm *very* pleased with the course and result of the Java development that we've done in relation to the IBM products that we deal with.
Excellent troll, you manage to sound almost convincing while spouting nothing but lies. In fact in most of your points if you swap perl and php they will be much closer to reality.
That there are no replies above my current threshold (4).
I mod down pyramid schemes in sigs.
Php and Java aren't the same kind of language, so why do people insist on trying to compare them? Php works great for a lot of applications, but expanding its function base is a fricking nightmare, and you're dealing with a certain amount of compile time overhead on every page view.
With Java you have easy access to a lot of OOP features that are very difficult to implement in Php, and the function base is simple to expand. Yea it's big and beefy, but that's what you need sometimes.
They're both just tools. Use the one that's appropriate. People scream about Java being bad for small pages. What kind of idiot is using Java on a small page? Conversely I've never even heard the Java vs Php agrument for a big site--it's always Java vs VB, and that's another no brainer.
Just my opinion.
ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
Someone at a company we partner with wrote a web service, part of which made 400+ RMI calls to validate the input on a single (enumerated) field. Yeah, he probably was a former vb guy,and certainly had no clue, but this was in the "Real World", and it made it all the way to release before they noticed it (the staging tiers we all on the same server, the prod tiers were not...)
There are a number of different aspects of scalability. It always starts with performance, which is what we will cover in this article. But it also covers issues such as code maintainability, fault tolerance, and the availability of programming staff.
These are all reasonable issues, and should be covered whenever you are choosing the development platform for any large project. But in order to convey a convincing argument in this small space, I need to reduce the term scalability to its core concern: performance.
I think he's chosen the shittiest option here. Sure, any technology will scale if you throw enough resources behind it. Just keep load balancing and you can make almost anything scale performance-wise.
I think there are a lot of other factors that are much more important. Code maintenance, fault taulerance, etc. are much more important because those can't be fixed by throwing more hardware at it.
J2EE application servers come with transactions, security, resource pooling, and concurrency right out of the box. That's a lot more than I can say for PHP.
Now another thing... he's got his J2EE Architecture completely wrong when it comes to EJB's. With EJB 2.0 (which has been around since 2001), there is no RMI overhead for servlets communicating with Local EJBs. You'd only use a remote EJB if the bean resides on another server.
"A mind is a terrible thing to taste."
Where can I run my java code?
Where can I run my php code?
I like PHP and have used it for a number of project, but it's simply not an application infrastructure like java.
apparently, the folks at JBOSS do think php scales as well as java. of course they have a product to push, but they did use php and found it wouldn't hold up.
My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
First he says:
PHP scales. There, I said it. The word on the street is that "Java scales and PHP doesn't." The word on the street is wrong, and PHP needs someone to stand up and tell the truth: that it does scale.
Then he says:
There are a number of different aspects of scalability. It always starts with performance, which is what we will cover in this article.
It DOESN'T ALWAYS start with performance. The only reason relates performance and scalability is because performance is ALL he talks about in this article. His conclusions (first quote) are COMPLETELY UNJUSTIFIED.
Jeez...
Storing session state in a database only works when you have a small amount of session state to store
I think developers need to commit to smaller session footprints on servers anyway. Our goal here is to have nothing but security information stored on the server - and I think that's very reasonable. Make everything else come on the request.
We see a lot fewer bugs this way, and everything becomes easier to maintain. The database can handle the login information fine (thus far at least - our applications are all very data intensive to begin with), and being in the database means session info is easy to manage.
To me, having another a session quasi-database replicated around the cluster seems like an ill-fated enterprise.
Web development, though, is like that I guess. It's always difficult to picture what works for applications different than your own. The 100,000 lookers at site A call for a different setup than 10,000 workers at site B might need.
Let's not stir that bag of worms...
For your information the JCP is working in an interoperability API to script web pages in J2EE using PHP as a language.
This will be available with PHP as a working example, but it will be possible to use qny other scripting language instead.
The scalability/security/transactionality/etc stuff could be handled by the J2EE back-end. It will be just another way of scripting webpages, using PHP instead of JSP.
Check JSR-223 for more information.
Ricardo
In my experience strict typing has little to do with maintenance issues.
I would rate design, proper partitioning, data packaging, code quality, etc. way above strict typing. In fact strict typing typically adds 10% to 20% code bloat to your application. Besides script typing is more for the benefit of the compiler and not the human developer.
Computers are so fast that even very inefficient systems can easily saturate any network connection you could possibly have. All of Microsoft could probably be served from a single laptop by PHP or Java (not so sure about IIS/.NET--there are limits :-) if it was just a question of how quickly scripts get invoked and can pump out data.
What makes web applications slow is database and file system access. So, no matter what language you use, you primarily have to worry about the scalability of your storage and database component.
The major difference between PHP and Java is how they scale in terms of programming effort and complexity. PHP is great for projects of small to medium sized complexity, but not so good for anything really large. Java, on the other hand, is equally bad for everything: it's tedious to use for small projects and it's better than PHP for large projects, but that isn't saying much.
s/do think/don't think/
My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
Compare JSP and PHP if you want, but to compare a platform to a scripting language is pointless.
The sad reality is that so few developers know enough to fully exploit J2EE that they wind up doing little more than what PHP does better in the first place.
Never pet a burning dog.
In a lot of applications horizontal scaling is much more important than vertical scaling.
I cannot believe an article that talks about scalability simply just "ignores" horizontal scaling.
LOL. More FUD from an Anonymous loser... I'm so hurt :)
This is my sig. There are many like it but this one is mine.
In my experience, it's definatly better at making spagetti.
In the article, the author assumes that the J2EE application includes EJB's and from this assumption he builds in additional layers of overhead, especially with RMI calls to the EJB layer. His assumption is incorrect.
If you really want performance in a J2EE app, you can stick to JSP's and servlets and limit the usage of EJB's. Still keep the presentation in the JSP layer and isolate the business logic in servlets. This approach is quite lean and scales hugely.
When and how to use EJB's is just one part of J2EE application design.
...just wait until php5 appears and some decent progammers convert. An easily scriped OO web language? (no offense perl)
Its like asking God what language he programmed th earth in , and he answeres 'OO cobolt, you FOOL!! Muah ha ha !
Wow man. that was a very good troll.
I had a whole big flame reply written and had the mouse pointer over the submit button, and was previewing one last time before I realized that it had to be a troll.
If you hadn't talked about writing Doom in VB, I think you had me, although the thing about the regexes should have been an instant give away
I used to code in Perl, Cold Fusion, and VBScript (ASP) back in the days that scripting was all the craze. I used to love (believe it or not) working with Cold Fusion. I could create a web application so quickly, and it had features like connection pooling, session management, and application management right out of the box (and this was 5 years ago).
Once clients started demanding "web applications", as opposed to basically static web pages with a little DB interaction, I quickly realized how no scripting solution would scale elegantly. Most people (at the time) would scoff at the idea of writing even a 10K line of code app with Perl/TK, why did we do the same with web apps?
I think the number one reason that scripting sucks for application development of any sort is it's lack of strict typing. This makes it difficult to implement a clean OO design, and it also makes it harder to code IMHO. Sure, there's the extra step of compiling, but that actually helps me track bugs in my code down quicker. Even for small projects I hesitate to use a scripting language because you never know what part of that project you'll want to reuse, or if that project will grow in the future.
So, while most of my resume contains scripting experience, I would have to say that my life as a "web developer" is much better now that I'm working with C# and Java.
There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
The problem is not Java's or PHP's scalability in terms of performance. If there is a problem, people write a better compiler, a better database, buy a faster server or buy more servers. Pocket change for web sites with millions of transactions per day.
The problem is that Java, being a general-purpose, modern programming language, can be used to write understandable and secure code for very complex problems. And PHP, well, is not. Maybe you don't have an application that can be most cleanly implemented as a 5-tier architecture. But if you think you might in future, you don't want to start writting it in PHP. Not the logic portion at least.
A lot of technologies - OO, EJB, relational data design - can seem useless and overcomplicated until one encounters a problem that is complicated. Maybe one of these days I will understand what inspires people to use XML, with schema and style sheets to communicate between their own client and server. Rather than using a nice binary RPC implementation, for example. But then maybe this is one example of a bad technology.
On the other hand, you can still open database connections directly from JSP and combine ease of use of PHP with security of PHP. At least you can still call functions from your class library for connection pooling and input validation.
This is not flaimbait, really . i was playing around with dreamweaver, and php on a mac and i couldnt get a working connection to a postgresql database. this really frustrated me. why. i dont know why anyone in their right mind would use mysql thats just stupid. postgresql is far superior and its opensource. this frustrated me and i guess this is much more of a dreamweaver rant. i like php, its simple elegant. and i guess you can mod it. java is just plain ugly. but why would an opensource app suport mysql, its not opensource. anyways rant over.
The problem with PHP isn't dynamic typing, it's loose typing.
Scheme has strict dynamic typing. You get more concise code, but not so error prone as PHP.
Java has strict static typing, possibly somewhat less error prone, but less convenient.
Languages like ML have strict static typing, but type inference makes the code more concise.
I code PHP at work & Java Servlets at home. The reason I'm useing Servlets for my at home project is that I can leave a thread running in the background to do any database writes after the page is returned. It may not actually be any faster, but it sure seems that way to the user.
Automatic conversion is weak typing in my book. Do you know some "everything is a string" language out there that doesn't internally convert strings to numbers when doing math? Just leaves everything the same type? If PHP isn't weak typed, what is?
Unicode is dead. R.I.P.
Articles like this are totally subjective and always boil down to what one person likes or how much they know about their pet technology.
What I don't see here is an objective comparison of how many $$ or how many lines of code it takes in one or the other. You can wave your hands around all you want in a passionate argument about architectural 'grace', but I remain unconvinced until I see the code, and the person-hours.
It all drives me crazy, because our clients see these little religious wars and it drives down their level of confidence in us as professionals. I build something in Java/PHP, and some other contractor says 'I could do that better (faster,stronger) in PHP/Java'. In the eyes of our clients, we're both idiots when we do that.
At least in Civil Engineering they can do hardness and durability tests on different recipes of concrete. Maybe I should have done that.
Really good joke that one, you almost got me up until point #3 where I realised you were being sarcastic. The data structures thing really took it too far though dude....
#include <sig.h>
How is that for scaling?
Hmm, PHP runs the biggest website *ever*.
Why would you try to argue against it scaling?
.... Someone Had to Say It:
Your application's Scalability is directly proportional to the number of well used neurons by the application's programmer and the sysadmin.
Java has nothing to do with you being stupid or smart, neither does php.
On the other hand, Sun has a lot to do with the fact that most ITManagers are brain dead trolls that drool over whatever the um... 'leaders' of the technology revolution of the 'Internet' tell then.
NO SIG
The PHP Scalability Myth
... two only slightly related topics.
.Net/C# and Java/C++ performance.
... or PHP in a typical PHP engine, lacks the JVM :-) In a Servlet engine every request knows about all request made by the same session before. So all objects ever created by the same session reside side by side in memory until the session times out or they get removed.
... as you can not reliable isolate parallel requests, except via the DB.
The author should focus on PHP and what got improved there over the last years and not take an inocent other language into the dispute.
Comparing PHP with Java is not like comparing Apples and Oranges, as both are fruits, but like comparing Cheese with Bread
What is Scalability?
I dissagree with the author. Scaleability means: if I have a solution, and throw twice the problem (more requests, more data) on it, does it *only* need 100% more resources? Can I extend that by throwing 3 times, 4 times and so on the solution? Where is the point where the solution breaks? When I have it working on a problem ten times the original size? Or can it take 100 times the original size?
Language and Database Performance
Java performs as nice and well as a compiled language like C++. At least under Windows it beats both borland C++ and Visual C++, sometimes by a rather hughe factor. Hint: www.heise.de/ct latest articels about
Database connectivity is not really an issue if you compare "languages".
Comparing Architectures
The way you define an architecture is not the problem in a PHP vs. Java comparision. In PHP you can not keep objects in memory between different web acesses. You have to save the context allways in the DB. In Java you could use a prevalent system, or files, and cash all objects in memory.
The claimed RMI overhead in a Java N-Tier application only exists if you have each Tier on a different server. And then you have the SAME problem in PHP as well. The author points that out a bit late.
Stateful and Stateless Architecture
Nothing much to say here. IMHO an external session store is no real issue. The issue is keeping INTERNAL session state over several requests. To be able not to relly on the DB.
The Convergence of Web Application Architecture
I dont see the convergence. Where does PHP have something similar to container managed persistance for entity beans?
Where does PHP have something similar to container managed transactions and container managed access rights and role managemnt on method level for clients interacting with session beans?
Not at all.
If PHP on top of Java is scalable, then why isn't PHP on top of C?
Because PHP on C
In PHP my previous requests need to know which requests likel will come later. And they have to prepare that by storing all relevant data further requests might need in a DB. Basicly: all PHP applications are only DB frontends used via the web. The simply contain only out of three kinds of statements: html formatting, sql select and sql update statements.
True business logic is impossible in PHP
You can hardly reuse PHP on the business logic level as you are far to strong tied to the DB you had in your initial design.
You can not deploy "components" on different servers with differnt back ends and different configurations for the accessing front ends.
Sure: there is a class of applications for which PHP perfectly suits. But the classes of applications for which Java suits and PHP not, is much bigger.
PHP is only suiteable if you can write the application very monolitic. Java suits well when you can divide the Application up into individual components which get assembled and deployed later to form the application.
Regards,
angel'o'sphere
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
At least with the Apache 1 model, every process is going to have a connection open whether it's serving a page that will use it or not, so it's essentially wasted. You don't have this problem with connection pools.
How do PHP persistent connections work in the Apache 2 model, I'd like to know? Hopefully it's a connection pool behind the scenes.
Well I think I run the biggest PHP web site out there (neopets.com) (>270,000,000 pageviews per day), if anybody has a bigger one Id like to hear how you have managed to scale it up so high.
We use PHP accelerator, our own custom-written connection pooling software, and have over 110 web servers doing about 980 megabits of traffic at peak, and yeah the bottleneck is our database not PHP.
The thought of using any other scripting language makes me rather ill!
Adam
Then use Jetty.
Show me a PHP application that uses session data that can scale to more than one machine, without hitting a database to re-load your session data on every request.
Any half-decent Java app server will do that sort of thing without requiring any supporting code.
very clever
Just ran a quick line count on our dev server and got back 87,501 lines of code. Up until a month ago I was the sole developer for 3 years.
Oh, and I'm our senior Linux admin as well. So I got to do those duties as well. Joy joy.
I don't think strict typing has anything to do with it. Java development scales well because of projects like struts which let you seperate the layers of the project across different departments.
In PHP and Python I'm absolutely certain a single developer can handle more lines of code than in Java. The languages are just so much easier to work with. But Java's design does make it easier to have multiple people working on the same project.
Scalability, maintainability, and performance are derived from a factor much more important than the choice of language/platform, and that is the developers who are creating the site/application.
PHP, mod_perl and ASP projects can turn into unmaintainable morasses quite easily if the coders aren't careful, but Guess What? So can JSP and ASP.NET!!!
The most royal piece of sh*t intranet site I've ever seen was a JSP-based one done by a series of contractors. It was nice'n OO, alright, but this didn't help at all. There was absolutely no consistency in the 'design', they were failing to close recordsets, they weren't using stringbuffers appropriately, business rules in page-level code, etc. It wasn't unusual for users to have to wait 30+ seconds for responses. Thank Buddha that they weren't using EJBs! Happily, it was salvagable w/ many corrections and much refactoring.
This isn't a slam against JSP. JSP can be beautiful and offers great performance when done well. But so can PHP, classic ASP, ASP.NET and mod_perl! Well, maybe not classic ASP! ;)
What really counts is the developers who are working on the project. The knowledge, experience and self-discipline of the developers will always count for far more than choice of platform.
If a company wants a fast and reliable website/web-app then the choice of using JSP, PHP, ASP.NET or mod_perl is pretty much a no-brainer... just go w/ whatever will most closely fit with the technologies you are already using and/or the tech that the company would most like to support/have supported and make damned sure that the developers are up to speed. Using the cheapest generic clods that you can find is a sure recipie for failure.
The only thing that we learn from history is that nobody learns anything from history.
Whew. Some of us have been experiencing this. It's nice to see some data to back up what I've been living through.
My Greasemonkey scripts for Digg &
PHP is great! It serves up pages even during a /. attack... It even serves up the "MySQL died" type pages rather well.
You need to restart your computer. Hold down the Power button for several seconds or press the Restart button.
Scaling != performance
...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 ?
That's why he spends a lot of the article talking about architectures rather than individual machine performance - it's architecture that's key to scalability. The article is right on in this regard.
DB is the bottleneck for most websites... Java did considerably better than PHP in terms of both
This may well be true (though I haven't looked at benchmarks lately). Still, it isn't a problem inherent to script languages - just something to be fixed.
The point of doing it in C is to do it well (and it's really not hard, I do this fairly regularly). Neither Java nor PHP is a good language to do image processing in. Either may perform acceptibly, but they're just not as good at it as C. And there is nothing wrong with mixing languages in this fashion when the relative strengths are so disparate.
In any case, most developers are going to be using an opaque third party tool for charts, and the calling language (if it's even being called by something on the server at all) is going to be irrelevant.
Using a tool for web development doesn't mean it needs to be the only tool in the process. If my PHP database connector is written in C, it's not like the system suffers some horrible everything-is-not-the-same meltdown.
Basically, the article was on target: in the architecture shown, the differences between a scripting language, Java, or even CGI needn't affect horizontal scalability - and this (and database scalability of course) are the only things that matter in the end.
In terms of server counts required, we're back to a straight performance question - and that's another article.
Let's not stir that bag of worms...
Jetty running on that single aging server will blow the doors off of PHP. That's what I saw when I did some BRL benchmarking some time ago. Presumably you'll get similar results with JSP.
I have never found that lack of strict typing damages maintainability.
Besides, 100,000 lines of PHP, Perl, or Python probably does the equivalent of 1,000,000 lines of Java, so it's not a good comparison in the first place.
Sticking feathers up your butt does not make you a chicken - Tyler Durden
Many people just keep saying "Java scales better". However, for small (and even mid-sized) projects, Java's overhead is just unacceptable, and you end up using a BFG-9000 to kill an ant.
I may agree that PHP code is sometimes terrible to maintain, but one has to understand that Java can be a PITA too. Many PHP coders don't even try to make their code at least well-organized, embedding whole queries and stuff like that inside the HTML code. That could be easily replaced by a template system, but it takes more time, so they just do things the fastest (and dirtiest) way.
It crawls under a small fraction of the load of Slashdot. Surely such a site would employ Java "best practises".
I oversee a team of web developers and administer a production and development linux network for them, and there is no question that we use php over jsp. Anytime they're designing from scratch and we know something will need scalability, they go with php. I can only provide insight from a systems administration point of view. For small projects, it really doesn't matter, but every JSP project I've seen go from small to big has ended up running slowly and poorly.
JSP is what has always forced me to get bigger hardware, never php. We have some php guys, and some jsp guys, and many that do both. Obviously it's hard to get a good reading as to which is easier to scale, as everyone is biased... but from what I gather, JSP is slightly easier to scale from a coding perspective. With only a marginal difference, I (and my development team) favor PHP for new projects as JSP tends to give us headaches while php runs quickly and quietly.
I'm sure others agree, I'd love to talk to a linux admin for Friendster and see how much he likes JSP....
When we recieved our trademark we were told that it needs to be everywhere we say Emma. So it was actually our lawyers. Luckily for me the whole thing is templated and branded, so I didn't have to do anything to make the change and our designer only made the change in one place. -Jackson
Okay, please explain how calling you a jackass is Fear, Uncertainty, Doubt?
People seem to forget that it's not scalability, or even performance in general, that limits the reach of PHP-type languages compared to Java. It's the enterprise libraries, programming conventions and built-in features of Java (security features, strict implementation of OO style and type checking) that make it enterprise. PHP does NOT have the architecture, design patterns and frameworks to support complex, MAINTAINABLE design for big apps. I use both, Java in the office and PHP for my own web programming.
Frankly, I wouldn't dream of trying to write the banking software I build in PHP... what a nightmare! People need to learn that the issue isn't one of quality, but of targeted useability. PHP and Perl have their uses, it's just not enterprise software. I mean, hate it as I might, C#/.NET is an actual competitor to Java in that area, but PHP/Perl will never be.
I've been programming in PHP professionally for 3 years, and I can say that it is one of the sloppiest languages I've ever used. Don't get me wrong, it's otherwise a wonderful compromise between C and Perl, but it is too prone to bugs.
1) It has only a variant type, which causes confusion when NULL, "", 0 and "0" need to mean different things.
2) The lint check does not pick up obvious typos.
3) Most bugs are not found until the code in question is run.
4) If you miss a quotation mark, you get strange errors hundreds of lines away (very hard to track down).
I love writing in PHP, but until they have a strict option like Perl, and the ability to declare types other than variant, I would hesitate to use it for another large project.
Step 1. Decide you want to be a big shit.
Step 2. State something obvious but hype it up
so it sounds profound.
Step 3. Get rich on the book circuit.
Here is my planned article "PHP can scale just as poorly as Java".
Well no shit.
Maybe his potential mate is reading slashdot right now.
If I have to explain how an insult creates FUD in a social network then you are more stupid than I originally thought.
Never under estimate the LOW IQ of an anonymous bastard.
This is my sig. There are many like it but this one is mine.
Java, right?
... Java scales?
Sticking feathers up your butt does not make you a chicken - Tyler Durden
Yahoo
Glad to hear this report for "scripting languages" in-general. Java managed to avoid getting branded as a scripting language by having a compiler, even though it runs in a VM just like a scripting language. The VM of a scripting language, the compiler of a low-level language, and all the disadvantages of both...
'wish there was something like this for Python.
My point is, however, that the ease-of-use directly affects scalability. Assuming that both Java and PHP were equally scalable....the issue then falls to how easy it is to get there. Does it become an education thing? Or does it become an ease-of-use thing?
I'll admit, I know nothing of Java. Never tried. So I can't honestly say that one language is easier than the other. Maybe Java is easier than PHP? If so....maybe that's why Java seems more scalable.
Over at the ServerSide
"PHP doesn't have strict typing, so it's harder to maintain."
That's not a language issue, it's a programmer issue. Learn good habbits.
PHP might be good for somethings, however, it is only for single tasks as I have yet to see a PHP enabled website be able to interlingo with multiple sessions without corrupting data between 2 browsers.
Java sucks. SUN is dying, McNealy is driving it straight into hell. Its too bad really.
php is a piece of bullshit :)
At least in Java, it's very simple to set a whole site up to use UTF-8 all over once and for all, and thanks to the native support for unicode throughout the language everything just works, automatically.
I can't remember seeing a single PHP app that handled multiple languages in any was even closely resembling sane.
...From the end user experience, I'll be the first to say Java is a festering piece of shit. Every time I've had to run a Java based applet in a browser or (god forbid) over an X session, it's been ungodly slow! Java DOESN'T scale well if you are talking performance. And now the company I work for is moving to a Java based client application for a big database we have. The bandwidth alone is going to gobble up our network when our 2000+ users all come in in the morning an launch the app. Java Sucks. If you can keep this shit all on the backend with PHP, more power to you.
I try to be fu
I hate it when people talk about "CGI model vs. in-process model" or whatever. Even if your interpreter (PHP, Perl, JSP, etc) is running "in-process", you're still using CGI (assuming that the user is sending data).
CGI is not about how the web server interacts with your program - it is how the web browser sends data to the server.
If you've got something like: http://mysite.org/foo.php?key=value
You are using CGI! Sorry, just one of my pet peeves.
I understand in raw power python with java really whips a llamas ass or something...
I had a serious case of PHP scales once; I thought it was a rare disease, but now I see it's being given exposure in respected news sites like Slashdot. Word to the wise: cortisone cream gets rid of it. Worked for me!
Standing at the very edge of my imagination, I peered into the inky void and realised -- I couldn't think up a new sig.
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).
:-)
You are of course right.
However, everyone uses the phrase "it scales" without further adornment to mean "it scales linearly and with a factor of not much less than 1.0". That's just us humans taking sensible linguistic shortcuts.
On a more academic front, there are two separate issues to consider, the first being linearity (the scaling factor not dropping off as you increase N, ie. overall throughput remaining on the straight line), and the second being the value of the scaling factor, as you point out. They're both important in practice, simply because in the real world it's not just scalability that matters but also absolute performance and efficient resource utilitization as well.
"The question of whether machines can think is no more interesting than [] whether submarines can swim" - Dijkstra
I think that you make an excellent point, but with a caveat: the tools do not make the developer.
I am in the midst of rewriting a PHP app. Why am I rewriting it? Because you are absolutely right: the original PHP app was impossible to maintain. However, the new app is being written based on the lessons learned in the first and is being built using OO principles from the authentication to the page output to the form input. This new app will be maintainable and also extendible.
They are both PHP apps, it's just that one was written well and the other wasn't.
You can write good C code and bad C code, good Java code and bad Java code. PHP deserves special recognition though: it's really tempting to write unmaintainable code.
HBH
"Smart is sexy." -- D. Scully ("War of the Coprophages")
After reading all the comments, it's clear that everyone thinks they know the right way to do things... and I thought it was only guitar players.
...because you could always break the type abstraction. A warning does not a type system make.
Take, for example, connection pools. A large number of the posts here keep harping on how important they are to scaling a database. This is true; having one connection per process is relatively inefficient. On the other hand, I view this as a mixed blessing, as having every single web page hit the database is most often a bad design. By having this inefficiency, I am forced into doing things the right way, rather than the "cool" way. In the web sites that I've worked on, the database connections were not an issue, due to the fact that most page hits got a cached version of the page rather than a "live" version, thus reducing the number of database hits to once every several hundred hits rather than on every hit. Though they would still be useful in several types of applications, I don't personally need connection pools.
Of course, there is also a fundamental reason why PHP likely won't support connection pools soon. As far as I know, the limiting factor is the forked-model that Apache uses, which prevents the implementation of the neat tricks that Tomcat has. Though it would be nice to have many of Tomcat's features, the one that I don't care for is a seg fault to take down the whole web server. Apache's model generally prevents that from happening. I view this additional stability as an "enterprise" feature which Java does not sport.
A futher example would be that of object-oriented programming. Though I love doing some things in Java, there is something to be said for PHP and C's style of programming. Do people realize that the Linux kernel, as well as most of the FSF's projects (GCC included) are procedural programs, not OO programs? Some people seem to think that a large to huge application is a maintenance nightmare unless there are five levels of interfaces and abstract classes. I've found it to be quite the opposite; OOP has diminishing returns after a certain point. Though OOP is still a great way of doing things, it is hardly a panacea. The recent interview with Bjarne Stroustrup is quite enlightening on the whole topic, for those interested.
PHP has a funamentally different way of viewing things than Java, and I've found it to be incredibly fast. My company serves a few dozen midsize websites off of our load balanced cluster of 4 servers, all connecting to a single backend database, and we've found that we could ditch two (or maybe even 3) of the clustered servers and still get the same overall performance from PHP.
Almost all (if not all) of freshmeat.net's pages rely on the database, as that is where all of the project content is stored. It's written in PHP. I believe there may be some sort of cache in between at least some of the public pages and the Internet, but I'm not sure. We get a few hits now and then.
This is especially true for applications like a search engine, where it's difficult to implement them without hitting the database multiple times.
WMBC freeform/independent online radio.
Especially when you can get it for free linux virtual server. Yes you could pass along all your values in hidden form fields. But then you could also write a C++ compiler in cobol.
I've always thought of Slashdot as more of an anti-social network...
Still not convinced? Consider JSR 223, the effort to turn PHP into the front end for J2EE by porting it to Java. If PHP on top of Java is scalable, then why isn't PHP on top of C?
...I had a hard time figuring out if this was a joke article or not.
Language syntax does not count for much, nowadays since everyone has everyone elses best features. Library and runtime is what really counts. That's the point behind JSR223, and even .NET to a large extent. They've realized that in the end, it's all bytecode anyway. If the author doesn't understand that, well I dunno.
It has absolutely nothing to do with scaling.
Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
Your reply constituted 4 sentences: 1 to concede, and 3 inane platitudes.
Try to find something worth saying.
Progress always seems anti-social to those being passed. :)
This is my sig. There are many like it but this one is mine.
This whole PHP/Java fight is getting simply ridiculous. Isn't it about time that it stopped? If you think PHP will do the job then use PHP, if you think Java will do the job the use Java. You'll see soon enough if you were right in your conclusions.
Both have their strong points and weaknesses, just like assembly, which makes for some extremely fast code and is good for stuff like drivers but tends to take a bit longer when you're writing your webserver in it.
No please, explain. At least try. Maybe you can make mi a little bit wiser.
Having read a lot of the posts with their information and misinformation on this topic I think it is safe to say that there are idiots on both sides of the fence. A buddy of mine mentioned that maybe someone should implement the infamous pet store application in an attempt to show that PHP can scale to a large degree. That has been the best idea I have heard.
You never saw a fish on the wall with its mouth shut.
Sorry but I can't perform miracles. Try reading a book on it. You can find them at your local library. :)
This is my sig. There are many like it but this one is mine.
Couldn't have said it better msyelf. Very well stated, :-)
we are all one consciousness experiencing itself subjectively - bill hicks
I'm a fairly advanced PHP developer and use things like Open Mosix to afford SMP to apache and my php-daemons.
I have used PHP to create stand alone services utlizing TCP/IP over SSH tunnels to create distributed networks, multi-user environments, supply real-time XML data and provide database synching across networks as well.
It comes down to the coding I think.
Out of the box, PHP is probably not as scalable as Java for several things beyond a simple web-store or blog.
But, if you go the route I did and spend several months creating a custom object architecture, you'll find many ways to pull the proverbial rabbit out of the hat and afford enterprise class solutions with a lowly scripting language.
Java is great, and I intend to use it more due to market demand. But, I get lots of interest in my library and have used it in production in 3 services so far in the year since it hit 1.0. Perhaps it's time I did a code review and posted to sourceforge, an object architecture that supported portals and daemons out of the box could be useful even in th face of PEAR and PHPNuke.
wow, that was really an entertaining read!
Aren't all characters in PHP 8 bits? What about internationalization?
Ask Google and you shall receive. PHP seems to support UTF-8, and the developers hope to have more extensive internationalization ready by version 5.0.
Will I retire or break 10K?
You call that trying?
Let me preface this by saying at first I was a _big_ PHP skeptic due to the bad experiences i've had with PHP coders (not necessarily the language).
While I could pump out a Java/JSP site quicker than many could pump out a PHP site (due to my knowledge of Java, and the many frameworks (Struts, Hibernate, etc) that exist for it, I have no doubt that a mid-range programmer who has equal experience in both could probably rattle out a PHP site quicker.
PHP is great for:
- small webapps
- mid-size standalone webapps
J2EE is great for:
- mid-size webapps
- large webapps
Much of the reason behind this is that many of the large webapps in the real world need to leverage legacy systems (AS/400...etc). To make a PHP app seamless with existing systems is difficult, and sometimes impossible.
Much of the idea in Java is to abstract away anything to do with the web as far out as possible, so that the application logic can be re-used by webapps, client apps, mobile apps, and whatever the next big or little trend may be.
I rely on PHP apps (phpmyadmin, forum software, web mail software) for much of my development, and I consider them invaluable tools. They're written in PHP, and for what they do, they're absolutely wonderful.
I'm not sure if many of the "Java sucks" crowd have been employed by larger companies where the apps they create need to be maintain and understood by large, revolving teams.... but things like Design patterns allow fresh faces to quickly understand. Layers of abstraction allow different teams to work concurrently better.
If I was a contractor working on a standalone medium size webapp, it would probably be cheaper to do it with PHP. But in my situation, I don't know the scope of the project ahead of time. Requirements change often, and I can't know if my software needs to be extensible, and if other apps will need to re-use my business logic down the road. I'd rather play it safe than sorry, and build something that can play away from the web as much as possible.
Nope. I call that telling you to educate yourself.
This is my sig. There are many like it but this one is mine.
i have seen unmaintable perl, php, asp and yes jsp code ... where do i do my GOF work with php?
Come on, humor me.
Heh. Now you beg? This is getting amusing. :)
This is my sig. There are many like it but this one is mine.
No, I'm just pretty sure you can't explain how calling you a jackass is FUD.
What a unique opinion..anyway you wrote..
You have no clue what enterprise class means. I am a developer for a fortune 500 company with 110,000+ employees.
I work for an Ivy league medical college, and the application that is used to track all of the medical students in the US is written in VB. Plus the hospital we are affilliated with writes some apps in VB also. Maybe you don't use VB for large apps, but that doesn't mean no one does.
Personally, I like VB but I work with Java. It is a waste of bandwith to write posts flaming away at people and personally attacking them based on your own personal preferences. Yet that is half the posts on slashdot. Yes I know, I must be new here. (here comes the guy with the "new here" handle).
or can't comprehend...
Heh. This is hilarious. What 3rd grade tactic are you going to use next?
This is my sig. There are many like it but this one is mine.
I guess that means you really can't explain it. Fine with me.
Obviously you are referring to VB6 and earlier and not VB.Net, which is a true object-oriented language (with the same lame syntax) so I won't go into any more of that.
I am a developer for a fortune 500 company with 110,000+ employees.
That means absolutely nothing in terms of credibility-- Fortune 500 companies do hire idiots, too.
However, many "enterprise" applications consist of a simple program running on the client (like a VB program) and all it's doing is transferring data to and from a back end database. You don't NEED a powerful language on the client side, if all of the magic is done with stored procedures and you're just displaying it.
But being from a Fortune 500 company with 110,000+ employees, you probably knew that.
running perl can handle the load that many other sites out there just crock on
Maybe it has something to do with the fact that Slashdot is hosted on 8 load balanced web servers (3 of which are dedicated to images). And you're comparing slashdot's ability to handle load compared to some dinky little server that gets slashdotted easily? I've got news for you... even cgi/perl boxes get slashdotted. It's all about the hardware. Sorry.
Thats part of the problem right there. If you dumb down a language too much such as VB, you loose all the power features that comes with a language such as C, C++. It also contributes to all the headaches in the world of IT when you have tons of piss poor code written by sup-par "programmers" that cannont grasp anything harder then VB. Trusting a VB-only developer to write an Enterprise class application is like having the "tire change boy" be your machanic. It is a stupid choice to make.
You are obviously an intern, or fresh out of school, and haven't had a lot of real world work experience yet.
Yes, VB makes it easy to write bad code that still somehow manages to work. Many languages do. Believe it or not, it is possible to be a GOOD programmer and write in VB.
If you were a real programmer, you would know that good programming is about HOW you use a language vs. whether you use it, because often you simply don't have a choice in the matter (unfortunately).
ur ghey
God damn, someone mod both of these assclowns down! -1 Offtopic!
Here are some reasons Slashdot runs so fast compared to some other dynamic web sites:
No, I can't think of any more reasons directly related to Perl features.
Will I retire or break 10K?
Basically they say that Resin isn't that fast. I think this has started with Tomcat 4.
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.
Well, I have seen a bit of Java the last four years, and can tell you two things:
1.- To check the performance of things you have to _measure_ and not _guess_. Words from the gurus out there, not mine. If you have not seen a system like the one you describe with java (I have mounted two quite more complex at the time of this writing) you just don't know. You are guessing.
2.- I don't know PHP (beyond the basics, that is) but with the description that you give, Java can do the job quite well. And
Sorry, but java is being used in quite big systems out there. It scales well. What you have to prove is that PHP scales BETTER.
I am not sure when the word 'scalability' started to take on a political meaning as well.
dictionary.com defines it as:
'How well a solution to some problem will work when the size of the problem increases.
For example, a central server of some kind with ten clients may perform adequately but with a thousand clients it might fail to meet response time requirements. In this case, the average response time probably scales linearly with
the number of clients, we say it has a complexity of O(N) ("order N") but there are problems with other complexities.
E.g. if we want N nodes in a network to be able to communicate with each other, we could connect each one to a central exchange, requiring O(N) wires or we could provide a direct connection between each pair, requiring O(N^2) wires (the exact number or formula is not usually so important as the
highest power of N involved)."
I understand that one element of an enterprize application is in fact scalabilty. With that said, no where does scalabilty reffer to OOP, or the speed comparisons to other languages.
For instance, in PERL I can do string manipulation quicker than JAVA or PHP. That doesn't mean that PERL is more "enterprize" than PHP or Java.
Thus arguments like "Connection pooling (Java) is faster than persistant connections (PHP), means PHP is not Scalable" is not true. You are comparing speeds of languages, not their respective scalabilty. If you prove however that PHP persistant connections can not scale, then you have proven that at least one aspect of PHP is not scalable.
I am sick an tired of people stating comparisons in speed as to the quality of a product, or "enterprize" status.
Please do research before you say somehting like "PHP is not enterprize". Otherwise, you're an asshole for making a blanket statement.
Goodnight.
So basically Yahoo! are moving from an interpreted language written in C, to an interpreted language written in C. Woo hoo.
A major web site with millions of viewers is moving from a proprietary framework to a commodity framework. This shows how mature this particular commodity framework is.
Will I retire or break 10K?
Ah... yep. That was the other 3rd grade tactic I was waiting for.
This is my sig. There are many like it but this one is mine.
If Unicode is dead, what else should one use? What widely used character encoding, other than a popular Unicode encoding, supports English, Japanese, Hebrew, Arabic, Korean, Russian (Cyrillic script), Hindi (Devanagari script), and Greek?
Will I retire or break 10K?
I'd say anyone working for a 'true' enterprise doesn't need an article to tell them what's best; otherwise, they're in trouble already. I'll also note I've seen plenty of things I might classify "enterprises" using ASP as a primary language.
First, don't go counting PHP's compile time. If you're balancing across several servers, you're paying for the Zend Optimizer, and you've got code precompiled and parsed, and optimized. When I converted my ~30k line project to encoded, CPU use fell by 30-50%.
Second, unless you're absolutely gluttonous, then session data is not an incredibly significant thing to store in the db. You're working off a single key with a chunk of data, you're keeping the table small with constant GC checks... it's possible that using the db is faster than using the disk-based caching. And note you can split off the session data to a separate db; there's not significant overhead forming connections because you can use persistent connections that stick around through many pageviews.
I have a high volume site I've worked with to split their e-commerce app across servers. Session data is handled via the db; it is ready to be split off to a separate db as needed. Most data is read-based and not very time sensitive (people looking up items, searching for items, generating dynamic pricing data based on sales and so forth), and this balances easily across many servers.
One thing I'm quite sure of is that your design skills count more than the technology in PHP vs Java. One wrong query, one bad decision about caching, and you're wrecking your performance. If one looked at 99% of the apps out there, they'd benefit 5x as much from optimizing the application logic as compared to 'switching languages', regardless of which has the edge. So I view the whole discussion as a red herring; if you're Amazon.com, or the FTC, maybe you need to solve this question. Otherwise, it is unlikely.
For me, this article is all about the PHBs. In my experience, most of the web applications I've seen could be built quickly, cheaply, and reliably using PHP (or perl for that matter). But the PHBs get all caught up on "scalability" and "extensibility" and "portability" and "promotability" and "budgetability" and "sexappealability" and "studability" and think they have to plan for everyone in the world accessing every feature of the application at the same time, from two different computers.
The end result is a project that costs three times as much, takes twice as long, is half as reliable, and barely works.
This is not true for all projects in the world, and of course YOUR project is far too complex to be done in a scripting language, but in my experience 100% of the non-PHP web applications I've worked on (in largish teams, so it's not all due to my incompetence) would have been better delivered using PHP. And 100% of the web applications I've built using PHP have been unqualified successes.
He looked at me and said, "Kid, we don't like your kind, and we're gonna send your fingerprints off to Washington."
http://www.odi.ch/prog/design/php/index.php
I wrote that independetly.
C++ is for pussies. I code in machine language... Assembly if i'm feeling lazy. screw OOP, i like spaghetto code.
ya. and yahoo's gotten A LOT worse lateley.
should stick with C for speed.
speed made yahoo #1
The only problems I've ever had with Runtime.exec() is when the underlying process outputs to stdout and/or stderr, fills up the buffer, and blocks. That can be avoided by draining stdout/stderr, using a background thread if necessary.
i run a couple of sites on which each page is php scripted and most pages are pulling stuff from a database.
40,000 visits a day, 1,300,000 pages a day, complex queries that are several 100Kb of sql, gigabytes of image and mpeg files on a basic dual xeon box, without exception all pages load in milliseconds and the average cpu useage peaks around 7% with an average load of 0.2 (in other words the dual xeon thing is overkill and the whole thing would run quite happily on my celeron laptop)
oh and the uptime over the last 12 monts is 100% (not 1 minute of downtime in 1 year)
i hate all this "enterprise-ready" "scaleability" "mission-critical" bullshit that the big corporates push to knock open source. what's happening above is not a testement to me, it's a testement to the quality of the linux/php/apache/mysql/thttpd software that is driving a site that is actually doing the business. and of *course* i can make it scale to 50 times that size- the strategy is already planned and is so straight forward a monkey could do it. come on guys! what's to discuss? this stuff rocks!
If you want to code in a crappy, hacked language like PHP, then do it. I'll stick to the language with some semblance of design behind it. :-)
(Also I get the feeling that if your PHP app consists of 100 source files, then the interpreter has to parse all of them every single request. Do you have to do that in Java? Nope.)
Karma: It's all a bunch of tree-huggin' hippy crap!
Why in the hell was that troll given points?
> most of the time is spent idle waiting for the user to do something.
Wrong. Do you have any clue how the web works? Either that, you're just trolling. The server, whether it's CGI, mod_perl, JSP, PHP, etc., doesn't sit around idle waiting for the user to do something. It processes the form output from the user then immediately sends the response. There is no idle time spent waiting on the user to do something. Ever.
Zope gets surprisingly little mention in these sorts of discussions. Zope has...
/sites/clienta AND /sites/clientb). So you can have the same codebase running two sites without setting up a seperate server.
* a persistant enterprise level object database, that handles a distributed backend completely transparently (so you dont have to use nasty hacks like hidden variables to store state data. The session data can store key-value pairs of any python object, and is duplicated across multiple servers using ZEO)
* Zope Page Templates
Possibly the best templating language in existance, ZPT fullfills everything you need for your presentation layer.
* Python Scripting
Zope supports python scripts and python products. Scripts are stored inside the ZODB and are generally used to help process data for page templates.
Python Products are where the meat of the processing happens. This is where you define your classes. Each class can be instantiated multiple time into the ZODB (i.e.
* CMF and Plone
Two out-of-the-box products available for Zope, CMF and Plone are probably the most powerfull content management systems known to man. You can extend these to your hearts content- I've created systems for under $1000 that were estimated at $50,000 by a J2EE development firm. I've consistantly been able to duplicate a weeks worth of J2EE in about a day of Zope.
I havn't even began to touch the full power of zope. It's really such an extreme difference in philosophy to J2EE or PHP design models that you need to experience it for yourself.
PHP is awsome, and from what i've seen of presentations regarding PHP5, scalability is not the only thing in common, but so is public,private,protected types, exceptions (try & catch), and other things that for now have been the domain of Java or C++...
When php5 comes out i believe i'll start to dabble in it again. Php is an awsome language and i believe the future will be built around interpretive langauges.
By the looks of php5 (following link) it has a great future!
take a look at this
Giving IE users a taste of their own medicine since 2005 - http://pods.-is-a-geek.net/
The VB comment in the end was a perfect closing.
Interestingly enough, it seems that if jbottero didn't actually understand the underlying point made, then why did they get so obviously offended and lash out? What came out in text was the slavering comments of a PHP zealot.
Then to actually attempt to qualify the statement, "How is maintaining 100,000 libes (sic) of PHP any different than 100,000 lines of any other code?" I just don't know where to begin. Whether or not Java and PHP are similar or the same in terms of scalability seems to not even be an issue. Different code structures (and coding paradigms) can very much matter with large amounts of code. Understand that there is more to the maintaining of code than just having it around. Maintenance often involves expanding, updating, etc to the code base. Doing so with convoluted code is not the best thing as far as efficiency and productivity are concerned.
Interestingly enough, the flame comment at the end about VB would seem to indicate that jbottero does indeed believe that certain languages lend themselves better to smaller or larger projects.
Yep, zealot detector 3.54-2 returns a clear positive.
But here's the thing with Perl. Alot of times the code is unreadable after say... a week. Even commented code can be a mess. PHP *can be* unreadable and messy, but most of the time you can clean it up enough to still figure out how something works. PHP fills that niche of being easy to learn, simple to writea and good for beginner programmers. When I want to use a non-web interface, I choose Python for it's powerful, yet simple syntax, which is similar to PHP in many ways.
I think you mean value object instead of view object. Value Object is actually one of the design patterns that's expected fot this sort of use.
EXCELLENT POINT. If only I had the modpoints... :(
creation science book
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....
The static typing versus static or "loose" typing Holy War has been going on for ages. I think it has more to do with development style and personal preference.
Anyhow, you are not going to settle it in 20 messages. Software people have spent years debating this topic in every programming forum I have ever seen and still don't agree.
Personally I dig dynamic typing. It allows one to view large applications as multiple smaller applications and keeps the code simpler and closer to pseudocode IMO.
Table-ized A.I.
But we are all supposed to be using C++ and Object Oriented programming, and the Microsoft OO framework is this abomination called MFC (I am beginning to sound like the 2nd and 3rd Dune novels. Abomination! Abomination!). The dudes at Microsoft had trouble programming cleanly in C, and turn them lose in C++? MFC is this ugly mess of typedefs, macros, classes, templates, AND wizard-generated code. Abomination!
If you want to pound out a quick GUI program, you are much better off in VB 6 than to wade through MFC. All of the Windows stuff, including support for COM objects is designed into the language rather than (Abomination!) the way it is in MFC. I would just as soon use the Borland languages (I use Delphi -- I am told C++ Builder is pretty much the same) to generate COM and ActiveX objects and then use them from VB 6.
So don't blame the wanna-be programmers for not understanding C++ and being lazy and using VB 6. Blame Microsoft for not knowing how to program in C++ to develop a usable framework for it.
Are there any links to Zope performance tuning guides? Any bechmarks comparing Zope (and Plone if possible) to PHP and JBoss?
Java sucks
Big time. Always has, always will.
I just took a look at freshemeat.net and it looks like there are at least 9 images on the front page. I would guess that means 9 HTTP requests where the database connection was not used and 1 where it was used.
And Amazon is using Mason/Perl/mod_perl/Apache. Methinksts they know something about scaling.
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
THAT'S one good reason to use XML between your own processes, rather than in in-memory data structure and/or RPC. Mgt. is often former COBOLers used to archaic mainframe style processing of many simplistic programs dumping into many many temp files. It's the architecture they know. XML sucks much less than many file formats, but files aren't always the best way to join tasks / processes, as you seem to be "hinting" at.
Yow! I'm supposed to have a plan?
There is some fuzzy thinking around the subject of computer languages.
:-)
There are simple languages, eg. COBOL which, because of their operating environment, scale well enough to run most of the World's enterprise database systems.
Analogy-wise I see PHP and Python more as agile young jockeys than race horses.
Java is unwieldy, lets face it, the corporates have gone outsourcing to bring development costs down, when they ought really to have bought and paid for some better advice from among their own economic eco-system.
I am glad that it could conceivably cost $billions to turn things around to efficiency, because I am bitter - and unemployed
Comment removed based on user account deletion