Ubuntu
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
這是一個數據中心問題。通過在不同的數據中心執行伺服器副本進行診斷。
我什至沒有抱怨,當我發現它時它已經修復了。花了我3天。謝謝,數字海洋!