High performance, large scale dev? Is PHP the right language

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
cbucher
Forum Newbie
Posts: 3
Joined: Wed Mar 22, 2006 10:15 pm

High performance, large scale dev? Is PHP the right language

Post by cbucher »

I'm about to start development for a high performance, large scale (200k+ users) system. I'm torn between using PHP or Java/.Net for the development. I've implemented several high performing, multi terabyte systems using .Net and Java but question PHPs performance. Any thoughts on scalability, responsiveness, etc. would be much appreciated. If PHP is suggested, are there any core frameworks that we should use as the foundation on which to build? Thanks in advance.

-C

8O
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I've worked on projects where on a Fedora Core 4 server with 512 MB of RAM and a Celeron 1.4Ghz (I think it was) with primarily standard config (no compiling or caching) using PHP 5.0.3 (not even 5.1) we could saturate 100Mbps lines using only 5% of the CPU.. So it can scale quite nicely. Now it really depends on the processing requirements and other requirements, but most often, the server is the major culprit before the software (properly written, mind you) becomes a real issue.

That being said, I probably would push a bit more toward Java (at this very moment anyways) but I have some some reservations to see what PHP 6 ends up like. From what I've read so far, it should be quite nice and scale better than previous versions. So again, I think it will generally come back to the server's themselves.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: High performance, large scale dev? Is PHP the right lang

Post by alex.barylski »

cbucher wrote:I'm about to start development for a high performance, large scale (200k+ users) system. I'm torn between using PHP or Java/.Net for the development. I've implemented several high performing, multi terabyte systems using .Net and Java but question PHPs performance. Any thoughts on scalability, responsiveness, etc. would be much appreciated. If PHP is suggested, are there any core frameworks that we should use as the foundation on which to build? Thanks in advance.

-C

8O
Honestly...realize this is going to be primarily answered as a matter of opinion...

Is .NET faster than PHP...

Well natively, yes I imagine so, being compiled kinda helps. Some will inform you that PHP Zend optimizer or whatever it's called, does just that...which increases the speed or performance of PHP scripts tremendously....therefore competing head to toe with .NET languages...

But really your comparing apples to oranges...

A Linux system (as I understand it) can be minimized to pretty much ONLY required modules (Kernel, httpd, etc...)

Windows, has a lot of bloat YOU CAN'T get rid of...

You cut yourself with a double edge sword with your question on any suggested frameworks...

If your after code performance or speed, a framework is a bad idea...

So if you want my opinion...yes use PHP as an enterprise programming language...I'm sure you won't be the last or the first...

Don't bother with benchmarks, cuz there always biased...on both sides...just know that, as both PHP and .NET can be compiled into byte code, that alone makes the compete in the same game...

.NET has the advantage of having an excellent IDE...and Java...I have no idea...I suppose open source, large community and strict OOP support...PHP has a large community and is open source and easy to learn...

Each one I'm sure has it's strengths and weaknesses over the other...

Which one you pick is a matter of choice...

You asked this question in a PHP forum :P

So obviously I say, giver!!! Use PHP....it's the best language ever, outside of C++ of course...I still love that language more than anything :P

p.s-As for suggested frameworks...to many to list...every dog and his owner have implemented some form of framework...there is no defacto standard...I guess that give you flexibility, but also makes choosing the right one difficult...

Get more specific with what your requirements are and someone I"m sure can give you a decent answer.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

phpMVC for you Java Beans?

:roll:
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: High performance, large scale dev? Is PHP the right lang

Post by Roja »

cbucher wrote:I've implemented several high performing, multi terabyte systems using .Net and Java but question PHPs performance. Any thoughts on scalability, responsiveness, etc. would be much appreciated.
It powers portions of Yahoo, Flickr, and other top 20 websites worldwide.

PHP scales well, handles load well, and is easy to develop in.
cbucher wrote: If PHP is suggested, are there any core frameworks that we should use as the foundation on which to build? Thanks in advance.
Whichever framework you find the most comfortable for your programming style - if any at all. The best code is code you understand, and can improve upon.
cbucher
Forum Newbie
Posts: 3
Joined: Wed Mar 22, 2006 10:15 pm

You got me thinking now

Post by cbucher »

Thanks for the posts. You both have me reconsidering the use of PHP now for this project. In general, we will be doing large searches on a Db (yet to be determined but after reading an article about MySQL and the difficulties, I might be forced to use Oracle.... but that's a different thread) of over a Tb. Usage of the system is expected to manage over 200k+ users - thus the scalability, high response question.

I ran across the following presentation given by someone at Flickr: http://www.niallkennedy.com/blog/uploads/flickr_php.pdf. After reviewing it, I'm wondering if they could do it all again, would they have chosen a different language than PHP? As a total Newbie with PHP, it seems that it doesn't do alot of things well but is used for quick development (agree or disagree?).

Since I have the floor, I might as well open up the MySQL debate if anybody knows about its strengths/weaknesses when it comes to multi Tb search platforms....

Thanks again guys...
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

As a total Newbie with PHP, it seems that it doesn't do alot of things well but is used for quick development (agree or disagree?).
Couldn't agree less...

It's not about quick development per se - it's about developing for the web. You can use Perl, but let's face it, that's overkill. You could use Ruby, which is very nice OOP wise, and is also a nice general purpose language (its not web centric no matter how many Java advocates state otherwise). You could use lots of languages above those - including that one beginning with J...;)

PHP however is easy to develop with. It supports a subset of OOP functionality, enough that reuse/composition/etc. are all readily available. It supports most databases through native drivers or the recent PDO offering. It's loosely typed. Yada yada yada - any PHP site will already have a long list of reasons why PHP works and makes sense on the web over other languages.

The problem is that it is web centric - it's utility for anything else is very limited. So it all depends on what you're aiming for. You can use PHP to power one part of your overall offering, and have something else in the background if you feel like it handling other heavy load duties. Perhaps that J language...

As for performance - as far as I am aware PHP remains quite competitive. There are still some things not included by default with PHP which should be required - notably an opcode cache.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

cbucher wrote:As a total Newbie with PHP, it seems that it doesn't do alot of things well but is used for quick development (agree or disagree?).
It can do a lot of things quite well, but they are generally beyond the typical newbie's area in any language (most often.) You're coming to PHP in a slightly awkward transitional period as they have PHP 4, and 5 on main release (with very little adaption to 5) and PHP 6 is quickly coming down the pipe. Probably far faster than many expect. 6 is cleaning up a lot of issues that keep dragging PHP down a bit. Many are hoping that it will get adopted by the community quickly (although I know there will be hold-outs, but those people seem likely to still be running PHP 3 or early 4's).. anyways on to MySQL.

MySQL is a good database overall. In earlier versions, it lacked several things that many competing database systems have had for some time. But after 4.1, a lot of that went away. With 5.1 and 5.2 in the pipe with some nice improvements, it could get even better. Now, that said. PostgreSQL is another to look at.

Postgre has had most, if not all the features of MySQL 5+ for a while. Arguably, in some areas, it has more power than MySQL. I feel again that the database system you use isn't as important as the server(s) it will run on. With such large data pools, a separate server from the web server is a minimum. I'd likely have multiple clusters in datacenters across the continent if I were building this. Something like one in Atlanta, one in Chicago, and one in San Francisco or LA (even Seattle maybe). Might even be good to have a few on the west coast, if you don't want to have one overseas. I don't recall if PostgreSQL supports replication across clusters, but I know MySQL 5.1 is supposed to support it (it's in beta right now -- I don't have loaded, but it is in the feature list).

Oracle isn't bad either, but the "good" version of their server will cost you (from what I remember.)

In the end, I would recommend loading up all the free versions of a bunch of the database systems: DB2, Oracle, PostgreSQL, MySQL, etc. The only one I would recommend staying away from is the Microsoft (and related) ones. This isn't a "I hate Microsoft" thing -- often far from it -- I just haven't seen the best performance (among other things) from it... not to mention locking you into a server platform that just isn't optimal. Play with each of the databases for a while. Try some things, (the more advanced these things are, the better) and see which feels right. Talk to the developers if possible. They should have a good perspective as to how far the database can go. Especially with the open source ones, the community is usually quite active and helpful.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: You got me thinking now

Post by Roja »

cbucher wrote:In general, we will be doing large searches on a Db (yet to be determined but after reading an article about MySQL and the difficulties, I might be forced to use Oracle.... but that's a different thread) of over a Tb. Usage of the system is expected to manage over 200k+ users - thus the scalability, high response question.
Once again, realworld examples trump FUD and hand-waving theory. Slashdot, with millions of users a day, is powered by MySQL. Searches, updates, inserts, its a full-fledged news and discussion site, and again, it scales just fine.
cbucher wrote:After reviewing it, I'm wondering if they could do it all again, would they have chosen a different language than PHP?
You are continuing to express doubt about PHP, despite a multitude of evidence being presented that refute your logic for doubting it. Ask the opposite - they have the resources of Yahoo behind them, and surely could afford to do it all again - yet they haven't. Why?

Take a look at Yahoo's "Making a case for PHP at Yahoo", which does a very fair, very balanced breakdown of different languages they looked at, and many of the reasons they chose PHP: http://public.yahoo.com/~radwin/talks/y ... on2002.htm
cbucher wrote:As a total Newbie with PHP, it seems that it doesn't do alot of things well but is used for quick development (agree or disagree?).
My response would be to reframe the question. If you ask "Does PHP as a general purpose language do everything well?", the answer will be no. Because it is not a general purpose language. It is an abstracted language, so it will never be the ideal choice for FPS games, or realtime instrument monitoring.

If you ask "Does PHP as a web language do everything well?", the answer (I hope) is more clear. Yes, it does everything that a web-focused language should do, very well. It scales from homepages to Yahoo, it can handle simple procedural hacks, and complex OOP patterns.

Its a nearly ideal web language, and its getting better every day. PHP6 will revolutionize the web language world, because it will remove almost every major (legitimate) complaint about it.
cbucher wrote:Since I have the floor, I might as well open up the MySQL debate if anybody knows about its strengths/weaknesses when it comes to multi Tb search platforms....
Many portions of Yahoo also run on MySQL. Read more on optimizing MySQL for large scale apps:

http://jeremy.zawodny.com/mysql/
http://jeremy.zawodny.com/mysql/mysql-optimization.html (This one in particular is really helpful)

The author is rather well-known in the MySQL community. In fact, he literally wrote the book on high performance MySQL. ;)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

One other relatively major point ..

200k+ users is a meaningless metric. That just means there'll be 200k+ records in your database. The important factor is how many will be expected to use your website at once .. the number of concurrent users. If you're expecting all 200k to hit the site at once you're in for a major headache .. if it's more likely that the 200k will hit the site once each across the period of a week then you'll have no problems whatever you pick.
cbucher
Forum Newbie
Posts: 3
Joined: Wed Mar 22, 2006 10:15 pm

Great points

Post by cbucher »

Guys, this is an excellent thread. Many thanks... Can I divert the discussion to "frameworks"? In the days that I managed a Java team, we implemented a MVC framework that worked quite well. That said, from a performance standpoint (yes, I do realize it depends on what processing is taking place), how does PHP fare when developed in such a context (model/view/controller)? In addition, I read the following article and would like thoughts: http://www.phpit.net/article/ten-differ ... rameworks/ . To put some context around why I would consider a framework, I anticipate that the platform I need to have developed will be constantly evolving and I'm looking for a flexible, modular way of development (both templating and business logic). What have you used and why?

-C
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Re: High performance, large scale dev? Is PHP the language

Post by AKA Panama Jack »

cbucher wrote:I'm about to start development for a high performance, large scale (200k+ users) system. I'm torn between using PHP or Java/.Net for the development.
Well, you might want to ask Google since they are apparently heavily using php as well as MySql in a cluster environment. Looks like they can handle more than 200k users. :)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: High performance, large scale dev? Is PHP the language

Post by onion2k »

AKA Panama Jack wrote:
cbucher wrote:I'm about to start development for a high performance, large scale (200k+ users) system. I'm torn between using PHP or Java/.Net for the development.
Well, you might want to ask Google since they are apparently heavily using php as well as MySql in a cluster environment. Looks like they can handle more than 200k users. :)
Google are using PHP? Got a link about that?

I know AdSense started out running on MySQL..
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Great points

Post by Christopher »

cbucher wrote:n the days that I managed a Java team, we implemented a MVC framework that worked quite well. That said, from a performance standpoint (yes, I do realize it depends on what processing is taking place), how does PHP fare when developed in such a context (model/view/controller)?
I have said elsewhere that I think framework selection is more personal preference than technical. The more talented people on core team and the more active the community around it -- the better the framework.

As far as MVC goes, conceptually MVC in Java and PHP are very similar. But that's as far as it goes. If you are going to implement your own then get a talented PHP programmer who understands controller architectures and is a true believer in PHP's share-nothing architecture. Conversely, the worst thing you could do is port your Java framework.
(#10850)
Post Reply