Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Load Forecasting

Mục tiêu

Dự án nghiên cứu và ứng dụng Time-Series Foundation Models cho bài toán dự báo tải server đa biến từ Zanbil.ir Web Server Access Logs. Mục tiêu thực nghiệm là biến access log thô thành chuỗi thời gian 15 phút, sau đó so sánh baseline truyền thống với mô hình time-series hiện đại để hỗ trợ capacity planning/autoscaling.

Bài toán

  • Dataset: Zanbil.ir Web Server Access Logs, hơn 10 triệu dòng log.
  • Series chính: top 5 dynamic endpoint groups: image, settings, m, site, rapidgrails.
  • Targets: total_requests, total_bytes_mb, error_rate.
  • Granularity: 15 phút.
  • Forecasting setup: multivariate multi-series forecasting.
  • Horizon chính: h=1 và multi-step h=8 tương đương 2 giờ.

Pipeline thực nghiệm

  1. Parse access log, chuẩn hóa timestamp, xử lý lỗi parse/trùng lặp.
  2. Lọc bot và static traffic để tập trung vào tải backend động.
  3. Gom endpoint thành nhóm chức năng, chọn top 5 dynamic groups.
  4. Resample theo 15 phút, phân tích sparsity và ACF lag 96.
  5. Tạo lag/rolling/temporal features và split train/val/test theo thời gian.
  6. Benchmark Naive-1, Naive-96, XGBoost, iTransformer.
  7. Thử nghiệm mở rộng PatchTST để kiểm tra khả năng học chu kỳ ngày bằng temporal patches.
  8. Chạy ablation multi-step h=8, error analysis và TimesFM zero-shot comparison.

Kết quả chính

  • Naive-1 vẫn là baseline rất mạnh cho total_requeststotal_bytes_mb theo MAE tuyệt đối ở horizon ngắn.
  • XGBoost cạnh tranh tốt ở error_rate, đặc biệt trong thiết lập direct multi-output h=8.
  • iTransformer thể hiện lợi thế ổn định degradation khi horizon tăng, nhất là khi có compute tốt hơn trên H100, nhưng chưa thắng tuyệt đối trên mọi target.
  • PatchTST được bổ sung như hướng thử nghiệm mới: kỳ vọng bám seasonality tốt hơn baseline naive nhưng forecast ổn định hơn khi dùng cho autoscaling.
  • TimesFM zero-shot được đánh giá như một nhánh so sánh foundation model không fine-tune.

Chi tiết bảng số được tổng hợp trong slide và các output của notebook. Thư mục reports/ là artifact local nên không bắt buộc đưa lên GitHub.

Cấu trúc thư mục

.
├── notebooks/          # Notebook pipeline, EDA, baseline, TSFM, ablation
├── presentation/       # Slide LaTeX, PDF, bảng và hình cho bảo vệ
├── data/               # Dữ liệu local, được ignore khỏi Git
├── reports/            # Artifact local, được ignore khỏi Git
├── PLAN.md             # Kế hoạch theo phase/tuần
├── PROGRESS.md         # Nhật ký tiến độ và quyết định kỹ thuật
├── GITHUB_UPLOAD_GUIDE.md
└── requirements.txt

Notebook chính

  • notebooks/01_data_pipeline.ipynb: parse và clean log.
  • notebooks/02b_deep_eda.ipynb: Deep EDA, chọn strategy forecasting.
  • notebooks/03_prepare_data_for_baseline.ipynb: feature engineering, split, naive baselines.
  • notebooks/03b_xgboost_baseline.ipynb: XGBoost baseline.
  • notebooks/04_itransformer_implementation.ipynb: iTransformer với NeuralForecast.
  • notebooks/05_multi_step_ablation.ipynb: ablation multi-step h=8.
  • notebooks/05b-univariate-ablation.ipynb: univariate/bivariate ablation.
  • notebooks/05c_timesfm_zeroshot_evaluation.ipynb: TimesFM zero-shot.

Chạy PatchTST

Sau khi sinh data/processed/top5_long_15uid.parquet, chạy:

python src/models/tsfm/train_patchtst.py --profile local_safe

Output chính:

  • reports/06_patchtst_leaderboard.csv
  • reports/06_patchtst_detail.csv
  • reports/06_patchtst_autoscaling_metrics.csv
  • reports/06_patchtst_results.md

Nếu chạy trên GPU mạnh:

python src/models/tsfm/train_patchtst.py --profile h100_boosted --accelerator gpu

Dữ liệu và GitHub

Repo GitHub ưu tiên source notebook và slide. Không commit dữ liệu, model artifact hoặc report sinh ra trong quá trình chạy. Các phần này đã được ignore:

  • data/
  • data.zip
  • reports/
  • models/

Nguồn dữ liệu gốc nên được tải lại từ Kaggle hoặc lưu ngoài GitHub. Xem chi tiết tại GITHUB_UPLOAD_GUIDE.md.

Cài đặt

pip install -r requirements.txt

Một số notebook dùng GPU/CUDA khi chạy iTransformer hoặc TimesFM; nếu không có GPU, thời gian chạy có thể lâu hơn và profile kết quả có thể khác.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages