Differences between node.js and Tornado

Besides the fact that node.js is written in JS and Tornado in Python, what are some differences between them? Both of them are non-blocking asynchronous web servers, right? Why choose one over the other than the language?

+75
javascript python comparison tornado
Apr 6 2018-11-11T00:
source share
5 answers

The main advantage of node.js is that all of its libraries are asynchronous , so you don’t have to worry much about locking. There are asynchronous libraries for mysql, postgres, redis, etc. All by default async.

Python has a library for anything - but most of these libraries are not asynchronous. To use a tornado (rather than blocking a process), special libraries are needed (for example, you cannot just “pip install redis” and use it, you will need something like brukva ), and there are much fewer tornadoes libraries than node.js libraries . There are currently no tornado mysql asynchronous drivers available, for example (or at least I don't know about that).

But you can still use many python libraries with tornadoes (those that don't do i / o), and the tornado community raises and fills in the blanks.

It's easier to write an application using node.js than using a tornado in my experience. I personally switched to tornado from node.js because it fits better with the existing infrastructure of my python project (the integration between the django website serving html pages and the tornado server providing real-time functions was pretty painless).

+93
Apr 6 2018-11-11T00:
source share

As Rich Bradshaw notes, Node.js is written in JS, which means you can keep the front and back ends in the same language and possibly share some code base. For me, this is a huge potential advantage of Node.js. Node also comes with more asynchronous libraries out of the box.

V8 should make JS faster than Python , at least something that seems to be showing some kind of tests , but that might not really matter, because both Node.js and Tornado (and most other web frameworks) use wrappers for their own libraries. Most of the Python standard library is written in C or can be replaced with a faster alternative that further mitigates potential differences.

Web services are usually associated with I / O, so we spend time storing data and processing data. This makes the synthetic speed difference between JS and Python irrelevant in many applications.

+12
Sep 18 '12 at 7:30
source share

node.js uses V8, which compiles into assembly code; a tornado does not yet.

In addition (which does not really matter much for speed), this is an ecosystem. Do you prefer the JS event model or the way Python works? Are you happier using Python or JS libraries?

+10
Apr 6 2018-11-11T00:
source share

I would suggest you go with NodeJS if there is no personal prefix for python. I like Python a lot, but for async I choose Tornado over node, and later had to fight to find a way to do something, or libraries that support asynchronous programming (for example, Cassandra has asynchronous tests, but I can't find a way to use cqlengine anywhere with async. I had to choose Mongo, because I already exceeded the deadline). In terms of performance and asynchrony, Node is much better than a tornado.

+3
Apr 05 '15 at 8:04
source share

Nodejs also has seamless Socket.io website integration / implementation. It handles browsers that support socket events, and also has backward polling compatibility for older browsers. This is pretty fast for development requiring a notification structure or some similar event-based programming.

+2
Feb 07 2018-12-12T00:
source share



All Articles