Production Flink: Deployment, Operations & Monitoring at Scale
Module Duration: 7-8 hours
Focus: Kubernetes/YARN deployment, HA, state backends, monitoring, troubleshooting
Prerequisites: Flink fundamentals, Kubernetes basics, distributed systems knowledge
Hands-on Labs: Production cluster setup and monitoring
Introduction: From Development to Production
The Production Gap
Development (laptop):- 100+ TaskManagers across multiple nodes
- Terabytes of state in RocksDB
- 24/7 uptime requirements (HA, failover)
- Multi-tenant resource management
- Metrics, logging, alerting for 1000s of jobs
- Zero-downtime upgrades
Part 1: Deployment Architectures
Flink Cluster Components
Deployment Modes
1. Standalone Cluster (Development)
2. YARN Deployment (Hadoop Ecosystem)
Per-Job Mode (recommended):3. Kubernetes Deployment (Cloud Native)
Native Kubernetes Integration:Part 2: High Availability (HA)
Why HA Matters
Without HA:- JobManager dies → All jobs fail
- Manual recovery required
- Downtime = hours
- JobManager dies → Standby takes over in seconds
- Jobs recover from last checkpoint automatically
- Downtime = seconds
HA Configuration (Kubernetes)
HA with ZooKeeper (Alternative)
Testing HA
Part 3: State Backends & Checkpointing
State Backend Selection
Production Checkpointing Configuration
RocksDB Tuning (Production)
Savepoints (Manual Checkpoints)
- Job upgrades (code changes)
- Cluster migrations
- Rescaling parallelism
- Bug fixes with state preservation
Part 4: Monitoring & Observability
Flink Metrics System
Key Metrics to Monitor:Prometheus Integration
Flink Configuration:Grafana Dashboard
Essential Panels:Logging
Log4j Configuration (log4j.properties):
Part 5: Backpressure Detection & Resolution
Understanding Backpressure
Symptoms:- Increasing checkpoint duration
- Growing lag in Kafka consumer
- High
backPressureTimeMsPerSecondmetric
Common Causes & Solutions
Cause 1: Slow Sink
Cause 2: Inefficient Operator
Cause 3: Skewed Keys
Cause 4: Insufficient Resources
Part 6: Resource Management & Tuning
Memory Configuration
Network Tuning
Parallelism & Scaling
Part 7: Troubleshooting Common Issues
Issue 1: Out of Memory (OOM)
Symptoms:- Increase heap size:
taskmanager.memory.task.heap.size: 4096m - Use RocksDB (off-heap state):
state.backend: rocksdb - Enable state TTL to clean old state
- Reduce parallelism (fewer tasks per TaskManager)
Issue 2: Checkpoint Timeouts
Symptoms:Issue 3: Kafka Consumer Lag
Diagnosis:Issue 4: Job Stuck in Restart Loop
Symptoms:Part 8: Production Best Practices
1. Checkpointing Strategy
2. State Backend Selection
3. Monitoring & Alerting
Critical Alerts:4. Security
5. Cost Optimization
Spot Instances (AWS):Part 9: Upgrade Strategies
Blue-Green Deployment
Canary Deployment
Summary
What You’ve Mastered
✅ Deployment architectures (Standalone, YARN, Kubernetes) ✅ High availability with JobManager failover ✅ State backends and checkpointing strategies ✅ Production monitoring with Prometheus/Grafana ✅ Backpressure detection and resolution ✅ Resource tuning and auto-scaling ✅ Troubleshooting common production issues ✅ Security, cost optimization, upgrade strategiesKey Takeaways
- HA is Non-Negotiable: Always enable HA in production
- Monitor Everything: Checkpoints, backpressure, lag, state size
- RocksDB for Large State: Use incremental checkpoints
- Tune Memory Carefully: Heap, managed memory, network buffers
- Test Failover: Kill pods and verify recovery
Next Module
Module 9: Capstone Project - Fraud Detection System
Build a complete production-grade fraud detection system with Kafka, CEP, ML, and monitoring
Resources
Documentation
Tools
Practice: Deploy a Flink cluster to Kubernetes with HA, RocksDB state backend, and Prometheus monitoring. Run a stateful job, kill the JobManager, and verify automatic recovery!