delphij's Chaos

选择chaos这个词是因为~~实在很难找到一个更合适的词来形容这儿了……

03 Feb 2015

逗死我了......

对口相声选段:Node.js Is Bad Ass Rock Star Tech。视频

p1: And in conclusion we have found Apache to be an excellent server for our web applications. Any questions?

p2: Yes, I have a question. Why didn’t you use node.js? node.js is an event driven, non-blocking IO server that can be used to build high-performance web applications.

p1: That is an excellent question. We evaluated several alternative web servers and concluded, that while options like node.js are very interesting, Apache meets our needs and has a solid track record.

p2: But it doesn’t have performance. Everybody knows that Apache applications are slow because they use blocking IO and have context switches.

p1: That’s a commonly held belief that threaded web servers are somehow less performant or as scalable than event based servers. In fact, if you measure carefully, you will find that both models have similar performance characteristics.

p2: Threads don’t scale. Simple as that.

p1: That may have been true 10 years ago. Its not true today.

p2: node.js will run circles around Apache because Apache was built before asynchronous was discovered.

p1: This is where I typically stab myself repeatedly in the ears with a fork until I stop hearing you. I’ve looked at node. It uses a single threaded loop that dispatches events to handlers. Its a proven model that solves some concurrency problems but at the cost of code complexity.

p2: It gives techies like me the control to wring every last CPU cycle out of our servers.

p1: It must feel empowering to be totally responsible for the performance of your application. To be always on the lookout for blocking operations that should be split into little pieces each perfectly tailored for concurrent throughput. All the complexities of assembler with all the speed of JavaScript.

p2: I’m a total speed junkie

p1: Do you know what this reminds me of?

p2: The invention of the transistor.

p1: It reminds me of the invention of threads. Threading libraries do exactly what your doing manually. They break up pieces of code to be executed intermittently, switching from instructions that are waiting on IO to instructions that are ready to run, but your sequential code stays intact. You may recall sequential code. Its the code that you can read.

p2: But its slow as a dog

p1: Your asynchronous program is like something from a 19th century Gothic horror story. Drunk with your own sense of power, you reassemble pieces of code that were once coherent, stitching them together with event loops and callback functions, until your monster, grotesque and menacing, is ready to be brought to life in a JavaScript VM. You throw the switch and the hideous creature awakes, rises, and lurches forward. you’re simultaneously elated and terrified that something so unnatural code work at all. When you realize what you’ve unleashed, the pure immorality of it, your creation reaches out with its bloody, mangled arms, and strangles you.

p2: But its fast as hell

p1: If your willing to suffer complex code for performance, why not write an nginx module and see?

p2: node.js is the most bad-ass rock-star tech to come out since Ruby On Rails.

p1: As much as I want to be an optimist and look forward to human progress, people like you make stop me dead in my tracks. Your a fanatic in the church of technology fashion. I could present you with fact after fact after fact of why your thinking of asynchronous programming is completely wrong. But why bother when you equate technology to rock bands, and fancy yourself a software hipster by wearing your node.js t-shirt and celebrate horrible code. Maybe your cool, hell, maybe you have groupies. But when it comes to knowing what the f*ck you’re talking about, you have the facilities of a parrot who says “non-blocking” over and over again.

p2: Non-blocking is the secret in the asynchronous sauce. With it, you go fast. Without it, you go slow.

p1: Do you know when humans discovered that the world was round?

p2: 1492. Columbus sailed the ocean blue.

p1: It was 240 BC by a Greek mathematician named Eratosthenes. He conducted a simple experiment using the length of shadows and the distance between cities to not only prove the earth is round, but to also calculate its circumference.

p2: Sounds low-tech.

p1: It was utterly brilliant. But somehow, for one and a half millenia, it was common knowledge that the earth was flat. Hundreds and hundreds and hundreds of years in daft ignorance. How in mother-f*cking hell does this happen?

p1: It was you. You who makes claims about thread performance without measuring. You who claim hacking your code with a machete, turning it inside out into a twisted, unrecognizable mess will somehow make it go faster. You, who spend your time alternating between problems that are already solved and problems that don’t actually exist. You are the reason science was set back 1,000 years. The reason we have not cured cancer. The reason we have not solved world hunger.

p1: Its because of you, mother f*cker, that we are not all using Lisp.

p2: I’m sorry, what was that last part again?

p1: Never mind.

p2: Did you just say Lisp?

p1: You misheard me.

p2: I could’ve sworn you just said lisp.

p1: If there are no other questions, this concludes my presentation.