Ubuntu / node.js 丢弃传入请求

Ubuntu / node.js 丢弃传入请求

我在 node.js 服务器上收到丢弃的请求。我已将测试用例简化到一定程度,认为这一定是系统设置的问题。我是一名开发人员,对服务器管理经验很少,所以我肯定忽略了一些显而易见的东西。服务器位于 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');
});

以下是 siege 下发生的情况(抱歉很长,但需要看图片)。服务器端的记录器显示 express 没有收到超时的请求。在测试环境中,没有代理或任何东西,节点直接在 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

答案1

这是数据中心的问题。通过在另一个数据中心运行服务器副本来诊断。

我甚至没来得及抱怨,等我弄明白的时候,问题已经解决了。花了我三天时间。谢谢 Digital Ocean!

相关内容