65

Assuming a team of developers are equally comfortable with writing Javascript on the server side as they are with Python & Twisted, when is Node.js going to be more appropriate than Twisted (and vice versa)?

pmn
  • 1,520
  • 2
  • 13
  • 15
  • As of 2013 what is the current status of two of these frameworks. Seems more people uses Node.js than Twisted. Correct me if i'm wrong – Nipuna Aug 25 '13 at 14:36
  • Make an informed decision and start. – After you passed a couple of issues you know better what to look for to make a better decision. Maybe change your tool and redo it. – Robert Siemer Nov 10 '13 at 03:29

2 Answers2

77

Twisted is more mature -- it's been around for a long, long time, and has so many bells and whistles as to make your head spin (implementations of the fanciest protocols, integration of the reactor with a large variety of other event loops, and so forth).

Node.js is said to be faster (I have not measured it myself) and might perhaps be simpler to use (if you need none of the extra bells and whistles) exactly because those extras aren't there (kind of like Tornado in the Python world -- again, I have never measured relative performance).

So, I'd absolutely use Twisted if I needed any of its extra features or wanted to feel on a more solid ground by using a more mature package. If these considerations don't apply, but top performance is a key goal of the project, then I'd write a simple benchmark (but still representative of at least one or two key performance-need situations for my actual project) in Twisted, Node.js, and Tornado, and do a lot of careful measurement before I decide which way to go overall. "Extra features" (third party extensions and standard library) for Python vs server-side Javascript are also much more abundant, and that might be a key factor if any such extras are needed for the project.

Finally, if none of these issues matter to a specific application scenario, have the development team vote on relative simplicity of the three candidates (Twisted, Node.js, Tornado) in terms of simplicity and familiarity -- any of them will probably be just fine, might as well pick whatever most of the team is most comfortable with!

Alex Martelli
  • 762,786
  • 156
  • 1,160
  • 1,345
  • Great answer, and +1 for suggesting the OP look at Twisted (which may be simpler for their needs). – mikemaccana Feb 08 '11 at 21:27
  • 3
    An example of node being not quite faster (especially if you use pypy) http://mrjoes.github.com/2011/12/15/sockjs-bench.html There were other more or less credible benchmarks, but I think a lot of potential performance gains vanish if you use PyPy. – fijal Jan 09 '12 at 23:51
  • 7
    As of 2012, Node.js is pretty mature too :P – Salman von Abbas Jun 09 '12 at 20:52
  • 1
    What are these "bells and whistles" that node.js doesn't have? – B T Sep 13 '13 at 01:02
7

As of 2012, Node.js has proved to be a fast, scalable, mature, and widely used platform. Ryan Dahl, creator of Node.js quotes:

These days, Node is being used by a large number of startups and established companies around the world, from Voxer and Uber to Walmart and Microsoft. It’s safe to say that billions of requests are passing through Node every day. As more and more people come to the project, the available third-party modules and extensions grow and increase in quality. Although I was once reserved about recommending it for mission-critical applications, I now heartily recommend Node for even the most demanding server systems.

More formally, the advantages of Node can be classified as:

  • Great community: It can be said that no other platform gained such community appeal in such a short period of time, it has hundreds of contributors and thousands of watchers in GitHub, and is being used by giants like Yahoo! (Manhattan project), e-bay, LinkedIn, Microsoft, and Voxer.

  • NPM: Although having a relatively small core, Node has lots of packages available to extends its functionality to anything you may consider! Its all automated and being developed and extended actively, think of PyPI (pip).

  • Scalability and Speed: Node's architecture and single threaded nature allows high scalability and speed. Specially after 0.8 release, its speed got really faster (benchmarks), which can be confirmed by a lot of large businesses using Node. The V8 core of it is also constantly getting better thanks to the current browser war.

  • JavaScript: The core language of Node (JS) fits better for such server side usages, specially lambda functions, dynamic objects, and easy JSON serialization are JS highlights which really fits well in cases that speed and scalability counts. (Python has all of them but these are really better and more powerful in JS).

  • Deployment: Because of its wide usage, a lot of really good sites provide tools for easy and powerful Node deployment, including: Heroku, Joyent, Cloud9 and a lot more.

Therefore, Node seem more powerful and with a lighter future, so if there isn't any constraint to use it (like existing code, servers, team capability), it is recommended for any new collaborative network project aiming high speed and scalability.

Amir Ali Akbari
  • 4,652
  • 5
  • 29
  • 43
  • 29
    It sounds like you're unaware of the extent of Twisted's maturity. None of the points you've highlighted in favor of Node are actually exclusive of Twisted (except for the "JavaScript" point, which is the most tenuous item on the list)! – Jean-Paul Calderone Jul 28 '12 at 00:14
  • 4
    @Jean-PaulCalderone well a quick look at the tagstats on the right supports his first point: node.js × 11239 twisted × 1021 – UpTheCreek Aug 10 '12 at 15:41
  • 5
    If you think that size is the only metric for measuring community, sure. – Jean-Paul Calderone Aug 10 '12 at 23:12
  • 4
    Size isn't the only metric, but it is probably the most important. – Clint Aug 15 '12 at 04:12
  • 4
    Just because there are more question about it, doesn't mean it is less used or have smaller community. Think documentation. – vonPetrushev Apr 04 '13 at 23:01
  • @vonPetrushev Sure, that was just a sign, not a complete reasoning. Another from [2012 Stack Overflow User Survey Results](http://blog.stackoverflow.com/2013/01/2012-stack-overflow-user-survey-results/): "41.2% of programmers are really exited about using Node.js next year", and javascript was by far the most popular language according to the survey. This doesn't _prove_ a larger community either, but... – Amir Ali Akbari Apr 05 '13 at 01:59
  • 1
    javascript being by far the most popular language is a direct consequence of it being the de-facto language for web client side programming. and again, stack overflow meters don't amount to a popularity of a language or a framework. – vonPetrushev Apr 05 '13 at 16:00
  • 2
    This sounds more like an ads than answering the question, i.e. when the compared framework is more appropriate than the other one. – pram Apr 25 '13 at 00:34
  • Too much hyperbole in this answer IMO. Node.js is not a silver bullet and is not always the best choice for every project. Please consider a more balanced answer providing both pros and cons so the reader can make their own judgements – Roy Feb 11 '14 at 14:49
  • I have been developing using both Node (currently) and Twisted (in the past 3 years) and my preference is for the latter. Apart from the fact that Twisted has been around for more than 2 decades, I feel Python to be a much better choice for server side development given a somewhat higher degree of standardization, rich library ecosystem (I am really suffering without Numpy/Scipy) and the fact that Twisted has multi-threading and multi-processing support. As for the speed, I have no benchmark to refer to, but I'd expect Twisted on PyPy to run much faster than Node. – autholykos May 16 '15 at 19:26