Node.js和Apache 同一环境运行速度
发布于 1个月前 作者 huyueMiss 333 次浏览 来自 问答

同一环境中测试两个服务器的运行速度,用Apache ab运行压力测试, ab -n 1000 -c 100 127.0.0.1:8080/test.php ab -n 1000 -c 100 127.0.0.1:8081/test

apache+php nodejs+express ,使用ejs模板.

都是返回一个空页面。

nodejs效率不是应该比apache高吗?

此图为nodejs截图 untitled1.png

apache截图 untitled2.png

4 回复

express是框架 你要装个yii测才公平

nodejs如果专门做webapi应该用哪个框架

直接用原生的代码写,nodejs做静态资源服务器跟 Nginx、Apache 相比差距都很大。

发扬中国人的传统智慧,来个田忌赛马 out.jpg

nodejs v0.10.34

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end("helllo world\n");
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

php5.5

    public function actionList()
    {
        $data='hello world\n';
        return $data;

    }
回到顶部