Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Choice of Language for Large-Scale Web Apps?

Posted by Cliff on Sat Jul 30, 2005 01:14 PM
from the dilemma-of-many-choices dept.
anyon wonders: "PHP is the most popular language for the web. eBay uses ISAPI (C), Google uses C/C++ (search), Java (gmail), and Python. Microsoft uses ASP (what else?). For small web site, it really doesn't matter. What's your take on language choice for large-scale web applications? Maybe language choice is irrelevant, only good people (developers) matter? If you can get the same good quality people, then what language you would chose? Considering the following factors: performance, scalability, extendibility, cost of development (man-month), availability of libraries, cost of libraries, development tools? Has there been a comprehensive comparison done?"
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • Polyglot (Score:3, Insightful)

    by FTL (112112) * <slashdotNO@SPAMneil.fraser.name> on Saturday July 30 2005, @01:16PM (#13202966) Homepage
    What's your take on language choice for large-scale web applications?

    As many as possible. Use PHP for the front end, Perl for input parsing, Euphoria for the graphics, JavaScript on the client-side, Moo for the database and Python for the glue to hold things together.

    Every language has strengths and weaknesses. There is no killer language. A good carpenter has lots of tools and uses the most suitable tool(s) for each task. Likewise a programmer should be skilled in many languages and should pick the most appropriate one for each task. Learn as many programming languages as you can, and when you've done that, learn a few more.

    [The feeling of job security is also rather nice.]

    • Re:Polyglot (Score:5, Insightful)

      by Tablizer (95088) on Saturday July 30 2005, @02:04PM (#13203275) Homepage Journal
      As many as possible. Use PHP for the front end, Perl for input parsing, Euphoria for the graphics, JavaScript on the client-side, Moo for the database and Python for the glue to hold things together. Every language has strengths and weaknesses.

      Noooooo!

      It will just produce a job ad that says:

      Required: 3+ years experience in PHP, Perl, JavaScript, Euphoria, Moo, and Python.

      Then when they can't find any individual to fit the bill (surprise!), they will lobby Congress for more visa workers so that they can hunt the entire globe for the "best and brightest".

      (Hmmmmm. What the hell is "Moo"?)
             
      • Re:Polyglot (Score:4, Informative)

        by FooAtWFU (699187) on Saturday July 30 2005, @03:08PM (#13203647) Homepage
        Last I checked, a MOO was a MUD, Object Oriented. Most MOOs are probably based off the LambdaMOO server, which was initially developed at PARC; the original LambdaMOO is available via your favorite telnet or MOO client at lambda.moo.mud.org port 8888.

        However, I would find such a system to be extremely unsuitable as a general-purpose database.

    • Re:Polyglot (Score:5, Insightful)

      by Lord Ender (156273) on Saturday July 30 2005, @03:50PM (#13203872) Homepage
      If I were your boss, I would hire an intern and have him rewrite your apps from scratch with a single, maintainable language. Once he is done, I would hire him for half of what I pay you, then give you the boot. Job security through incompetence?
  • Perl. (Score:5, Funny)

    by Anonymous Coward on Saturday July 30 2005, @01:16PM (#13202968)
    For everything.
    • Seconded! (Score:3, Informative)

      It does it all, and it values the most expensive component of software (for all but the biggest Web apps): programmer time.
      • Re:Seconded! (Score:4, Insightful)

        by cahiha (873942) on Saturday July 30 2005, @06:26PM (#13204609)
        It does it all, and it values the most expensive component of software (for all but the biggest Web apps): programmer time.

        Programmers also have to debug and maintain that software, and that makes Perl one of the most wasteful languages in terms of programmer time.
    • by LibertineR (591918) on Saturday July 30 2005, @03:32PM (#13203785)
      And people wonder why geeks dont get laid.

      It is Saturday, and instead of being out in the sunshine, taking in rays, talking to women, GOING OUTSIDE, here we are, in front of our screens debating about which language to build our web apps with? Can we suck enough?

      Dont bother replying, because when this damn compile is done, I am going outside if it kills me. I wont be here to read any replies, dammit.

      • by Jeremi (14640) on Saturday July 30 2005, @05:14PM (#13204278) Homepage
        and instead of being out in the sunshine, taking in rays, talking to women, GOING OUTSIDE, here we are, in front of our screens debating about which language to build our web apps with?


        The problem with talking to women is that so few of them have anything interesting to say about whether or not C++ is better than Perl... ;^)

  • Who do you have? (Score:3, Interesting)

    by rob_squared (821479) <.moc.liamg. .ta. .derauqs.bor.> on Saturday July 30 2005, @01:18PM (#13202984)
    Smarter people than myself have said it, if the people you have know a certain language, use that, don't force them to use something else even if it is conceived to be better. Now if you're going out and specifically hiring people for this project, things get a whole lot more touchy-feeley and you'll be forced to do much research. But then again, you're probably expecting to do a lot of that anyway.
  • WebObjects (Score:5, Interesting)

    by lightningrod220 (705243) on Saturday July 30 2005, @01:18PM (#13202987)
    Apple uses WebObjects for its online store and the iTunes store. Consider that those go under a lot of stress. Those seem to be the biggest examples of its use, so I don't know what kind of performance it does in other situations. But for an all-around package, it seems to be pretty good.
  • Java Java Java! (Score:4, Informative)

    by FortKnox (169099) * on Saturday July 30 2005, @01:18PM (#13202988) Homepage Journal
    No question about it!

    performance, scalability, extendibility, cost of development (man-month), availability of libraries, cost of libraries, development tools

    Performance? Assembly will give you the best performance followed by C and C++. All three of do not have that great of support for web apps..
    However, Java is almost exclusively being used for large enterprise websites. Its powerful enough to handle the big jobs, and using the appropriate app server will give you great performance.
    Cost of development is heavy in initial development, but pays for itself in maintenance. Most libraries and APIs are free in java (struts, spring, hibernate, tapestry, etc etc etc...). I'd say they are second to perl in terms of freely available and powerful libraries and APIs.
    Development tools? Just check out the (free!) eclipse platform.

    In my mind there is no question that Java (more specifically J2EE) is the best option for general large scale enterprise applications.
    • Re:Java Java Java! (Score:5, Insightful)

      by Surt (22457) on Saturday July 30 2005, @01:32PM (#13203087) Homepage Journal
      Actually, odds are that hand written assembly will underperform compiled c these days. Hiring or training people that can write better assembler than a modern compiler is very very difficult.

      But for web development, Java is generally the right choice for the backend. Lots of competent people available who will require no learning curve. The support tools available for java on the backend are also clearly the best right now, as you pointed out (hibernate etc.). The tools for working in java are also a step ahead of anything else right now (idea and even its slightly retarded younger brother eclipse are both way ahead of the tools for any other language).

        • Hmmm.... (Score:5, Interesting)

          by einhverfr (238914) <chris.travers@gmail.com> on Saturday July 30 2005, @03:10PM (#13203662) Homepage Journal
          I actually like PHP for large-scale web apps. However, I agree that many PHP programmers do create unmanageable code. This is, however, a programmer issue rather than a language issue.

          I started writing HERMES (a CRM framework/app) in PHP and it is now over 20k lines and when I have time to add enhancements it will grow again. The code is incredibly manageable simply because the complexity of the application meant that I had to divide the code into four main areas (each handled in different sets of files):
          1) Main engine(s)/UI framework
          2) UI generation code/data input screens
          3) UI event handling code
          4) Core object logic.

          This way, if you want to change the user interface, you just change the user interface. System-wide changes get made in one place where screen-specific changes get made somewhere else.

          Everything is relatively well abstracted, so the code is very manageable.

          Now, other languages have very specific problems associated with them:

          1) Scripted languages in general: slow performance

          2) Compiled languages in general: Requires rebuild before changes take effect, so testing and retesting is slowed down.

          3) Java/.Net/Byte-code languages: Worst of #1 and #2 above.

          4) Python: Performs a little better than most scripting languages, but there are times when its reference-based structure can cause bugs to be very difficult to find.

          5) PHP: Many PHP programmers write readible but unmaintainable code.

          6) Perl: Many Perl programmers write maintainable but unreadible code.

          7) LISP: See Perl only even more so.

          8) ASP. ASP is only really useful in large apps when paired with COM objects written in C++ or VB. So you have the problems with a scripted language combined with the problems of compiled languages.

          But again, many of the worst issues are programmer rather than language issues. Then again, depending on your project, you may have to eliminate possibilities because of language capabilities.
          • Re:Hmmm.... (Score:4, Informative)

            by sterno (16320) on Saturday July 30 2005, @05:13PM (#13204274) Homepage
            But again, many of the worst issues are programmer rather than language issues.

            While that's true, each language has semantics that either encourage or discourage their worst behaviors.

            As far as Java in regards to your comments above. Java's scripted aspects are actually compiled into code and turned into byte code before run. So the first time a page runs, it will be slow because of conversion. Once run the first time it will be as fast as the compiled code.

            As far as the issues of compiled code, development evironments for java really make a lot of this process quite easy. If you make changes to your code that don't require changes to method signatures, just the chunk of code you modified can be re-compiled. In NetBeans, what I use, I just click a button, and my code is ready to test in less than second.

          • Re:Hmmm.... (Score:4, Informative)

            by FunkyMonkey (79263) on Saturday July 30 2005, @05:40PM (#13204392)
            20k lines of code? That is miniscule. I've got a mid-sized enterprise system that's got 20k FILES containing millions of lines of code integrating a dozen desparate systems over a network of 50 or so servers. It handles thousands of concurrent users performing transactions - not just viewing content. That's just a mid-sized system. Some large scale systems use clusters of hundreds of servers. Not to bash what you're doing but I think you could use a little perspective on the size of your application.

            I don't care if you've got a freakin army of PHP programmers, you're never going to build a system that can scale like Java.


            1) Scripted languages in general: slow performance

            2) Compiled languages in general: Requires rebuild before changes take effect, so testing and retesting is slowed down.

            3) Java/.Net/Byte-code languages: Worst of #1 and #2 above.


            Don't believe the hype about Java's performance. Today's just-in-time compilers can optimize code as well as hand optimized code and they don't waste resources optimizing paths that don't get executed. There are many benchmarks out there that confirm that Java's performance is comparable to C++ and even better in some areas.

            http://www.javaworld.com/javaworld/jw-02-1998/jw-0 2-jperf_p.html [javaworld.com]
            http://www.tommti-systems.de/go.html?http://www.to mmti-systems.de/main-Dateien/reviews/languages/ben chmarks.html [tommti-systems.de]
            http://java.sys-con.com/read/45250.htm?CFID=29694& CFTOKEN=101A9EF8-9F8D-153A-37A5E0A40D3EE24A [sys-con.com]

            I agree with your point though, there are a huge number of crappy programmers out there. Good programmers write good code in whatever language they are using.

            So, what is good code?

            IMHO, good code performs well and is easy to understand and use.
        • Re:Java Java Java! (Score:5, Insightful)

          by Surt (22457) on Saturday July 30 2005, @03:13PM (#13203675) Homepage Journal
          Actually, if your hand written assembly doesn't look like compiler generated assembly, you're probably missing out on things like multi-functional unit parallel scheduling etc. The number of people who can code in a way that will feed instructions to a modern cpu successfully is very small.

          Writing efficient assembly code today is at least 3 or 4 orders of magnitude harder work than it was in the 60s or 70s, and there are far fewer experts available to hire today than there were back then. There are maybe 3 or 4 major computer game developers still doing hand assembly optimization these days, and those guys would be extremely hard to hire away from their current jobs. Most games are just developed in c, and are bound by the performance on the video card anyway, so that optimization on the CPU just isn't that important any more.
        • by Westley (99238) on Saturday July 30 2005, @03:31PM (#13203777) Homepage
          You say it's "simply not true" but don't actually give any reasons.

          Now, I've never used IDEA for a prolonged period of time - I couldn't get into it, and was happy enough with Eclipse not to worry. (The fact that Eclipse is free helps - it would be difficult to persuade my company to pay for loads of licences for IDEA when Eclipse is perfectly all right and free.)

          I do, however, use Visual Studio .NET 2003 and Eclipse in daily work. Here are just a few reasons I much, much prefer Eclipse to VS.NET:

          1) Refactoring. Yes, there are tools available to help - but it's free and bundled into Eclipse.

          2) Organise imports. Even with VS 2005 having some limited support, it doesn't help nearly as much as it should.

          3) Built-in unit testing tools. Using TDD.NET to fire up NUnit GUI (or any of the other things it can do) is much, much uglier than the built-in support for JUnit in Eclipse.

          4) Ant support in Eclipse. Our Java build script is *so* much nicer than the nastiness VS.NET encourages. I'm looking forward to investigating the VS 2005 integration with MSbuild.

          5) "Hold down ctrl to make anything a hyperlink" - want to go to where a method, variable, class etc is declared? Just hold down ctrl and click. Navigation was never simpler.

          6) Search for all references (etc) - in theory there's "go to definition" in VS.NET 2003, but half the time it doesn't work when you're in a large solution, and I don't believe there's any way of finding all references.

          7) The VSS plugin for Eclipse is actually better in my view than the VS.NET support... much easier to understand the configuration, change it on a per project basis etc.

          8) Launching Tomcat in a debugger with Eclipse (even without any extra plugins) seems a lot more reliable than trying to make sure that IIS has actually caught up with changes. Why do web projects need IIS to be running even to open in VS.NET? It's crazy.

          9) Quick Fix and other source options - get Eclipse to write code for you, fix code for you, extract constants, etc. Fantastic stuff - especially in test-first development, where you can write code which uses the API you *want* to exist, then tell Eclipse to create the shell of that API for you.

          10) Compile on save with a really good incremental compiler. This saves huge amounts of time. Oh, and changes really do happen, unlike in VS.NET where if you change an embedded resource, a normal build sometimes picks up the change but sometimes doesn't. (Not to mention VS.NET locking access to files it's built quite often, meaning you can't rebuild them without restarting VS.NET - particularly in terms of XML documentation.)

          These are not esoteric features which are hardly ever used - although I could list loads of those too, if you want. These are things I use *every day*. My pair programmer and I are *always* saying how much easier our C# work would be if VS.NET supported the features above. Half of them aren't even in VS 2005 beta 2, as far as I can see - or at least aren't as well implemented. Funnily enough, I can't remember the last time we said something similar the other way round...

          So, I've given some of my reasons why I think Eclipse isn't just a step ahead of VS.NET, but leaps and bounds. Now, why do you think VS.NET is better than Eclipse, and do you really not care about the above features?
    • Re:Java Java Java! (Score:5, Insightful)

      by drgonzo59 (747139) on Saturday July 30 2005, @03:08PM (#13203650)
      You are right, performance from the language point of view is won by assembler, but often it is the choice of the algorithm that will make the big difference. A bubble sort in assembler of 1 million items might be slower than a quicksort of the same million items in python.

      Often when someone asks the question "what languages do you know?" or "what languages are the best?" it shows a lack of CS background and experience. The right question is "what programming paradigm would you use?" or "what programming paradigm is better?" (Of course when you come down to a specific problem, then the choice of libraries might determine the language, but the original poster only specified "large web application" as the requirement so talking about a specific language is pointless).

      The difference between the two questions underlies the difference between the two types of education most programmers have. Some have gone to 4 year colleges and got a "Computer Science" degree, while some learned a language in their spare time, or went to technical college. The people from the technical college will know just one language and ask others what langues are the best, what languages they use etc. To them learning a new language hard. What a CS degree teaches (or should teach) is different programming paradigms - procedural, functional, object oriented, along with an algorithms and data structures. So if someone knows how to think in terms of objects when they solve the problem they can program in java, c++, python, ruby and other object oriented languages.

      I used C++ in college, then I learned Java, now I use primarily Python. All I had to do is learn the syntax and some of the common library functions -- all can be done with a good reference book and/or Google in a couple of weeks.

      Or if a problem can be better solved with a functional approach, I would use Prolog or Lisp (you can use Lisp for websites too!).

      So, I think the original question should have specified the problem more exact or ask about what paradigm would be better. Rather than give a general requirement ("large web application") but then then ask for a specific language. This is bound to lead to nothing but arguments of why everyone's favorite language is best and that's about it.

  • by Qui-Gon (62090) * on Saturday July 30 2005, @01:19PM (#13202994) Homepage Journal

    And you said it...

    Maybe language choice is irrelevant, only good people (developers) matter?

  • You're using examples of Ebay, Google and Microsoft's web sites as your "large-scale" web app description. If you truly do want to build something as large-scale as that, then you're going to have a lot of hiring to do. Take a look at your local market - or even better, place ads for architect-level people in each of the languages you're considering. See what kinds of people you get, and that should weigh into your decision.
  • ASP.NET w/C# (Score:3, Insightful)

    by gfody (514448) on Saturday July 30 2005, @01:23PM (#13203013)
    this should've been a survey
  • by Dysenteryduke (903867) on Saturday July 30 2005, @01:24PM (#13203021)
    For large scale applications, java, c/c++, perl, PHP just don't cut it. You should really check out mod_fortran. Everything you love about fortran with none of the hype.
  • I've been getting into Ruby on Rails [rubyonrails.com] recently, and am most excited by how Rails makes it very clear what the "best practices" for organizing and building your application is.

    I have long despaired of learning that same information for PHP (with which I have much more experience). I've not yet found a book or other documentation that provides a concrete approach. And looking at existing large-scale projects, e.g., WordPress and others, reveal a myriad of different philosophies. It leaves developers basically trying different things out on different projects, and picking up their own favorite best practices as they go along.

    While it's great that the languages are so flexible, well, sometimes it's nice to be guided to a known solid approach. It leads to consistency among and across many developers and time. This makes it easier for new developers to join or take over a project, or even for the original developer to do maintenance on components which were written long ago.

    So, where are the recommended approaches for organizing and constructing large-scale applications for PHP (and Python, etc.)?
  • Python (Score:4, Informative)

    by g-to-the-o-to-the-g (705721) on Saturday July 30 2005, @01:27PM (#13203039) Homepage Journal
    Python is the way go to [zope.org]. For anyone who's built custom sites based on Zope, I think they would agree with me. Python is really easy to use for building big apps for use in web stuff, and Zope provides an easy-to-code-for application server.
    • by Some Random Username (873177) on Saturday July 30 2005, @02:01PM (#13203250) Journal
      You can certainly make a large, high traffic site in python. But not with zope. Zope is brutally slow, and the only thing you can do about it is shove a cache infront of it, which does nothing to help speed up user-specific content.

      Just use a decent python web framework with a real webserver, zope is a waste of time.
      • by MikeFM (12491) on Saturday July 30 2005, @02:54PM (#13203558) Homepage Journal
        A solution I like is to write a Python backend that is exposed to the frontend as XML-RPC. Then use the language your designers find easiest to work in for front-end coding.. usually PHP.

        Python is great for the backend because it has good namespace support which helps a lot for big complex programs. PHP on the other hand is well known and extremely easy for doing various web-scripting type tasks. I have a little PHP function that gets called by the PHP server for every page (without needing to be in the code exposed to the PHP coders) that simply passes the page inputs to Python over XML-RPC and puts the response into a global variable. Then the PHP coders jut display the results however needs to be done based on the inputs and outputs.

        Some nice benefits of such a split system is that it's easy to keep UI logic sepperate from application logic and it's easy to split your application up over multiple servers so that it can scale to any load. For example you might have two PHP servers, three Python servers, and a DB server dividing the load. Normal load balancing techniques work just fine for deciding how the machines talk to each other. Pretty nice to be able to just throw another server in where it's needed if you suddenly find a 9/11-type day where your site is getting unexpectedly high loads.

        Of course you can split your processing up in more levels if you need to. I like to abstract out all my queries into their own XML-RPC interface that sits in front of the DB so as to not allow direct access to the DB for security reasons. Anyone trying to hack the DB would have to use my stored queries and work through my XML-RPC interface rather than being able to access the DB directly. If your dealing with sensitive information it's just another layer of protection. If you have to access third-party systems that use some unstandardized method of communicating then it can help to keep your code clean if you create a proxy interface between those systems and your own that speaks XML-RPC. This way the code for speaking to that other system is a completely sepperate code base and your main code base is kept clean.
  • by Kenja (541830) on Saturday July 30 2005, @01:27PM (#13203041)
    Hell, if I have to suffer so should all of you.

    (yes I program with this monstrosity of a system)

  • Depends (Score:4, Insightful)

    by boner (27505) on Saturday July 30 2005, @01:28PM (#13203049)
    What you are asking is a dilemma that has been around since the invention of different programming languages. My personal opinion is that the best investment of your time is designing the web-app itself. Once you understand the feature set you require/desire then it makes sense to start looking at how the feature set requirements map to the available languages from a development and performance point of view.

    Most people tend to forget to take a productivity point of view and let themselves be guided by whatever is available or what's cool. If you follow a productivity approach it will help you make the trade-off decisions between interpreted languages like PHP and compiled languages like C/C++, with ASP and Java somewhere in between.

    There is a balance between development and production, when you go live and your web-app is well-designed it should be easy to add additional hardware to compensate for performance issues (server is about US$ 2000,- , or the equivalent of 10-20 hours of developer time.)

    The single most important piece of advice after recommending that you spend more time on designing the app: don't get married to the language. Be prepared to use PHP to develop quickly and understand what works and what doesn't for your web-app. Once you have solved the usability bugs, investigate how you can drive efficiency by choosing a different language or not.

    There is no template for what is the best environment, only your common sense, and oh... did I mention that you should spend more time designing your app?

  • by Foofoobar (318279) on Saturday July 30 2005, @01:28PM (#13203050)
    I use PHP myself because it focuses on one thing and doesn't get distracted by trying to do more than it's build to do... that being, serve dynamic web pages.

    Sure you can use it to dynamically generate images, PDF's and alot more but these things tend to slow down and detract from what it is meant to do and should be handled by third party apps preferably on a different server that way you separate your processes and keep PHP focused on it's task.

    Plus with the improvements in the ZEND engine and it's object oriented programming, PHP is now comparable and even sometimes faster than Java.

    People will say that it doesn't scale but they base this opinion on a preset prejudice or on the scalability of the underlying architecture. But PHP's engine is actually more compact than the JVM because it has less to focus on and thus can scale along side Apache, the entire way.

    And with tons of larger companies moving to PHP, it has proven it can handle the load.

    My only complaint though is developers who try to do EVERYTHING in PHP. With all the added modules, it does have the potential but do you really want to waste processing power letting PHP handle all these extra tasks? Use PHP for dynamic webpages and any added processing you need to do, I suggest moving to a secondary app preferably built in C/C++ or even Java. That way you get the most bang for your buck.
    • by Space cowboy (13680) * on Saturday July 30 2005, @02:30PM (#13203421) Journal
      People will say that it doesn't scale but they base this opinion on a preset prejudice or on the scalability of the underlying architecture.

      What people mean by 'it doesn't scale' is that it doesn't scale. Not that it doesn't run fast enough or have enough functionality for pretty much anything at the small-to-medium sized website...

      I have a set of 200 or so websites all running though a self-built PHP template-based content-management system (hey, this was 8 years ago, they were rare then! :-) that has stood the test of time admirably. It's only got a few million pages in it's CMS, but it's pretty cool:
      • Typical page-creation is ~0.01 secs for complex pages
      • Copes with (currently) several million users
      • Handles email list management (opt-in only, don't flame me :-)
      • Separates the content from the formatting. Formatting is by recursive template instantiation.
      • Can embed run-at-page-delivery-time PHP modules as CMS elements
      • Has an Ad-server (flash, DHTML or images) which guarantees ad-placement in slots at a pre-paid rate
      • Copes well with binary data (PDFs, images, movies, etc.)
      • Handles image galleries from both user/admin perspective
      • Has sections where extranet companies can "own" part of the sites
      • Complete messageboard system, any number of boards, skinnable.
      • Manages products, shopping basket etc. and integrates with online purchasing providers
      • Provides newsfeeds in a variety of formats (RSS, XML via FTP, etc.)
      • Provides a *fast* fulltext search that uses phrases, booleans, etc.
      • Layers facilities on top of search (eg: site-editor can embed results of a search into an email (s)he composes. Preview, then deliver to opt-in list.)


      And will all those features it's still not scaleable. I can't split the system over multiple webservers and begin a transaction on one webserver, have a hardware failure, and have it complete on a different webserver. ..

      I server about a million page-impressions a day (less at weekends) so I'm hardly "big iron", but at the moment it's all serving from a single machine(*) with a manual backup ready-to-go. We're (probably) about to triple our daily throughput (time to splash some cash :-), so scalability has become more important, and I'm looking into the best way of doing this.

      I can't have the above level of scalability but I can divide up the work over (say) 4 cloned webservers, and use round-robin DNS (low TTL) or transparent-proxy load-balancing to share the load. Then at least if one of the machines goes down (not the proxy ;-), I can have it automatically react and recover.

      We're probably going to have 2 database servers as well - one in slave mode, one in master mode (all writes to the master, because we use MySQL). The single point of failure then becomes the proxy gateway (because RR DNS is a bit of a pain), so we can have a spare standing by - the configuration of a load-balancing proxy is pretty trivial, and doesn't depend on anything else, so it can be sitting ready to run and swapping ethernet patch cables ought to be all that is necessary.

      And that's about as "scalable" as I can make it - not very. All I'm doing is duplicating hardware for speed and reliability. I can have robustness against a machine dying, but that's about as far as I can go. True scalability allows the operation the machine was doing when it died to complete successfully, and PHP ain't there (yet). I guess you could implement it in s/w using lots of state tables, and perhaps get 80% of the way there, but it's an add-on not a built-in, and not a complete solution. Better to go with something that works if you need it...

      Just MHO.

      Simon

      (*) It is a bit of a beast of a machine though :-)
      • by esconsult1 (203878) on Saturday July 30 2005, @06:30PM (#13204636) Homepage Journal
        Wow!

        Then I guess you never heard about using database driven sessions. The way how you've designed that bad boy, it would'nt scale in any language.

        Here's what we do:

        • 8 Apache Webservers
        • 3 Million pageviews per day
        • Distributed PHP sessioning (Postgresql based)
        • PHP module
        • Postgresql (no worries with MySQL write locks)
        Scaling? We add new machines in the mix, tell our load balancer about the new machines, and we've scaled linearly. A machine goes down? The load balancer redirects to another machine and the session continues without a beat.

        Bottleneck? The database, but then you throw big iron at that.

        Look, the web is stateless, if applications are designed from the get-go realizing that fact, heck, you can get a shell script sitting in cgi-bin to scale with your server pool.

        There's absolutely nothing in PHP that inherently causes it not to scale. Sure, other languages have easier and sometines better features built in, but if you're already using PHP, implementing those features are usually worth the few programming hours of effort instead of switching to another language/platform.

    • Java is called a language but in this context it is more of a platform which, frankly, is older, more robust and better thought-out than anything PHP has to offer--at this point. I believe PHP is great for small to medium scale web sites, but once you start to deal with the large structures that enterprise systems require, PHP is just not an option--if you want packages already available to you which are thought-out, mature and stable, like all the various J2EE solutions available.

      PHP very well may be faster for an individual page--but what are you comparing that to? Tomcat set up to use JSP? Well, there's a lot of infrastructure there that a PHP developer is probably not going to use for a simple dynamic page. And the fact is, PHP is incorporating a lot of 'heavier' OO features now whose effective use is debatable when considering web apps tied to the HTTP protocol--why build and tear down your entire OO structure every time you load a page? To do that intelligently you want an application server caching these objects...and then we start talking about Java and all the years it has on PHP there.

      So, I'm really just saying--some things are right for some projects, others for other projects. Choose wisely.

      • Language != module (Score:5, Insightful)

        by Foofoobar (318279) on Saturday July 30 2005, @02:28PM (#13203411)
        You are mixing up the language with the modules. There is a reason why PHP comes without all those additional modules... so you can decide what you want it to do. If you want to add all those modules to PHP and make it do all that, then you have to do it yourself. But the base install does not include them. In fact it no longer includes MySQL support in it and that too must be added as a module.

        As far as your opinions on PHP not scaling, tell that to IBM, Avaya, Hewlett Packard, Disney, Sprint and the others who get millions of hits a day using PHP. Seems to me if sites that get millions of hits a day can handle the bandwidth using PHP, that it JUST MIGHT be able to scale. :)

        And as far as worst security history, you again confuse bad programming with the language it is written in. For this analogy, C# and VB still hold that title. Just because the language allows you to make mistakes in your programming, does not mean it is the languages fault when you create a recursive function that loops perpetually.

        I suggest trying a course in logic; it makes your programming better and your argumentative rhetoric make more sense. :)
      • by gregmac (629064) on Saturday July 30 2005, @02:41PM (#13203490) Homepage
        Lets not forget that PHP has the worst security history of any language, there are constant exploits and there's nothing you as a PHP user can do about it.

        Constant exploits? For PHP, or for crapply-written content management systems (ahem, phpnuke) that happen to be written in PHP?

        CERT has issued two advisories for PHP itself: CA-2002-05 and CA-2002-20. Looking through the changelog [php.net] I see only a handful of security fixes.

        Like most languages, it's possible to write unsecure code. I've seen code that executes stuff on the command line, right from a GET string. It's just as possible to write secure code.

        One problem with PHP is it's a simple language, and a lot of beginners with no experience pick it up and can use it to write applications. Knowing nothing about software development, or security issues, they tend to write bad, insecure code. This has nothing to do with the language, it simply has to do with the developers. If python or ruby came into incredibly widespread use (ie, available on pretty much any hosting account you can buy, like PHP is), then you'd probably see the same thing happening. It doesn't say anything about the languages, it's simply a matter of inexperienced developers writting bad code.
  • by Dominic_Mazzoni (125164) on Saturday July 30 2005, @01:28PM (#13203052) Homepage
    You didn't make it clear who is doing the development.

    If you're doing the development by yourself, then obviously you should weigh the choices and pick the language that will work best for you. Development time, for example, is highly dependent on how well you already know the languages.

    However, if you already have a developer, or a team of developers, to do this development, then whatever you do don't force them to use what you think is the best language. That's a guaranteed way to lower productivity and morale if they think it's a poor choice! Ask them to make recommendations. Maybe even spend a couple of days prototyping various things in different languages first.

    One of the nicest things about back ends is that it doesn't matter what language you use (nobody can tell from the outside) and you can easily mix and match languages. There's nothing wrong with writing the majority of the code in PHP or Python for rapid development, but using Java or C++ extensions for a few of the computationally-intensive algoritihms.
  • by 00_NOP (559413) on Saturday July 30 2005, @01:30PM (#13203074)
    Perl is a great choice. You can do anything with it and nobody else understands what your code does so they have to get you to maintain it :)
  • by BigGerman (541312) on Saturday July 30 2005, @01:45PM (#13203146)
    (for those who actually care to get something out of the door)

    Java:

    front end - Tomcat running JSPs (JSTL or Velocity for templating)

    in the middle - Spring and Spring MVC

    Closer to database - Hibernate.

    Ideally, everything running in same JVM. Add more servers for scalability front-ending them with load balancer with sticky sessions.
    No J2EE fluff, easy to find people, good productivity.

  • by adolfojp (730818) on Saturday July 30 2005, @01:54PM (#13203200) Homepage
    Large standard library
    Excellent MVC model
    Integrated caching capabilities
    You can compile your libraries before uploading
    Excellent Web Services model
    Free tools
    Works on Linux (through mono)
    Large third party support
    Very Fast
    Easier to use and deploy than J2EE :-P
  • saying that E-Bay uses ISAPI / C may be oversimplifying things. I see that some of their url's still include isapi.dll, which does suggest using ISAPI. But they had gone on the public record a few years ago as saying they were migrating to Java / J2EE, specifically IBM WebSphere software.

    http://computerworld.com/softwaretopics/software/a ppdev/story/0,10801,63692,00.html [computerworld.com]

    I would guess that they're actually using a mix of technologies. Any insiders have any insight they can share? Even anonymously?
  • by markv242 (622209) on Saturday July 30 2005, @03:36PM (#13203803)
    The only reason people think they use ISAPI is because that's what they originally used, and an executive decision was made to not break any existing links at any time, ever. Check the Powered by Java [ebaystatic.com] image. The /ws/eBayISAPI.dll that you see in all of the requests just invokes a servlet.
  • by Tablizer (95088) on Saturday July 30 2005, @04:47PM (#13204148) Homepage Journal
    [fill_in_the_blank] is the way go to. See [blank].org for more. For anyone who's built custom sites based on [blank], I think they would agree with me. [blank] is really easy to use for building big apps for use in web stuff, and [blank] provides an easy-to-code-for application framework that saves lots of time and money.

    Best of all, it is [blank]-oriented so that you just snap functionality together like Lego blocks to get an instant app that runs at the speed of light almost right out of the box! And [blank] scales to every user on the entire planet. And it plugs into XML.

    Only a Devry graduate would use anything different. Go with [blank]!
         
    • by jadavis (473492) on Saturday July 30 2005, @01:37PM (#13203107)
      Perl, Python, and Ruby are handy because they have an interface to C. You never find yourself without a module if you can just make a wrapper for C.

      Although I haven't tried it, you can get similar benefit from using Jython. Having two languages like Python and Java at your disposal has got to be a godsend for a large web app. I'm not sure if you still get to use C modules if using Jython.