65 Comments
- mgainor, on 10/12/2007, -2/+6Real engineers know that they can get the same task done well in whichever language supports the task, and language advocacy barely crosses their minds. Mediocre developers waste their time wondering which language "wins."
- burnt1ce85, on 10/12/2007, -1/+4I know this is unreleated but this article reminded me a question.
i never understood why you cant compile activer server side pages like Java servlets. doesnt it make sense to do so? - altjeringa, on 10/12/2007, -2/+5That would be, "Neither." Java as in J2EE, in this world that translates into JSP and Servlets ( in other worlds it translates into much much much more ).
- headzoo, on 10/12/2007, -0/+2There is also a ***** load of JavaScript in every Digg page.
- ericpp, on 10/12/2007, -0/+2I'm wondering which database platform they will be switching to.
I've been very disappointed with MySQL lately. Most of the features I was looking forward to in MySQL 5.0 were implemented in the most inefficient and naive ways possible. - Progranism, on 10/12/2007, -5/+7PHP
Pizza Hungry Programmers - ericpp, on 10/12/2007, -1/+3Each line phonetically spells out the previous line....
- opus20745, on 10/12/2007, -1/+3I don't think anyone is debating the fact that Java is a much more versatile language OVERALL than PHP. That is quite obvious. However, this article dealt with a comparison of PHP to Java when it comes to web apps. Name one web app that absolutely REQUIRES threading and takes days to execute.
- muyuu, on 10/12/2007, -1/+3If you're talking about compiling PHP pages, you can. It's just not free (and Zend bought out the free competition).
Correct me if there's something new to this, haven't been checking lately. - geminitojanus, on 10/12/2007, -1/+3"I know this is unreleated but this article reminded me a question. i never understood why you cant compile activer server side pages like Java servlets. doesnt it make sense to do so?"
Hrm. Well, if I understand you correctly, and I'm barely claiming to, PHP can be "pre-compiled" as well, for quicker execution via several "PHP Optimizer" products on the market. Since PHP is an intepreted language, it's not incredibly difficult to record the interpreted output, and simply use it if nothing significant has changed between the last time the code was executed and this time the code's executed. Even database objects can be abstracted away through this kind of optimization.
Zend makes a PHP optimizer, as well as a few other people. Google's your best friend. - LanEvo, on 10/12/2007, -0/+2Turck MMCache
http://turck-mmcache.sourceforge.net/index_old.html - geminitojanus, on 10/12/2007, -1/+2"Name one web app that absolutely REQUIRES threading and takes days to execute."
Well, you asked...
I was helping a friend of mine write an online game that simulated genetics, including true genetic algorithms for deciding if various creatures lived, and lived long enough to reproduce. As it turns out, the more parallel we made the game, the faster the code ran, and we could get the game cycles down to minutes vs. the hours it would have taken with a serial execution (aka PHP). Luckily, porting code back and forth from Java to PHP is relatively simple.
Anywho, that's just a personal example. I'm sure someone else out there has a better example (any Apple employees around to talk about WebObjects?). - brundlefly76, on 10/12/2007, -0/+1The best DB for a high-volume site is a custom application-specific indexed filesystem, preferably hosted on a powerful enterprise storage RAID array. (such as used in virtually all large-scale search engines like Yahoo!, Google, etc) - See Lucene, etc for prepackaged tools.
BTW, Yahoo! (where I worked and learned the above), is moving from Apache C Modules to PHP.
Why? because you *can* scale PHP with hardware and an easy-to-use platform for dynamic web applications speeds rollout of new products and reduces development costs, which is far cheaper in the long run then hardware.
For large-scale websites, you have to apply RAID technology - instead of building monolithic, expensive, highly-optimized and complex low-level code and $100k RDBMS setups, use less optimized but more RAD-friendly tools and indexed filesystems and throw cheap boxes at it. - bfioca, on 10/12/2007, -0/+1"Still that entry needs details, details details."
You're right. I could go on and on about details, but I didn't want to since this was just a blog post. I wanted to keep this one pretty accessible for the average reader. I'll probably write a much more in-depth article since this got such great feedback. (thanks!) - jmz668, on 10/12/2007, -0/+1There is no web 2.0. Web 2.0 is nothing but a moronic attempt to create even more meaningless buzzwords.
- geminitojanus, on 10/12/2007, -2/+3"Real engineers know that they can get the same task done well in whichever language supports the task, and language advocacy barely crosses their minds. Mediocre developers waste their time wondering which language "wins.""
Real engineers pick the language they know will generate the best solution with the fewest number of lines and fastest overall execution. Sometimes these engineers have very heated and long discussions about this, because they'll find one language consistantly allows them to minimize line-count, or one language is consistantly faster than another. And then they get in arguments on which should take precidence over the other. And soon enough, those real engineers look like babbling grade school kids. - adamsitting, on 10/12/2007, -1/+2Java script is client side. This issue was confusing to me originally also. Java Script is not related to J2EE as far as I know.
- geezusfreeek, on 10/12/2007, -2/+3@adamsitting: javascript is not Java at all.
- Bogtha, on 10/12/2007, -0/+1One of the reasons why Digg is slow is because they've screwed up the caching of static resources. Everything expires after an hour, forcing caches to revalidate their copies unnecessarily.
- altjeringa, on 10/12/2007, -1/+2Interesting, although it's sorely lacking in technical details. Is all well and good to say that the Java stuff was running across 30 servers and the PHP only requires one but there is no description of what was being run across 30 servers or run across 1. I've many Java applications that run on 1 server and crank out hundreds of thousands of transaction a day and a couple that require more.
Contrary to popular sentiment JAVA can still do alot of things that just isn't possible with PHP, for example run tasks which take days and thread. Actually Perl, Python, and Ruby can all do those things, (people write PHP why again?). However for cranking out websites that perform well PHP does a reasonable job. Still that entry needs details, details details. Otherwise like most things in this world it's just Hype. - ibeleaf, on 10/12/2007, -0/+1It does... if you don't use any 3rd party modules. Core PHP supposedly works just fine.
Since there are so many 3rd party modules, there's no guarantee that things will work perfectly. It's still recommended to use the pre-fork module for now. - CaughtThinking, on 10/12/2007, -1/+2i dont know if it's "extremely slow" fits, but more so, "not so snappy". I'd love to have a look at their caching layer and what other ways they're meeting bandwidth needs.
- cozinator, on 10/12/2007, -1/+2It's always seemed relatively fast to me...
- supert0ad, on 10/12/2007, -2/+3java and javascript are in no way related, except for roughly similar syntax, but that is also shared with c, c++, and to some extent php. the article is clearly talking about java, as javascript is used as a complement to both java and php, it cannot replace either
- rayed, on 10/12/2007, -1/+2But Digg is not exactly good showcase for scalability, it is extremely slow.
- headzoo, on 10/12/2007, -0/+1Contrary to popular sentiment PHP can run for days. I've written an IRC bot in PHP for *****-and-giggles, and left it running for over a week. PHP can also take advantage of shared memory instead of running to the database all the time. People that say it can't are misinformed. Also don't forget that you can always write your own C extension if you need something.
Like this article tries to point out, there is a lot people don't understand about PHP. A lot of that comes from using the PHP provided by your $6 a month web hosting account. - ericpp, on 10/12/2007, -0/+1PHP Accelerator: http://www.php-accelerator.co.uk/
APC: http://pecl.php.net/package/APC
eAccelerator: http://eaccelerator.net/ - CaughtThinking, on 10/12/2007, -0/+1It could be the js and image requirements. All the little icons add up to a lot of http connections...
- beforeIforget, on 10/12/2007, -1/+2In the article it mentions Digg had database problems? I'm assuming they use (or used?) MySQL .. did they switch to something else?
- m242, on 10/12/2007, -0/+1Does PHP work with Apache 2.0 in "worker" mpm mode yet?
- supert0ad, on 10/12/2007, -1/+2the front page loads slow sometimes, but on the whole it's pretty fast, considering the number of users, and the speed at which it has grown
- mistermoss, on 10/12/2007, -0/+0I always think it's neat to see how things are implemented, but I think it has less and less to do with what you use, and more to do with what you're trying to achieve, and how you go about doing it.
Regardless of whether you're using [language] on [server platform] and [database], the constant in successful applications is not the technology but the *people* behind the scenes who understand architecture and usability.
Unfortunately, this article comes off as a fluff piece about the author's favorite tools, without providing any insight into his techniques for designing and deploying a reasonably successful application. Congratulations -- you built a web site using proven and common tools for the job. It's cool the site was a success, but I'd like to know why it was actually a success.
No digg. - adamsitting, on 10/12/2007, -2/+2And php is easy to learn. That says something.
- RyeBrye, on 10/12/2007, -0/+0Is there a way to "compile" PHP? I don't mean just "cache" it - but make it run natively, and not interpreted.
In Code Complete, by Steve McConnell he runs some tests and concludes that PHP runs >100 times slower than Java or C++... That seems like a big enough slowdown to make a performance-crazy person want to seek a better solution than an interpreted language. - whizzbang, on 10/12/2007, -1/+1Exactly, one of my lecturers in collage once wrote "if/else, while do, =" and said it is all you need to write any application. I think this still holds true.
- jbellis, on 10/12/2007, -0/+0Several years ago, the lead guy for sourceforge ran some tests and concluded that postgresql beat the hell out of mysql under load. (Article here: http://www.phpbuilder.com/columns/tim20000705.php3)
Obviously, both databases have evolved significantly since July 2000, so I don't know how relevant this remains today. Unfortunately, I haven't seen any more recent benchmarks that are both done by someone with a clue and impartial. (MySQL.com's benchmarks fail on the first count as well as the second; they basically bench the db when only one request is performed at a time, which is worthless.) - angulion, on 10/12/2007, -0/+0To headzoo:
While you are right that PHP can run for extensive times (I wrote a Jabber "client/bot"), this is only true for CLI-PHP. Within Apache web-server context you cannot do this.
Where I used to work we had an web-based "application" written in PHP to send email and SMS-text messages to customers etc.. This app would have benefited from being able to spawn a separate thread and execute the sometimes 3 hour long process there. As was now, it had a CLI-PHP script ran from cron every 5-10 min to process new jobs. - inactive, on 10/12/2007, -1/+1Yeah, digg is a little on the sluggish side. It also helps to adblock all those avatars which I think is a significant factor.
- tzahi, on 10/12/2007, -1/+1Seems ridiculus they didn't try PostgreSQL. Using MySQL in a large site like Digg is very unproffesional. On the other hand, digg has not really a "large scale application" since it does not require transactions and rollbacks etc... and no real tough queries and even a need for ACID or any kind of consistency.
In fact, maybe they don't even need MySQL, maybe some kind of a lite sql implementation would be even better. - altjeringa, on 10/12/2007, -1/+1Oh? Threading if used properly is a great way of increasing performance since of course threads can hold persistant data, for instance storing session data in RAM and without the overhead of going to the database to retrieve it. Most Enterprise level Collaboration Suites (SharePoint and Docushare), Accounting Systems (SAP), and Banking Systems make extensive use of threading and data persistance. Also you may want to look at what Google is backending their systems with.
As for multiday processes. Well I've personally written two, though the length of the processes vary. Sometimes a couple of minutes sometimes hours, a few run for a day or more. They tend to be scientific applications that involve the processing of large data sets, but think of in terms of realtime interaction between people. Say chat, a chat server that has to go to the database everytime an XMLHttpRequest comes in is very very very inefficient. Much better to give multiple threads access to a persistant queue of mesages.
The failure here is to see a website as an application that is more than a sophisticated CRUD. But I guess when all one has in the toolbox is a hammer everything thing looks like a hammer.
JAVA is not the answer to every problem either. No point in pulling out a Jack Hammer when your just hanging a photograph. ;) - lukes, on 10/12/2007, -0/+0That may be the case for real engineers, but a good programmer learns a new programming language every year, so that they can expand their knowledge of programming as a whole, and have a set of tools in their toolbelt that they can draw on individually when solving a problem.
While it's true that you can write in whichever language supports the task, beyond simple proceedural programming I disagree that you shouldn't be selective about which language to use. - pneuman, on 10/12/2007, -0/+0You can get PHP working with worker by skipping mod_php and using the lighttpd approach -- fastcgi. There seemed to be some other advantages to the fastcgi method too, like not having page execution timed inline with browser activity, which can cut down resource usage quite a bit from the sound of it.
Of course some people would probably just say to switch to lighttpd :) I'm not one of them just yet though, because Apache still does things for us that lighttpd just can't do right now. - pneuman, on 10/12/2007, -0/+0I definitely wouldn't doubt that running PHP code is a hundred times or more slower than Java or C++, but no app is ever written entirely in PHP -- you use built-in functions, database modules, and other extensions that are written in C, and for the majority of applications that's probably a hefty chunk of your work, so PHP arguably wouldn't be a lot slower. That becomes less and less the case as you add extra complexity though, such as database layers or template engines written in PHP.
- muyuu, on 10/12/2007, -0/+0Look down in Turk's page : © 2001-2002
Zend bought them out. I reckon they did buy some other of the free competition. Not sure there is any real competition at the moment. - cheesy, on 10/12/2007, -0/+0geminitojanus: I'm not so sure about your "fewest number of lines" comment. In most languages I could write an entire program on a single line, but that's besides the point. The point is that these days in many cases code readability is more important the program size and efficiency. As one of my CS professors said, "programmer time is more expensive than processor time". Of course that doesn't mean you should write crappy inefficient programs, it means don't prematurely optimize where you don't need to.
altjeringa: he did say "whichever language supports the task"... You couldn't write an OS in Java since it's run on a virtual machine. You wouldn't write a 3D engine in Perl since it's interpreted and thus very slow. When you need super fast speed or low level stuff you use something like C or assembly, otherwise you have a pretty wide range of choices these days. - ddunkin, on 10/12/2007, -0/+0fireball74: Threads have been in Java from the beginning. In Java 5 they just made minor changes to the way priorties work. They also introduced some classes to help with concurrency, but that was also available before with free third-party libraries.
- fireball74, on 10/12/2007, -0/+0Oh man, now I've gotta go and write a thread extension for PHP.... :P
Actually, I'm sure it's possible to work around not having threads similar to the way Java devs had to work around it before they got elegant built-in threading with Java 5. Gasp! Yep, Java didn't have built-in threading for a VERY long time, and most devs I've talked to still think it's evil. :P - Merlin8000, on 10/12/2007, -0/+0I like PostgreSQL for the best fit for web2.0 programming. One primary reason:
Server-side languages
You can embed PHP, Python, Perl, and really any procedural language into your select statement by building a function written in that language. If you can do that with any other (free) SQL server I haven't seen how, so it's at least more apparent in PostgreSQL - computerdude33, on 10/12/2007, -0/+0Not true. Web 2.0 is about community; Web 3.0 is about buzzwords.
- Rickard, on 10/12/2007, -1/+1APC is free and will most likely be included in PHP6.
Edit: Gah, those damned reply links are difficult to find. This was meant as a reply to the post by burnt1ce85 below this one. -
Show 51 - 64 of 64 discussions



What is Digg?
Check out the new & improved