https://www.quora.com/What-are-some-advantages-of-using-Node-js-over-a-Flask-API

Flask is a Python web microframework. It needs to be run behind a WSGI compliant web server. The nature of WSGI is synchronous. So you'll usually spawn threads to serve requests. Python 'threads' is also blocking, due to the GIL, they cannot run in parallel. Thus reducing the number of requests you're able to be served. Spawning threads is also expensive.

NodeJS is not a framework, it's a JavaScript binding of libuv. I have a write up about it over here:

Under The Bonnet 1 - NodeJS - YKode

NodeJS is asynchronous by design. Which means that it's not blocking.  When you you do I/O it will return immediately and get notification later on. It's single threaded. It just means that you won't block the event loop when you wait for response, you can do another task including accepting incoming requests.  So even on single thread, you can accept and serve multiple requests. On synchronous environment, this I/O operation will block the thread.

The event driven and concurrent connections model of Node.js makes it one of the best platforms for real time applications like online games, collaboration tools, chat rooms, or anything where what one user (or robot? or sensor?) does with the application needs to be seen by other users immediately, without a page refresh.

As this answer on Stack Overflow says,

My feeling is that Node.js is especially suited for applications where you'd like to maintain a persistent connection from the browser back to the server. Using a technique known as "long-polling", you can write an application that sends updates to the user in real time. Doing long polling on many of the web's giants, like Ruby on Rails or Django, would create immense load on the server, because each active client eats up one server process. This situation amounts to a tarpit attack. When you use something like Node.js, the server has no need of maintaining separate threads for each open connection.

Although, there exist libraries in Python as well for doing this sort of work, Node.js does it really well (powered by cutting edge V8 JavaScript engine). However, if you are performing some heavy server side computation on receiving requests, then you are better off serving it with regular FLASK based server. (subjective comment)

最新文章

  1. 【WPF】整个自定义按钮后台添加
  2. 【2016-10-20】【坚持学习】【Day10】【反射2】
  3. swift学习笔记之-协议
  4. TYVJ P1051 选课 Label:多叉转二叉&&树形dp(虐心♥)
  5. 如何删除github里面的文件夹?
  6. RedHat 5 配置CentOS yum 更新源
  7. highcharts 图表库的简单使用
  8. Java直接插入排序
  9. Java基础知识强化之多线程笔记03:进程与线程 和 多线程的意义
  10. Andriod中WebView加载登录界面获取Cookie信息并同步保存,使第二次不用登录也可查看个人信息。
  11. IE下空链接失效原因及解决方法
  12. Qt 学习之路 :Qt 模块简介
  13. Java Keyword -- super
  14. #include <boost/array.hpp>
  15. Python网络01 原始Python服务器
  16. NOIP2017SummerTraining0705
  17. HTML与CSS的一些知识(三)
  18. 将 varchar 值 'ACCE5057EC423F7C' 转换成数据类型 int 时失败
  19. go标准库的学习-hash
  20. IntelliJ IDEA maven springmvc+shiro简单项目

热门文章

  1. LeetCode(101)Symmetric Tree
  2. Uva 11212 编辑书稿(迭代加深搜索)
  3. LeetCoce 413. Arithmetic Slices
  4. winform中ComboBox控件的简单使用
  5. Leetcode 236.二叉树的最近公共祖先
  6. Computer (树形DP)
  7. HDU-1020-Encoding,题意不清,其实很水~~
  8. PTA 03-树2 List Leaves (25分)
  9. POJ 1379 (随机算法)模拟退火
  10. 【分段哈希】H. Paint the Wall