5 ms·
I suspect that Nodejs is taking market share away from Rails and Django. It makes sense though. You can do your entire stack in a single language and the event
by mateo411 12y ago
I suspect that Nodejs is taking market share away from Rails and Django. It makes sense though. You can do your entire stack in a single language and the event loop in Nodejs scales better, than a Django WSGI deployment. I'm not sure how you can deploy a Rails application, but I suspect that it scales similar to a Django WSGI deployment.
- crdoconnor 12y agoDjango scales just fine. It wasn't a problem for instagram, disqus, pinterest, washington post or the onion. The nodejs model for high concurrency high throughput async applications is also pretty easy to write in python using the (much more mature) twisted framework. No weak typing or yucky nested callbacks either.
- mateo411 12y agoThe event model that Nodejs uses is the same as the twisted framework. The twisted framework is more mature, but does not have as many developers and a growing ecosystem like the nodejs. I don't think this is due to any problems with the Twisted framework, it's just that Nodejs has greater mindshare. When I've deployed django applications we used apache and mod wsgi. This works by starting up a bunch of apache processes which load up a python interpreter. Each HTTP request that comes into the application is handled by an apache process which contains a python interpreter. This means that you have to use 100-200 Mb for each python requests. This is the amount of memory it takes to run a python interpreter. The number of mod wsgi processes that you can run at a single time determines the number of HTTP requests that you can handle. For the same amount of memory you could handle more HTTP requests using nodejs or twisted or any other framework that uses the event model.
- mcosta 12y ago> The nodejs model for high concurrency I keep reading this and I don't understand. ¿How can a single thread process be concurrent?
- mateo411 12y agoTwisted, Nodejs and all of these other frameworks use the select system call under the hood. This works well when the process is IO bound. Processes that are responding the HTTP requests or reading or writing to databases tend to be IO bound. The select system call takes a set of file descriptors and returns which file descriptors you can read, because new data is available to read. These frameworks read from these file descriptors and dispatch the new data to a callback method. The event loop only processes one thing at a time, because it is single threaded. However, since reading from the file descriptor and processing the callback is usually fast, this scales very well. Once again, it only scales well for IO bound operations. This uses less memory than having a single thread for each HTTP request, and it definitely uses less memory than having a single process for each HTTP request.
- deleted 12y ago[deleted]
- fbuilesv 12y agoTraditionally in CS, concurrent != parallel. If you have a blocking operation (say a database read) your program can do something else while it waits for a response from the DB (this gives you pseudo-parallelism). That is the concurrency that evented frameworks like Node or EventMachine are usually associated with.