Stories
Slash Boxes
Comments
typodupeerror delete not in

Comments: 113 +-   Facebook Releases Open Source Web Server on Friday September 11, @04:08AM

Posted by timothy on Friday September 11, @04:08AM
from the what-is-this-facebook-you-speak-of dept.
programming
internet
news
Dan Jones writes "Ah the irony. The week Facebook is being asked to cough up source code to satisfy an alleged patent infringement, the company releases an open source Web server. The Web server framework that Facebook will offer as open source is called Tornado, was written in the Python language and is designed for quickly processing thousands of simultaneous connections. Tornado is a core piece of infrastructure that powers FriendFeed's real-time functionality, which Facebook maintains. While Tornado is similar to existing Web-frameworks in Python, it focuses on speed and handling large amounts of simultaneous traffic."
story

Related Stories

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.
  • I thought.. (Score:3, Interesting)

    by rainhill (86347) <2rainyhill&gmail,com> on Friday September 11, @04:15AM (#29387249)

    Facebook was built with PHP?.

    • by megrims (839585) on Friday September 11, @04:21AM (#29387289)

      One language per application is old hat.

    • Re:I thought.. (Score:4, Informative)

      by WarJolt (990309) on Friday September 11, @04:42AM (#29387397)

      You can have a webserver using python serve up requests that are handled in PHP. The webserver is only the connection piece of the puzzle.

    • Re:I thought.. (Score:5, Informative)

      by whyloginwhysubscribe (993688) on Friday September 11, @05:31AM (#29387577)
      Python, Erlang, PHP and more: http://es-la.facebook.com/Engineering?v=info&viewas=0&ref=share [facebook.com]
      • Also, I hear they have some sort of advanced programmable turtle [bfoit.org] carrying requests between servers.

        • My dad and I built one of those when I was a kid. Except it was about 1/10th that size. And it wasn't controlled using Logo [wikipedia.org]. God I hate that language.

          I'm sure it was great back in the 60's or 70's (and probably would have been cooler with the physical turtle), but there are much better languages for teaching students how to program today. Unless you're dealing with elementary school students, C, C++, Java, Python, Perl, PHP, or even VB or JavaScript would be a better way of introducing students to computer

    • This is from Friend Feed

    • At least one version of it was. I had the source code of the Facebook index.php file from when it leaked a while ago. Let's just say that it wasn't pretty.

      • Granted, I don't use facebook much these days (stopped using it after they introduced facebook apps), but I've never experienced any technical problems with the site. In contrast, Myspace is a steaming pile of crap that never works 100%. If it's not being unresponsive, it's throwing error messages or losing private messages. The fact that every single profile uses CSS hacks for customization just makes it worse. There were also a number of worms that infected (exploiting the hacked-together CSS skinning sys

          • Re:Shitty argument (Score:4, Insightful)

            by Unoti (731964) on Friday September 11, @11:17AM (#29390361) Journal
            True, you can. But Facebook is at the forefront, the bleeding edge. They're doing stuff that nobody else is doing yet. So it'd be more like complaining about a surgeon killing a patient during a procedure that no one has ever tried before, like a heart transplant in 1973. And they do successfully serve most of their customers. I'm no facebook fanboy, I'm just saying they are pushing the limits, and also doing what they can to advance the technology.
  • Irony. (Score:2, Funny)

    by Anonymous Coward

    I don't think it means what you think it means [youtube.com].

  • They are not the same thing (as the article makes clear).

    This sounds interesting and will definitely take a look - but I doubt I'll be ditching Pylons any time soon.

    • Tornado is both (Score:5, Interesting)

      by Anonymous Coward on Friday September 11, @04:46AM (#29387415)

      Tornado includes both a Web server and a Web framework. The framework can take advantage of the (non-blocking) server architecture to achieve high performance. Apparently you can also run it under mod_wsgi, but I can't really see an advantage of using it in that scenario when compared to other Python frameworks.

        • But the parallel processes in web servers typically don't share much data, so there's little advantage to using threads over processes, and python handles multiple processes just fine. That seems to be how they're using this framework [tornadoweb.org]:

          We run multiple instances of the Tornado web server on multiple frontend machines. We typically run one Tornado frontend per core on the machine (sometimes more depending on utilization).

  • by DaveDerrick (1070132) on Friday September 11, @04:42AM (#29387395)
    "Thats not IRONY chumps & chumpettes, its just coincidental".
  • by TrueKonrads (580974) on Friday September 11, @04:50AM (#29387429)
    I wonder if the Tornado authors set forth to re-implemented <a href="http://twistedmatrix.com/trac/">Twisted Python</a> just for kicks or out of not knowning about its existence.

    Twisted supports epoll kqueue, win32 iocp, select, etc.
    • by wisty (1335733) on Friday September 11, @05:18AM (#29387531)

      Twisted is hard to learn. It's the sort of thing that programmers will re-implement just to avoid reading the documentation.

      Or maybe they wanted to have control. Whatever the case, they would have know. Everybody (who uses python for web work) would know a bit about Twisted ... it's on the front page of python.org

      • Re: (Score:3, Insightful)

        As we say in #python, "Programming is hard!"

        Learning Twisted is so much easier than rolling your own networking mini-library. Sure, a lot of people are kicking and screaming in the beginning, but once they actually sit down and start coding, they usually say something like, "Oh, hey, this is nice."

        There's a reason it's popular.

    • Twisted is a networking library, this seems to be a webserver (which Twisted can do) as well as a framework
      • by harshaw (3140)

        The twisted folks have been working on web frameworks for years (nevow/athena comes to mind). One problem with twisted is that the core devs don't focus much on marketing (ala RoR) so not many people know about it. These guys had a good comet implementation before the phrase was coined.

    • by costas (38724) on Friday September 11, @08:54AM (#29388739) Homepage

      They explicitly states that they looked at Twisted and chose to write something more user-friendly. Having looked at Twisted (3-4 years ago though) and at Tornado's samples and benchmarks I think they succeeded. Twisted seems to be going the way of Zope: an interesting platform that did everything its own way and shut itself out from the rest of the Python universe, eventually losing relevancy.

      I think a Tornado/Django mashup (Tornado infrastructure, Django front-end/application bootstrapping) would be realllly interesting....

    • by ShecoDu (447850) on Friday September 11, @09:34AM (#29389127) Homepage

      Bret Taylor [appspot.com] says:

      When we started, we did use Twisted. In practice, I found Twisted tedious. The deferred abstraction works, but I didn't love it in practice. Likewise, the HTTP/web support in Twisted is very chaotic (see http://twistedmatrix.com/trac/wiki/WebDevelopment [twistedmatrix.com] ... - even they acknowledge this). In general, it seems like Twisted is full of demo-quality stuff, but most of the protocols have tons of bugs.
      Given all those factors, it didn't seem to provide a lot of value. Our core I/O loop is actually pretty small and simple, and I think resulted in fewer bugs than would have come up if we had used Twisted.

  • That's not ironic! (Score:4, Insightful)

    by bs7rphb (924322) on Friday September 11, @05:19AM (#29387539) Homepage

    It's just coincidental!

    • by Anonymous Coward on Friday September 11, @06:08AM (#29387737)

      Mod parent up. To be ironic it would have to be like rain on your wedding day.

    • by 0100010001010011 (652467) on Friday September 11, @07:18AM (#29388051)

      Irony deals with opposites; it has nothing to do with coincidence. If two baseball players from the same hometown, on different teams, receive the same uniform number, it is not ironic. It is a coincidence. If Barry Bonds attains lifetime statistics identical to his fatherâ(TM)s it will not be ironic. It will be a coincidence. Irony is "a state of affairs that is the reverse of what was to be expected; a result opposite to and in mockery of the appropriate result." For instance:

      * If a diabetic, on his way to buy insulin, is killed by a runaway truck, he is the victim of an accident. If the truck was delivering sugar, he is the victim of an oddly poetic coincidence. But if the truck was delivering insulin, ah! Then he is the victim of an irony.

      * If a Kurd, after surviving bloody battle with Saddam Husseinâ(TM)s army and a long, difficult escape through the mountains, is crushed and killed by a parachute drop of humanitarian aid, that, my friend, is irony writ large.

      * Darryl Stingley, the pro football player, was paralyzed after a brutal hit by Jack Tatum. Now Darryl Stingleyâ(TM)s son plays football, and if the son should become paralyzed while playing, it will not be ironic. It will be coincidental. If Darryl Stingleyâ(TM)s son paralyzes someone else, that will be closer to ironic. If he paralyzes Jack Tatumâ(TM)s son that will be precisely ironic.
      -
      The late and great, George Carlin.

      • by Samah (729132)
        Excuse me, this is Slashdot. You forgot the car analogy...

        * A man cruising down a freeway notices a police car behind him, and they signal him to pull over. He changes lanes and slams on his brakes so that the cops will pass him, and he is rear-ended by a large truck, killing him instantly. The cops were signalling him to tell him his brake lights weren't working. That's irony. ;)
      • by toofast (20646) on Friday September 11, @10:07AM (#29389519) Homepage

        ThankÃ(TM)s, now IÃ(TM)ll go learn the usageÃ(TM)s of the Ã(TM)apostropheÃ(TM) correctly.

      • Irony often involves intent, and your first two examples are not ironic.
        • If the diabetic were also a safety expert in how to cross streets safely when in an emergency, then that diabetic's death would be ironic.
        • If the Kurd were also an advocate of drops by humanitarian agencies, then that Kurd's death would be ironic
        • Your last example is so confused that it can't be made into irony. Now that's ironic.
    • (sung) The use of words to express something other than their literal intention. Now that - is - irony

  • Sooo... (Score:3, Interesting)

    by Anonymous Coward on Friday September 11, @05:42AM (#29387621)

    If this webserver is supposed to be fast, than just how fast is it? Is it faster than lighttpd? YAWS? I'd like to know.

  • by Anonymous Coward on Friday September 11, @05:44AM (#29387629)

    Most Python web servers use threading or multiple processes to handle concurrent requests and are not implemented as event driven systems. Most Python web applications are not designed to be implemented on event driven systems but rely on the ability to block during handling of web requests, something which the former allows but which doesn't work well with event driven systems as it blocks the main event loop and prevents anything else happening. So, it is not similar to other Python web servers or frameworks.

    It should be further highlighted that WSGI for Python is effectively designed for that blocking model and it isn't really a good idea to be using it with a server based on event driven systems model and which uses multiple processes as well. Attempting to do so can have undesirable effects such as described in 'http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html'. Some seem to hope that WSGI 2.0 will support asynchronous systems but reality is that it almost definitely will not, so they should stop dreaming.

    So, although these sorts of high performance servers are interesting, their applicability to most existing Python web applications is limited because in practice the web application has to be designed around the event driven system model and you can't really use standardised Python WSGI interface and components that build on that.

    This doesn't mean that these type of servers aren't useful, they just aren't going to solve everyones problems and will principally remain a niche solution for things that need to main many long lived connections.

    As to the benchmarks they give, it is very much just a pissing competition and nothing more. The bulk of web sites would never even handle enough hits to trouble the limits of the other hosting solutions they compare to. For larger sites, they are never going to use a single machine anyway, but use a cluster of machines to spread load and for redundancy. Yes, it may provide more head room for individual machines, but again we aren't talking about a situation which the majority would even have to deal with.

    • by makomk (752139)

      Most Python web servers use threading or multiple processes to handle concurrent requests and are not implemented as event driven systems. Most Python web applications are not designed to be implemented on event driven systems but rely on the ability to block during handling of web requests, something which the former allows but which doesn't work well with event driven systems as it blocks the main event loop and prevents anything else happening.

      Never heard of Twisted Python? It's one of the older and better-known event driven frameworks for web programming - and, as the name suggests, it's written in Python.

    • by BitZtream (692029) on Friday September 11, @06:11AM (#29387753)

      I don't know, Java, C++ and python all run at fine speeds if you write proper code for the language. C++ is probably the fastest in most cases, but Java is going to be a real close second written properly and on the right VM. While I don't like python myself, theres a reason it gets used in games, it can perform well enough to be used extensively if you can deal with compile time, which wouldn't really matter for long running process like a web server.

      Perl isn't HORRIBLE, again, startup time is its biggest problem. PHP has issues, but when zend, precompiling and caching again, it works better than most expect.

      I know nothing at all of Erlang so I won't speak to it.

      MySQL is known for being fast as hell under the right workload, just gotta use it the right way.

      Mix in some memcached and you can server a lot of hits.
      Considering the number of extremely high traffic websites that use a mix of software about like this one, I think you'd have to be pretty stupid to put the blame on the software thats used.

      Do you run a server farm that gets more traffic than Wikipedia, Yahoo or MySpace? I'll talk some shit about languages and say that everything should be written in C at the highest, by proper programmers so we don't end up with OSes that need gigs of ram to boot ... but ...

      While possible, even I'm not arrogant enough to call them stupid.

      I don't find anything about Wikipedia's setup 'impressive', but its certainly done properly. Their mix of php, python and mysql is all used exactly as is should be and serves a massive amount of people on a relatively low amount of processing power.

      But again ... stupid? No, they are hardly stupid.

      • Actually Python is pretty slow [debian.org], about 50 times slower than C++, but that's usually ok since you can put the bottleneck into a C++ module. However, if all the server software is in Python, things will be significantly slower.

        Perl is actually horrible: it is the slowest language in the survey I linked, except for Ruby, plus we all know what the code looks like.

        As for Erlang, it fares relatively well (though still 15 times slower than C++), but its main competitor would probably be Haskell, which also is faste

        • by MostAwesomeDude (980382) on Friday September 11, @08:00AM (#29388295) Homepage

          Actually, for tight loops, CPython (the main implementation) is a whopping 200x slower than C.

          Reasons why tight loop speed doesn't matter:
          - This isn't the kernel. Tight loops don't occur much. If you're polling or spinlocking, stop it and go read up on select, or switch up to a high-performance async library like Twisted. If you're doing number-crunching, use things like comprehensions or multiprocessing.Pool.map to accelerate your math. (Or use both; the former gets a speed boost in implementation, while the latter is concurrent across multiple processors.)
          - Programs are usually not CPU-bound. Profilers tell all, really. Games are usually GPU-bound, unless they're written without a separate sound thread, in which case they get I/O-bound. Webservers are usually I/O-bound, and spend most of their time in select/epoll/etc. waiting for connections.
          - Implementations can and will get fast, eventually. Unladen Swallow is one thing being talked about, but PyPy is also worth mentioning. The former is a bunch of CPython improvments, the latter is a JIT Python interpreter that matches C code for tight loop speed.

          I know this is not a popular idea with a lot of people, particularly those working in places where "OMG speed is critical," but Python's execution speed just doesn't matter compared to its readability and time/LOCs required to get up off the ground and running.

          ~ C.

          • by pzs (857406)

            I use CPython for performance dependent stuff and have found the loops themselves, even not doing anything, are surprisingly slow. Do you have a reference for your "200x slower than C" claim? I'd be interested to see if it tallied with my experiences.

        • Re: (Score:3, Interesting)

          by dkf (304284)

          Actually Python is pretty slow, about 50 times slower than C++, but that's usually ok since you can put the bottleneck into a C++ module.

          It's not quite as simple as that, since you also have to consider all the other factors involved (like amount of effort to stabilize the production solution, flexibility of the solution, etc.) Speed is only one - important - aspect.

          And if you're in an I/O bound process, it matters not at all; you're going to be waiting for devices to do their stuff anyway...

      • MySQL is known for being fast as hell under the right workload, just gotta use it the right way.

        Sure its fast, when you don't turn on data validation.

      • I don't know, Java, C++ and python all run at fine speeds if you write proper code for the language. C++ is probably the fastest in most cases, but Java is going to be faster written properly and on the right VM.

        Fixed that for you.

    • It's a web app framework. Please click through the links.

      • Re: (Score:3, Interesting)

        by lwsimon (724555)

        It is both - a non-blocking webserver and a framework designed to take advantage of that. Please click through the links (Is that British for RTFA?)

      • Not really. It just means the onus is on the other framework to prove them wrong. Think of it as throwing down the gauntlet.
It doesn't much signify whom one marries, for one is sure to find out next morning it was someone else. -- Will Rogers