Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Facebook Releases Open Source Web Server

timothy posted more than 5 years ago | from the what-is-this-facebook-you-speak-of dept.

Programming 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."

cancel ×

113 comments

Sorry! There are no comments related to the filter you selected.

I thought.. (3, Interesting)

rainhill (86347) | more than 5 years ago | (#29387249)

Facebook was built with PHP?.

Re:I thought.. (4, Funny)

megrims (839585) | more than 5 years ago | (#29387289)

One language per application is old hat.

Re:I thought.. (3, Informative)

WarJolt (990309) | more than 5 years ago | (#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.. (1)

kojot350 (1330899) | more than 5 years ago | (#29387479)

They probably realized by now it was a disaster ;)

Re:I thought.. (5, Informative)

whyloginwhysubscribe (993688) | more than 5 years ago | (#29387577)

Python, Erlang, PHP and more: http://es-la.facebook.com/Engineering?v=info&viewas=0&ref=share [facebook.com]

Re:I thought.. (1)

CarpetShark (865376) | more than 5 years ago | (#29389607)

Also, I hear they have some sort of advanced programmable turtle [bfoit.org] carrying requests between servers.

Re:I thought.. (1)

lysergic.acid (845423) | more than 5 years ago | (#29391525)

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 programming. Programming languages are tools. The more things you can do (or create) with that tool, the more fun it will be to explore its uses and, therefore, the more motivated students will be to learn how to use it.

Re:I thought.. (1)

the_womble (580291) | more than 5 years ago | (#29387849)

This is from Friend Feed

Re:I thought.. (1)

dingen (958134) | more than 5 years ago | (#29388033)

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

Re:I thought.. (1)

that this is not und (1026860) | more than 5 years ago | (#29395441)

Actually, PHP is written in C, too...

Whatever it is built with, it doesn't work (1, Interesting)

Anonymous Coward | more than 5 years ago | (#29388289)

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:Whatever it is built with, it doesn't work (0)

Anonymous Coward | more than 5 years ago | (#29389559)

When your Internet app handles 250,000,000+ users better than Facebook does... until then, STFU.

Shitty argument (0)

Anonymous Coward | more than 5 years ago | (#29390053)

If there is a surgeon that kills 9 out of 10 patients, I can still criticize him. Even if I'm not a surgeon at all and couldn't save even 1 out of 10 patients if I had to operate any.

Re:Shitty argument (3, Insightful)

Unoti (731964) | more than 5 years ago | (#29390361)

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.

Re:Whatever it is built with, it doesn't work (1)

blueskies (525815) | more than 5 years ago | (#29393627)

Because up until that moment Facebook has no bugs.

  I think Michael Jordan used to say the same things to his coaches when they would....ahem...try to coach him.

Re:Whatever it is built with, it doesn't work (1)

lysergic.acid (845423) | more than 5 years ago | (#29391799)

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 system) users' profiles and infected half the network, in addition to their privacy features not working for a long period of time.

But I guess you can't expect quality software from a company that basically started out as spyware/malware developers and made money by selling e-mail lists/contact databases to spammers. Which is why it's hilarious that they're now cracking down on people caught "friend-blasting" (Myspace's form of spamming).

Not to mention their copyright infringement policy is a joke. There are about a thousand profiles out there using songs by our artists on their profiles, and even with profiles posing as our artists. So we have to use profile names like myspace.com/realacidbath or myspace.com/officialblah-blah-blah. But when we try to post our own music up on our own profiles, we get a copyright infringement notice and the music gets taken down. Good one Myspace. You're doing a fine job combating copyright infringement.

Re:I thought.. (0)

Anonymous Coward | more than 5 years ago | (#29388555)

is that why the site has been so shitty lately with all it's errors and slow loading?

Re:I thought.. (1)

TheSpoom (715771) | more than 5 years ago | (#29391519)

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. (2, Funny)

Anonymous Coward | more than 5 years ago | (#29387265)

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

Web server vs framework (1)

RichardJenkins (1362463) | more than 5 years ago | (#29387285)

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 (5, Interesting)

Anonymous Coward | more than 5 years ago | (#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.

Re:Tornado is both (1)

binarylarry (1338699) | more than 5 years ago | (#29390851)

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.

Re:Tornado is both (1)

Homburg (213427) | more than 5 years ago | (#29391207)

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

Re:Tornado is both (1)

binarylarry (1338699) | more than 5 years ago | (#29392697)

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

blueskies (525815) | more than 5 years ago | (#29393653)

Threads suck ass anyway.

Re:Tornado is both (1)

dermoth666 (1019892) | more than 5 years ago | (#29394377)

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 excellent scalability.

I posted this news :/ (0)

pharazon (1339705) | more than 5 years ago | (#29387303)

I posted this news first, but it seems somebody else got it on the front page :/ http://slashdot.org/firehose.pl?op=view&id=5864125 [slashdot.org]

Re:I posted this news :/ (5, Funny)

Anonymous Coward | more than 5 years ago | (#29387361)

I posted this news first, but it seems somebody else got it on the front page :/
http://slashdot.org/firehose.pl?op=view&id=5864125 [slashdot.org]

Here, have a cookie...

Re:I posted this news :/ (3, Informative)

simoncpu was here (1601629) | more than 5 years ago | (#29387399)

Relax... There's life outside Slashdot.

Re:I posted this news :/ (1, Funny)

Anonymous Coward | more than 5 years ago | (#29387815)

Relax... There's life outside Slashdot.

Heretic! Burn him!

Re:I posted this news :/ (0, Redundant)

Timex (11710) | more than 5 years ago | (#29388163)

Relax... There's life outside Slashdot.

<gasp!> There IS?!? Who'd have thunk it?

Re:I posted this news :/ (1)

WarJolt (990309) | more than 5 years ago | (#29387431)

Submitted by Dan Jones on Thursday September 10, @03:42PM

Submitted by pharazon on Thursday September 10, @11:51PM

Sorry he beat you. It's just been posted now.

Re:I posted this news :/ (0)

Anonymous Coward | more than 5 years ago | (#29388185)

Lessons Learned: News is secondary to the penmanship* of the summary.

*not sure of the correct term I'm grasping for here, but I'm too lazy to google for it.

Re:I posted this news :/ (0)

Anonymous Coward | more than 5 years ago | (#29388595)

Too much information in the summary, and it looks as if you put facts in there.

You must be new here.

As Bender would say (4, Insightful)

DaveDerrick (1070132) | more than 5 years ago | (#29387395)

"Thats not IRONY chumps & chumpettes, its just coincidental".

Re:As Bender would say (0)

Anonymous Coward | more than 5 years ago | (#29387609)

http://en.wiktionary.org/wiki/ironic
Ironic
      1. Both coincidental and contradictory in a humorous or poignant and extremely improbable way.

Coincidental: Check
Contradictory in a humorous way: Check.

Tick: Ironic.

Re:As Bender would say (2, Funny)

Cheesetrap (1597399) | more than 5 years ago | (#29387731)

Hmm... that's odd, I don't think I could agree... Methinks Bender would say: "Hey baby, wanna help me kill all huma<character limit reached>

Re:As Bender would say (0)

Anonymous Coward | more than 5 years ago | (#29388113)

It also irritates me when people confuse irony and coincidence. However in one of the few cases that someone gets it right, you object? Groan.

Re:As Bender would say (2, Funny)

ari_j (90255) | more than 5 years ago | (#29388199)

This happens a lot. Blame Alanis.

Re:As Bender would say (1)

Minwee (522556) | more than 5 years ago | (#29388629)

How ironic.

Re:As Bender would say (0)

Anonymous Coward | more than 5 years ago | (#29393549)

Do you think?

Re:As Bender would say (1)

onemorechip (816444) | more than 5 years ago | (#29394409)

How ironic.

Ironic, how?

How is this different from / better than Twisted (3, Informative)

TrueKonrads (580974) | more than 5 years ago | (#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.

Re:How is this different from / better than Twiste (5, Interesting)

wisty (1335733) | more than 5 years ago | (#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:How is this different from / better than Twiste (2, Insightful)

MostAwesomeDude (980382) | more than 5 years ago | (#29388335)

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.

Re:How is this different from / better than Twiste (2, Insightful)

sik0fewl (561285) | more than 5 years ago | (#29390139)

I never made it past the kicking and screaming part :-).

Re:How is this different from / better than Twiste (1)

Kentaree (1078787) | more than 5 years ago | (#29387551)

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

Re:How is this different from / better than Twiste (1)

harshaw (3140) | more than 5 years ago | (#29388753)

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.

Re:How is this different from / better than Twiste (3, Insightful)

costas (38724) | more than 5 years ago | (#29388739)

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

Re:How is this different from / better than Twiste (3, Insightful)

ShecoDu (447850) | more than 5 years ago | (#29389127)

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.

Re:How is this different from / better than Twiste (1)

elnyka (803306) | more than 5 years ago | (#29389691)

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 lead Facebook to implement Tornado? Did they find a technical problem with Twisted? Did they have a strategic reason not to use it? Did they already have a lot of functionally-related Python code built in-house, making the creation of Tornado a reasonable step? I would like to know so that I can clearly understand this on its own merits.

I dunno, it's the pragmatic engineer in me talking here.

Reinventing the wheel (0, Interesting)

Anonymous Coward | more than 5 years ago | (#29387467)

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:Reinventing the wheel (1, Insightful)

Anonymous Coward | more than 5 years ago | (#29387541)

That's pretty bold to claim your framework has better performance then another one that's not publicly available.

Re:Reinventing the wheel (1)

sukotto (122876) | more than 5 years ago | (#29388215)

Not really. It just means the onus is on the other framework to prove them wrong. Think of it as throwing down the gauntlet.

Re:Reinventing the wheel (0)

Anonymous Coward | more than 5 years ago | (#29392617)

Nope, the facebook people never claimed theirs was better. This AC did. Thus the onus is on the AC to support his claim with evidence he can not provide.

Great (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#29387497)

Hope facebook get more good service.

How like the iphone app from facebook? I love it!!

Checkt this out www.iphone3g-4free.com

That's not ironic! (4, Insightful)

bs7rphb (924322) | more than 5 years ago | (#29387539)

It's just coincidental!

Re:That's not ironic! (5, Funny)

Anonymous Coward | more than 5 years ago | (#29387737)

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

Re:That's not ironic! (1)

arelas (1336019) | more than 5 years ago | (#29388245)

Or a free ride when you've already paid?

Re:That's not ironic! (1)

robot_love (1089921) | more than 5 years ago | (#29388543)

While that is good advice, I'm just not going to take it.

Re:That's not ironic! (1)

BobMcD (601576) | more than 5 years ago | (#29391851)

Who would've thought? It figures.

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

0100010001010011 (652467) | more than 5 years ago | (#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.

Re:That's not ironic! (0)

MikeBabcock (65886) | more than 5 years ago | (#29388297)

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

Re:That's not ironic! (1)

PiSkyHi (1049584) | more than 5 years ago | (#29388813)

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.

Re:That's not ironic! (0)

Anonymous Coward | more than 5 years ago | (#29390057)

Now THAT is ironic.

Re:That's not ironic! (1)

Samah (729132) | more than 5 years ago | (#29388703)

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

Re:That's not ironic! (4, Funny)

toofast (20646) | more than 5 years ago | (#29389519)

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

Re:That's not ironic! (1)

MisterSquid (231834) | more than 5 years ago | (#29390163)

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.

Re:That's not ironic! (0)

Anonymous Coward | more than 5 years ago | (#29392701)

Often != always

Re:That's not ironic! (0)

Anonymous Coward | more than 5 years ago | (#29391423)

Who is still WRONG. Those scenarios don't fit the description he gave, how can he possibly be more wrong?

Re:That's not ironic! (0)

Anonymous Coward | more than 5 years ago | (#29392519)

Isn't it Pythonic?

Re:That's not ironic! (1)

budgenator (254554) | more than 5 years ago | (#29393241)

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

Re:That's not ironic! (1)

onemorechip (816444) | more than 5 years ago | (#29394445)

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

Re:That's not ironic! (1)

slimjim8094 (941042) | more than 5 years ago | (#29389327)

(sung) The use of words to express something other than their literal intention. Now that - is - irony

Sooo... (3, Interesting)

Anonymous Coward | more than 5 years ago | (#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:Sooo... (0)

Anonymous Coward | more than 5 years ago | (#29388377)

Apparently it's not fast enough. I get a lot of timeouts on Facebook throughout the day, and I check it maybe once every 2-3 hours.

Re:Sooo... (1, Informative)

Anonymous Coward | more than 5 years ago | (#29389165)

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.

Synchronous vs asynchronous etc. (5, Informative)

Anonymous Coward | more than 5 years ago | (#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.

Re:Synchronous vs asynchronous etc. (1)

makomk (752139) | more than 5 years ago | (#29390231)

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.

Re:Synchronous vs asynchronous etc. (0)

Anonymous Coward | more than 5 years ago | (#29396251)

And Twisted uses a thread pool on top of its event driven system to implement WSGI without blocking.

that's pretty stupid (0)

Anonymous Coward | more than 5 years ago | (#29387639)

"The biggest thing that surprised us - or is about to surprise us - is the less-than-anticipated performance gains from new microarchitectures... The performance gains they are touting in the press, we are not seeing in our applications. We are literally in real-time trying to figure out why that is and if there are optimizations that we can do."
-- Jonathan Heiliger, vice president of technical operations at Facebook, 26th June 2009

well maybe if they're weren't using such high level languages for everything then things might run a bit faster...

Re:that's pretty stupid (5, Insightful)

BitZtream (692029) | more than 5 years ago | (#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.

Re:that's pretty stupid (1)

orzetto (545509) | more than 5 years ago | (#29388027)

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

Re:that's pretty stupid (1, Interesting)

Anonymous Coward | more than 5 years ago | (#29388283)

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

Re:that's pretty stupid (5, Informative)

MostAwesomeDude (980382) | more than 5 years ago | (#29388295)

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.

Re:that's pretty stupid (1)

pzs (857406) | more than 5 years ago | (#29388995)

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:that's pretty stupid (0)

Anonymous Coward | more than 5 years ago | (#29394551)

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.

you know if i remember right that's what twitter thought about ruby + rails

Re:that's pretty stupid (1)

ChrisGilliard (913445) | more than 5 years ago | (#29396063)

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.

I have heard this perspective before but found that when you have a team of developers that share this philosophy, you end up with VERY slow software. When you are writing software used by one person maybe you can focus on readability, but if you're dealing thousands or millions of users, forget about it. Readability does not have to come at the cost of efficient code either. There are very few occasions where making code fast makes it very confusing. In fact, I would argue that there is a lot of slow code that is very confusing to me. If people take the time to optimize it, it usually is easier to understand because there are no un-needed execution. In these few cases where very fast code is a little hard to understand, you just need to add a few lines of documentation to explain what you're doing.

Re:that's pretty stupid (0)

Anonymous Coward | more than 5 years ago | (#29388341)

Erlang isn't about speed. It's about concurrency and safety.

Re:that's pretty stupid (0)

Anonymous Coward | more than 5 years ago | (#29388517)

Can't you pre-compile Python? (.pyc files?)

Re:that's pretty stupid (1, Interesting)

Anonymous Coward | more than 5 years ago | (#29389191)

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 (2, Interesting)

dkf (304284) | more than 5 years ago | (#29389539)

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

Re:that's pretty stupid (1)

Fujisawa Sensei (207127) | more than 5 years ago | (#29388673)

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.

Re:that's pretty stupid (1)

teknopurge (199509) | more than 5 years ago | (#29389201)

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.

Please explain (0, Troll)

cbraescu1 (180267) | more than 5 years ago | (#29387863)

I'm not trolling here but I just can't understand what this web server brings new to the table, after having Apache, lighthttpd, ngnix, Xitami or Zeus.

Re:Please explain (1)

ultrabot (200914) | more than 5 years ago | (#29387913)

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

Re:Please explain (2, Interesting)

lwsimon (724555) | more than 5 years ago | (#29389155)

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

WTF does "open source" mean? (0)

Anonymous Coward | more than 5 years ago | (#29389839)

I know most shitty web news sites can't tell one license apart from another but in the real world, it makes a huge difference. I expected higher standands from /.

Apache 2.0 is the answer here by the way.

What is it about Python? (-1, Troll)

Anonymous Coward | more than 5 years ago | (#29390205)

I'm sorry but Python sucks. There are better languages like Lua. Simple, powerful, fast. Python just doesn't compare.

Real Irony (0)

Anonymous Coward | more than 5 years ago | (#29394559)

I find it ironic that Facebook was able to open-source anything with Microsoft as a major sponsor.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?