我得到一个node.js服务器上的请求。 我已经简化了testing用例,说明它必须是系统设置的问题。 我是一名开发人员,对服务器pipe理的经验很less,所以我一定会错过一些明显的东西。 服务器在Digital Ocean上,在Ubuntu上使用MEAN的标准设置。 我在服务器设置上没有太多变化。 我应该在哪里看?
这里是节点服务器代码(它是运行的真实代码):
var http = require('http'), express = require('express'), path = require('path'); var app = express(); var rcount=0; app.use(function(req, res, next) { console.log('--'+rcount+':'+req.protocol+'://' + req.headers.host + req.originalUrl); rcount++; next(); }); app.use('/js',express.static(path.join(__dirname, 'public/js'), {maxAge: 86400000})); http.createServer(app).listen(9876, function(){ console.log('Express server listening on port 9876'); });
这里是围攻下发生的事情(抱歉,长度,但需要看到图片)。 服务器端的logging器显示表示DID不接收超时的请求。 在testing环境中,没有代理或任何东西,节点直接在9876上运行,如图所示。
MacBook-Air-alex:www alex$ siege -iv http://xxx.xxx.xxx.xxx:9876/js/animatescroll.js ** SIEGE 3.0.7 ** Preparing 15 concurrent users for battle. The server is now under siege... HTTP/1.1 200 0.10 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.10 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.14 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.10 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.10 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.14 secs: 7686 bytes ==> GET /js/animatescroll.js [error] socket: 209698816 connection timed out.: Operation timed out [error] socket: 212381696 connection timed out.: Operation timed out [error] socket: 208089088 connection timed out.: Operation timed out [error] socket: 207015936 connection timed out.: Operation timed out [error] socket: 209162240 connection timed out.: Operation timed out HTTP/1.1 200 0.14 secs: 7686 bytes ==> GET /js/animatescroll.js [error] socket: 208625664 connection timed out.: Operation timed out [error] socket: 205942784 connection timed out.: Operation timed out [error] socket: 206479360 connection timed out.: Operation timed out [error] socket: 205406208 connection timed out.: Operation timed out [error] socket: 211308544 connection timed out.: Operation timed out [error] socket: 210771968 connection timed out.: Operation timed out HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.14 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.15 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.40 secs: 7686 bytes ==> GET /js/animatescroll.js [error] socket: 210235392 connection timed out.: Operation timed out HTTP/1.1 200 0.19 secs: 7686 bytes ==> GET /js/animatescroll.js [error] socket: 204869632 connection timed out.: Operation timed out HTTP/1.1 200 0.11 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.16 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.16 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.17 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.10 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.14 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js [error] socket: 211845120 connection timed out.: Operation timed out HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.12 secs: 7686 bytes ==> GET /js/animatescroll.js HTTP/1.1 200 0.13 secs: 7686 bytes ==> GET /js/animatescroll.js
这是一个数据中心问题。 通过在不同的数据中心运行服务器的副本进行诊断。
我什至没有抱怨,到了我想清楚的时候就已经修好了。 花费我3天。 谢谢,数字海洋!