Apache Spark MLlib is the machine learning library built into Apache Spark, providing scalable implementations of classification, regression, clustering, collaborative filtering, and feature engineering algorithms. MLlib pipelines run on the same distributed engine as Spark SQL and Spark Streaming — meaning they share the same failure modes as any Spark cluster, plus the additional complexity of model serving when you expose trained models as REST APIs.
When your Spark cluster loses a master node, MLlib training jobs queue indefinitely. When your model-serving microservice crashes, production predictions fail silently. This tutorial shows you how to set up uptime monitoring for Spark MLlib deployments using Vigilmon — free tier, no credit card.
Why Spark MLlib deployments need external monitoring
Spark MLlib adds monitoring surface area at every layer of the pipeline:
- Cluster master failures — if the Spark master goes down, all submitted jobs hang at
WAITINGstate with no automatic notification to submitters - Driver program crashes — the Spark driver (the process coordinating your MLlib job) can OOM or lose connectivity to executors mid-training, producing a failed job that nobody notices until they check the history server
- Model serving outages — MLlib-trained models are often served via Spark's MLflow integration or a custom Flask/FastAPI wrapper; those serving processes can crash independently of the Spark cluster
- REST history server timeouts — the Spark History Server can become unresponsive under large workloads, blocking your ability to diagnose past job failures
External monitoring from Vigilmon gives you real-time visibility across all these layers.
What you'll need
- A running Apache Spark cluster (standalone, YARN, or Kubernetes mode)
- A model serving endpoint exposing MLlib predictions (we'll use port 5000 in examples)
- A free Vigilmon account (sign up takes 30 seconds)
Step 1: Expose health endpoints for your Spark stack
Spark exposes several built-in HTTP endpoints. Verify these are accessible:
# Spark master web UI (also indicates master health)
curl http://spark-master.example.com:8080/
# Spark REST API — list all applications
curl http://spark-master.example.com:6066/v1/submissions/status
# Spark History Server
curl http://spark-history.example.com:18080/api/v1/applications
For MLlib model serving, add a health route to your serving application:
# Flask-based MLlib model server
from flask import Flask, jsonify, request
from pyspark.ml import PipelineModel
import time
app = Flask(__name__)
model = PipelineModel.load("/models/your-mllib-model")
@app.get("/health")
def health():
return jsonify({"status": "ok", "timestamp": time.time()}), 200
@app.post("/predict")
def predict():
data = request.get_json()
# inference logic
result = model_infer(data)
return jsonify({"prediction": result})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
For Docker deployments of your model server:
services:
mllib-server:
image: your-org/mllib-server:latest
ports:
- "5000:5000"
environment:
MODEL_PATH: /models/your-mllib-model
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
Step 2: Set up HTTP monitoring for your model server
- Log in to vigilmon.online and go to Monitors → New Monitor
- Choose HTTP / HTTPS as the type
- URL:
https://mllib.example.com/health - Set check interval to 1 minute
- Under Expected response, configure:
- Status code:
200 - Response body contains:
"status":"ok"
- Status code:
- Save the monitor
Vigilmon probes this endpoint from multiple regions every minute. A timeout or non-200 response triggers an incident immediately.
Step 3: Monitor the Spark master web UI
The Spark master web UI doubling as a health indicator is a practical free signal:
- Go to Monitors → New Monitor
- Choose HTTP / HTTPS
- URL:
http://spark-master.example.com:8080/ - Expected status:
200 - Response body contains:
Spark Master - Save the monitor
This check fires if the Spark master process dies or becomes unresponsive — giving you early warning before job submissions start failing.
Step 4: Add TCP port monitoring for Spark internals
Spark's internal communication ports are the earliest indicator of cluster health problems. Add TCP monitors for the critical ones:
For the Spark master submission port:
- Go to Monitors → New Monitor
- Choose TCP Port
- Host:
spark-master.example.com, Port:7077 - Save the monitor
For the Spark History Server:
- Repeat for host
spark-history.example.com, port18080
If your MLlib pipeline reads from HDFS or an object store, add TCP checks for those too:
| Service | Default port | |---------|-------------| | HDFS NameNode | 8020 | | HDFS DataNode | 50010 | | S3 / MinIO | 9000 |
Step 5: Monitor the MLflow tracking server (if applicable)
If you use MLflow for experiment tracking alongside Spark MLlib, its tracking server is another failure point:
- Go to Monitors → New Monitor
- Choose HTTP / HTTPS
- URL:
https://mlflow.example.com/health - Expected status:
200 - Save the monitor
Losing the MLflow tracking server won't stop jobs from running, but it will cause training metrics to fail to log — which makes post-failure debugging much harder.
Step 6: Configure webhook alerts
Spark cluster failures often cascade quickly — a lost master means all in-flight jobs fail simultaneously. Get alerted the moment Vigilmon detects a problem.
- Go to Alert Channels → Add Channel → Webhook
- Enter your Slack, PagerDuty, or OpsGenie webhook URL
- Assign the channel to all your Spark MLlib monitors
Example alert payload from Vigilmon:
{
"monitor_name": "Spark Master Web UI",
"status": "down",
"url": "http://spark-master.example.com:8080/",
"started_at": "2026-05-20T03:14:00Z",
"duration_seconds": 300
}
For the model-serving endpoints, configure a separate alert channel for your application team separate from the infrastructure alert channel — they need different response runbooks.
Step 7: Create a status page for your ML infrastructure
If internal teams submit MLlib training jobs or consume prediction APIs, give them a status page:
- Go to Status Pages → New Status Page
- Name it (e.g. "Spark ML Platform Status")
- Add all your monitors — model server HTTP, Spark master, TCP checks, MLflow
- Publish the page
Share the URL in your internal developer portal so teams can check status before escalating.
Monitor coverage summary
| Monitor | Type | What it catches |
|---------|------|-----------------|
| https://mllib.example.com/health | HTTP | Model server crash, failed model load |
| http://spark-master.example.com:8080/ | HTTP | Spark master process failure |
| https://mlflow.example.com/health | HTTP | MLflow tracking server outage |
| spark-master.example.com:7077 | TCP | Spark submission port loss |
| spark-history.example.com:18080 | TCP | History server unreachable |
What's next
- Heartbeat monitors — wrap your scheduled MLlib training jobs to ping a Vigilmon heartbeat URL on successful completion; if it stops arriving, you know the job failed silently
- SSL certificate monitoring — Vigilmon tracks TLS expiry across all your HTTPS endpoints, including model-serving APIs
Get started free at vigilmon.online — no credit card, monitors start running in under a minute.