MLflow Experiment กับ Remote Work Setup —

MLflow คืออะไร

MLflow เป็น Open-source Platform ที่พัฒนาโดย Databricks สำหรับจัดการ Machine Learning Lifecycle ทั้งหมด ตั้งแต่การทดลอง (Experiment Tracking) การจัดการ Model (Model Registry) ไปจนถึงการ Deploy Model (Model Serving) เป็นเครื่องมือที่ได้รับความนิยมสูงสุดในหมู่ Data Scientists และ ML Engineers เพราะใช้ง่าย รองรับ Framework หลากหลาย และ Integrate กับ Cloud Services ได้ดี
เนื้อหาเกี่ยวข้อง — บทความที่เกี่ยวข้อง: fear and greed index stock
เมื่อทีม ML ทำงานแบบ Remote การมี Central Tracking Server เป็นสิ่งจำเป็นเพราะทุกคนต้องสามารถบันทึก Experiment Results ไปที่เดียวกัน เปรียบเทียบ Model Performance ข้าม Experiments และ Reproduce Results ได้ทุกเมื่อ
เนื้อหาเกี่ยวข้อง — แนะนำให้อ่าน Prometheus Federation GitOps Workflow
สถาปัตยกรรม MLflow Remote Tracking
- MLflow Tracking Server: เก็บ Metadata ของ Experiments (Parameters, Metrics, Tags) ใน Backend Store
- Backend Store: PostgreSQL หรือ MySQL สำหรับเก็บ Experiment Metadata
- Artifact Store: S3, GCS หรือ MinIO สำหรับเก็บ Model Files, Plots, Data Samples
- Reverse Proxy: Nginx + HTTPS สำหรับ Security
- Authentication: Basic Auth, OAuth2 Proxy หรือ VPN

Kubernetes Deployment สำหรับ Production
# kubernetes/mlflow-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mlflow-tracking
namespace: ml-platform
spec:
replicas: 2
selector:
matchLabels:
app: mlflow-tracking
template:
metadata:
labels:
app: mlflow-tracking
spec:
containers:
- name: mlflow
image: ghcr.io/mlflow/mlflow:2.10.0
command:
- mlflow
- server
- --backend-store-uri
- postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@postgres:5432/mlflow
- --default-artifact-root
- s3://mlflow-artifacts/
- --host
- "0.0.0.0"
- --port
- "5000"
- --serve-artifacts
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: mlflow-secrets
key: postgres-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: mlflow-secrets
key: postgres-password
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: mlflow-secrets
key: s3-access-key
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: mlflow-secrets
key: s3-secret-key
- name: MLFLOW_S3_ENDPOINT_URL
value: "https://s3.company.com"
ports:
- containerPort: 5000
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 2000m
memory: 4Gi
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 30
periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: mlflow-tracking
namespace: ml-platform
spec:
selector:
app: mlflow-tracking
ports:
- port: 5000
targetPort: 5000
Best Practices สำหรับ MLflow Remote Setup
- ใช้ PostgreSQL เป็น Backend Store: SQLite ไม่รองรับ Concurrent Access ต้องใช้ PostgreSQL หรือ MySQL สำหรับทีม
- ใช้ Object Storage สำหรับ Artifacts: S3, GCS หรือ MinIO เหมาะกว่า Local Filesystem เพราะ Scale ได้และเข้าถึงจากทุกที่
- ตั้ง Naming Convention: กำหนดรูปแบบชื่อ Experiment, Run Name และ Tags ให้เป็นมาตรฐาน
- Log ทุกอย่าง: Log Parameters, Metrics, Artifacts, Environment Info, Git Commit Hash เพื่อ Reproducibility
- ใช้ Model Registry: จัดการ Model Versions ด้วย Staging/Production Stages แทนการ Copy ไฟล์ด้วยมือ
- Backup เป็นประจำ: Backup PostgreSQL Database และ Artifact Store ทุกวัน
- Monitor Server: ติดตาม Disk Usage, Memory, CPU ของ Tracking Server เพราะ Artifacts อาจใช้พื้นที่มาก
MLflow คืออะไรและใช้ทำอะไร
MLflow เป็น Open-source Platform สำหรับจัดการ Machine Learning Lifecycle ครอบคลุม Experiment Tracking ที่บันทึก Parameters, Metrics และ Artifacts ทุกการทดลอง, Model Registry สำหรับจัดการ Model Versions และ Model Serving สำหรับ Deploy Model เป็น REST API
แนะนำเพิ่มเติม — หนังสือเทรดที่ SiamCafeBook
เนื้อหาเกี่ยวข้อง — ทำความเข้าใจ ขาวสถต — คู่มือฉบับสมบูรณ์ 2026





