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."
I thought.. (Score:3, Interesting)
Facebook was built with PHP?.
Tornado is both (Score:5, Interesting)
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.
Reinventing the wheel (Score:0, Interesting)
Why not use something like http://www.simpleframework.org/ [simpleframework.org] which is far faster than anything using epoll, and has all the asynchronous capabilities, used in combination with Jython and you have the same capabilities only better performance?
Re:How is this different from / better than Twiste (Score:5, Interesting)
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
Sooo... (Score:3, Interesting)
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:that's pretty stupid (Score:1, Interesting)
this comparison [blogspot.com] Is more fair (IMO) as it shows that the same performance can be got by a well written program in many languages. p.s your own graph shows perl as having the potential to be better than python if its written well.
about 50 times slower than C++
At doing what? once you get to large applications that do more than pure maths/simple tasks, the performance of the language becomes negligible compared to the performance of what you are writing. For something as large and being updated as often as facebook, C++ (or any compiled language is out of the question), and if you've got the hardware to support it your much better of going with a language that results in less code (see my link) and easier maintenance (even I can read python code and know what's going on, and i could before i knew python too!)
Whatever it is built with, it doesn't work (Score:1, Interesting)
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 several times a day.
I understand that having that large userbase must be difficult. It is understandable that some bugs come up every once in a while. Their service works "OK, good enough" most of time as it isn't used for anything crucial or really important so bugs don't matter. However, I would rejoice about this release a lot more if Facebook had the record of providing high quality, bug free service.
Re:Please explain (Score:3, Interesting)
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?)
Re:that's pretty stupid (Score:1, Interesting)
Perl is slower at what? Regexes, text processing?... Heh.
Btw, nobody implements b-trees or other stuff like that in pure perl. They just use the C implementations on CPAN.
And ugly code is all in the eye of the beholder. To me, Java's verbosity is ugly. Python slightly less so. LUA is nice. C and Perl are beautiful.
Re:that's pretty stupid (Score:3, Interesting)
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...