# 個人化電子報壓測 ## 流程圖 ### 測試項目 1. 推薦系統並發能力(Request/sec) 2. cw-cms Queue Job的消化能力 3. MemberAPI的電子報訂閱清單需耗時多久取回(待測) ### 每日00:00 a.m.排程執行 ```sequence 數位產品->>MemberApi: 取得訂戶清單 MemberApi->>數位產品: response data 數位產品->>GCS: 上傳定戶清單 ``` ### 每日06:00 a.m.排程執行 ```sequence 數位產品->>GCS: 取回訂戶清單 GCS->>數位產品: Download file from stream. 數位產品->>Queue: 排程處理個人化電子報資料 Queue->>推薦系統: 呼叫個人化電子報api 推薦系統-->>Queue: response data Queue->>Queue: 產生html資料 Queue->>GCS: 上傳html資料 ``` ## 待處理的資料量 **目標:** 天下雜誌每日報 電子報訂閱戶 **總數:** 215,149筆 (統計時間 2021-07-01) ```sql SELECT COUNT(*) FROM EpaperSubscribe es WHERE es.epaper = 'ckcuafvdq7ctm07033qpuoui7' AND es.status = 1 AND es.canceledTime IS NULL; ``` > 以21萬筆為例,若想在一小時內消化完畢,每秒必須完成59筆推薦資料 ## 壓測結果 ### 推薦系統 #### 使用工具 [wrk - a HTTP benchmarking tool](https://github.com/wg/wrk) #### 設定 ```sh wrk -t10 -c50 -d10m --timeout 5s --latency "https://recommend-2.cwg.tw" -s benchmark.lua ``` * `-t, --threads` 使用多少個線程進行壓測 * `-c, --connections` 跟服務器建立並保持的TCP連接數量 * `-d, --duration` 壓測時間 #### 結果 ``` Thread Stats Avg Stdev Max +/- Stdev Latency 840.29ms 935.78ms 5.00s 83.74% Req/Sec 10.34 7.01 50.00 66.23% Latency Distribution 50% 383.71ms 75% 1.25s 90% 2.28s 99% 3.92s 48408 requests in 10.00m, 28.89MB read Socket errors: connect 0, read 0, write 0, timeout 308 Non-2xx or 3xx responses: 35 Requests/sec: 80.65 Transfer/sec: 49.29KB ``` ### CW-CMS #### 使用工具 [ES Log](https://es.cwg.tw/goto/577659078866302cc0dae81bec40ad5a) ``` fields.type :"laravel-log-cw-cms.cwg.tw" AND message :"article html file upload success." ``` #### 設定 `Beanstalk`起12個`Woker`進行消耗 #### 結果 X軸刻度為秒,平均落於40~50之間 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up