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');
});

這是在圍攻下發生的事情(對不起,篇幅較長,但需要看圖片)。伺服器端的記錄器顯示express沒有收到逾時的請求。在測試環境中,沒有代理什麼的,node直接運行在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

這是一個數據中心問題。透過在不同的資料中心運行伺服器的副本進行診斷。

我什至沒有抱怨,當我弄清楚的時候它已經解決了。花了我3天。謝謝,數位海洋!

相關內容