Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js restapi:nodejs与python_Node.js - Fatal编程技术网

Node.js restapi:nodejs与python

Node.js restapi:nodejs与python,node.js,Node.js,我想用mongodb后端数据库为当前PHP应用程序创建Restful API NodeJS(express)与Python(web.py)相比,哪一种性能更好?所以我找到了一些。它是俄文写的,所以你可能看不懂。但您可以查看代码中的示例 以下是简单的测试结果和解释的简短翻译: 巨蟒、龙卷风 ab -n 10 -c 10 http://127.0.0.1:8888/ Time taken for tests: 20.078 seconds nodeJS ab -n 10 -c 10 http:

我想用mongodb后端数据库为当前PHP应用程序创建Restful API

NodeJS(express)与Python(web.py)相比,哪一种性能更好?

所以我找到了一些。它是俄文写的,所以你可能看不懂。但您可以查看代码中的示例

以下是简单的测试结果和解释的简短翻译:

巨蟒、龙卷风

ab -n 10 -c 10 http://127.0.0.1:8888/
Time taken for tests:   20.078 seconds
nodeJS

ab -n 10 -c 10 http://127.0.0.1:8000/
Time taken for tests:   2.007 seconds
没有关于试验机的描述,但这并不重要

nodejs之所以更快,是因为它使用非阻塞事件循环,而python的time.sleep是阻塞的


你高兴吗?

如果你已经在使用它,为什么不用php编写代码呢?找不到一个现成的解决方案来用php导出Restful API。Express具有异步I/O的优势。对于数据库I/O,它的性能更好。我想你可以使用nodejs,因为它有更基本的优势,比如javascript对象和json,可以轻松地使用敞篷车有时不需要单独解析RESTAPI的结果。这个结果似乎不现实。看看