Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming Social Networks The Internet News

Facebook Releases Open Source Web Server 113

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."
This discussion has been archived. No new comments can be posted.

Facebook Releases Open Source Web Server

Comments Filter:
  • I thought.. (Score:3, Interesting)

    by rainhill ( 86347 ) <2rainyhill@NOsPam.gmail.com> on Friday September 11, 2009 @05:15AM (#29387249)

    Facebook was built with PHP?.

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

      One language per application is old hat.

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

      by WarJolt ( 990309 ) on Friday September 11, 2009 @05: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.

    • They probably realized by now it was a disaster ;)
    • Re:I thought.. (Score:5, Informative)

      by whyloginwhysubscribe ( 993688 ) on Friday September 11, 2009 @06: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

    • by dingen ( 958134 )

      ...so the web server should be written in PHP as well? Because Apache is written in C, the web applications it hosts also must be written in C?

    • by Anonymous Coward

      I doubt there has been a week without me having some problem with Facebook functionality. Usually it means I can't access a friend's profile, some photos or such for a duration ranging from half an hour to several hours. (Rather big bug when that is what Facebook is used for) I've often heard that someone I know hasn't been able to login during a whole day. The list goes on and on - similar big problems are rather frequent.

      Lesser bugs (such as me getting some notification multiple times, etc.) occur often s

      • 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

      • Comment removed based on user account deletion
    • 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.

  • 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, 2009 @05: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.

      • Seems like a poor choice, considering you can't use threads in a meaningful way with Python due to GIL.

        I hope they have a bunch of uniprocessors servers on order waiting to run this beast.

        • by Homburg ( 213427 )

          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).

          • I guess this is actually more of a unixey way to go about things, throwing more processes in the mix.

            Thanks for the link!

        • Threads suck ass anyway.

        • You don't need uniprocessor, just run one instance per CPU. You may also have workers processes (ex php workers) and poll them. either way you can achieve full CPU usage without using threads.

          Threads can be an advantage in multi-processor systems but I haven't seen that many applications implementing them properly. Having too many threads running at the same time wastes more time in context switches, OTOH one process per CPU using epoll in a non-blocking event loop is very simple to do and gives you excelle

  • by DaveDerrick ( 1070132 ) on Friday September 11, 2009 @05:42AM (#29387395)
    "Thats not IRONY chumps & chumpettes, its just coincidental".
  • by TrueKonrads ( 580974 ) on Friday September 11, 2009 @05: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, 2009 @06: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, 2009 @09: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, 2009 @10: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.

    • by elnyka ( 803306 )

      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.

      And what makes you think they didn't know? Are you privy of information that objectively and clearly indicates the authors DID NOT have any valid technical or business reason AT ALL to implement Tornado as opposed to adopt Twisted?

      To be honest, I don't know of any evidence, for or against. I have no clue of their reasons (intelligent and/or stupid). As a result I don't assume either. A more constructive and useful question would have been I wonder what were the technical or business reasons (if any) that

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

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

    It's just coincidental!

    • by Anonymous Coward on Friday September 11, 2009 @07: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, 2009 @08: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.

      • ... if Darryl raised his son never to play football because of his own injury, and his son were paralyzed in a motor vehicle accident anyway, that would be dramatic irony.

        • A and B implies C, where C is irony.

          You don't necessarily have to only have A and B for it to be ironic, sometimes its more fun if you only have A or B.

          Like, if A were a bunch of Americans each claiming their own definition of irony, that would be ironic.

          That way, you'd have to use your own definition of irony to guess what B was.

          I love logic.

          • For the record, that last 'guessing' bit is used in some very intelligent comedy, because they assume their audience can put the pieces together and come up with the joke.

            Notably, I'm not an American.

      • 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, 2009 @11:07AM (#29389519)

        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.
      • How about getting sued by a patent troll and releasing the supposedly infringing software as open source so people in countries without software patents can use it freely even if you lose the ability to use it yourself

      • Or this [theonion.com]. The third response is apropos here.

    • (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, 2009 @06: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.

    • Re: (Score:1, Informative)

      by Anonymous Coward

      RTFM. Go to the linked homepage for Tornado in TFA and read the docs. It shows a comparison with Tornado running on nginx against other web frameworks such as Django. It also says in there tests it was approx. 4X faster. However, they admit their tests were not very scientific.

  • by Anonymous Coward on Friday September 11, 2009 @06: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.

A morsel of genuine history is a thing so rare as to be always valuable. -- Thomas Jefferson

Working...