Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Windows 下實作第 7 層軟負載經驗分享(2)

編輯:Win7 系統基礎知識

單元測試

場景設計

取用戶頭像請求:頭像分散多台 DB,由多台 Web Server(webserver1/2)快取並根據 HTTP 請求返回。第 7 層負載根據 userid 雜湊路由到對應快取該 userid 的 Web Server。

請求格式:GET /getportrait.aspx?userid={userid}(userid 為 Int32)
路由演算法:userid % 2 == 0 → webserver1,userid % 2 == 1 → webserver2

回應格式:200 OK,Content-Type: text/txt,本文為伺服器機器名稱(測試方便)。

測試案例

  • 請求 userid=1111 → 預期回應 webserver2
  • 請求 userid=2222 → 預期回應 webserver1

實際測試隨機生成整數 userid,根據能否被 2 整除驗證回應。

效能測試準備

  • 兩台 RealServer:Xeon 1.86G (4核)、8GB RAM、Windows 2003 x86
  • SoftProxy:Xeon 3.0G (16核)、16GB RAM、Windows 2003 x64、千兆網卡
  • 兩台 TestClient
Copyright © Windows教程網 All Rights Reserved