node.js与ASP.NET Core性能testing的意外结果

我正在用node.js和asp.net-core编写的两个(有点)hello世界项目做一个快速压力testing。 他们都在生产模式下运行,没有logging器连接到他们。 结果是惊人的! 即使在做了一些额外的工作之后,ASP.NET核心的performance也优于node.js应用,而node.js应用只是渲染一个视图。 应用程序1: http://localhost:3000/nodejs node.js 使用 :node.js,express和vash渲染引擎。 这个端点的代码是 router.get('/', function(req, res, next) { var vm = { title: 'Express', time: new Date() } res.render('index', vm); }); 正如你所看到的,除了通过timevariables发送当前date到视图之外,它什么都不做。 应用程序2: http://localhost:5000/aspnet-core asp.net core 使用 :ASP.NET核心,默认模板定位dnxcore50 然而,这个应用程序不只是呈现一个页面上的date。 它生成5段各种随机文本。 理论上这应该比nodejs应用稍微重一点。 这是渲染这个页面的动作方法 [ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)] [Route("aspnet-core")] public IActionResult Index() { var sb = new StringBuilder(1024); […]

如何在Node中导入全局模块? 我得到“错误:无法find模块<模块>”?

我正在尝试在Mac OSX Lion上设置节点。 这一切似乎工作正常,但我似乎无法从我的全局模块文件夹中导入任何模块。 我得到的错误, Error: Cannot find module <module> 如果我运行这个: node -e require.paths ,我得到的响应是: [ '/usr/local/lib/node_modules', '/Users/Me/.node_modules', '/Users/Me/.node_libraries', '/usr/local/Cellar/node/0.4.12/lib/node' ] 这是正确的,我的模块确实安装在/ usr / local / lib / node_modules中。 当我尝试和运行一个脚本,但是,我得到这个: Error: Cannot find module 'socket.io' at Function._resolveFilename (module.js:326:11) at Function._load (module.js:271:25) at require (module.js:355:19) at Object.<anonymous> (/Users/Me/node/server.js:2:10) at Module._compile (module.js:411:26) at Object..js (module.js:417:10) at Module.load […]