OpenDroneMap city-scale processing on auto-scaling container based workflow (split-merge) #640
Replies: 4 comments
|
Was looking into Talos vs EKS: hotosm/k8s-infra#1 Decided on keeping EKS, but making components inside the cluster as cloud-agnostic / migratable as possible. That said, I think it makes much more sense to have a Kubernetes control plane federation where each cluster operates independently. The best approach I can think of is using a tool like karmada for multi-cluster orchestration. |
flowchart LR
%% Drone Tasking Manager submits jobs
DTM[Drone Tasking Manager] -->|submit job| LB[Global Load Balancer / DNS]
%% Cluster A
subgraph ClusterA[Kubernetes Cluster A]
COA1[ClusterODM API Instance 1]
COA2[ClusterODM API Instance 2]
RedisA[Redis Queue A]
KEDA1[KEDA Scaler]
NodeODM1[NodeODM Deployment]
NodeODM1 -->|reads/writes| S3
KEDA1 --> NodeODM1
COA1 -->|enqueue| RedisA
COA2 -->|enqueue| RedisA
RedisA --> NodeODM1
end
%% Cluster B
subgraph ClusterB[Kubernetes Cluster B]
COB1[ClusterODM API Instance 1]
RedisB[Redis Queue B]
KEDA2[KEDA Scaler]
NodeODM2[NodeODM Deployment]
NodeODM2 -->|reads/writes| S3
KEDA2 --> NodeODM2
COB1 -->|enqueue| RedisB
RedisB --> NodeODM2
end
%% Overspill logic
RedisA -. overload? .-> RedisB
RedisB -. overload? .-> RedisA
%% Job submission
LB --> COA1
LB --> COA2
LB --> COB1
%% External resources
S3[(Shared S3/MinIO)]
%% Notes / Observability
Logs[(Central logging & metrics)]
NodeODM1 --> Logs
NodeODM2 --> Logs
|
Kubernetes-Native ODM AutoscalingA simple, reliable approach to multi-cluster autoscaling using PostgreSQL as a job queue. OverviewThis architecture enables automatic scaling of NodeODM workers across multiple Kubernetes clusters using:
ArchitectureDatabase Schema-- Job queue table
CREATE TABLE job_queue (
id BIGSERIAL PRIMARY KEY,
cluster_id TEXT NOT NULL, -- 'local', 'global', or specific cluster
job_type TEXT NOT NULL, -- 'split', 'merge', 'odm'
payload JSONB NOT NULL,
status TEXT DEFAULT 'pending', -- pending, processing, completed, failed
priority INTEGER DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW(),
claimed_at TIMESTAMPTZ,
claimed_by TEXT,
completed_at TIMESTAMPTZ
);
-- Cluster capacity tracking
CREATE TABLE cluster_capacity (
cluster_id TEXT PRIMARY KEY,
max_concurrent_jobs INTEGER DEFAULT 10,
current_jobs INTEGER DEFAULT 0,
last_heartbeat TIMESTAMPTZ DEFAULT NOW()
);
-- Indexes for performance
CREATE INDEX idx_job_queue_pending ON job_queue(cluster_id, status, priority DESC, created_at)
WHERE status = 'pending';Implementation PhasesPhase 1: Single-Cluster FoundationGoal: Get basic queue-based processing working in one cluster
Job Claim Pattern: BEGIN;
SELECT * FROM job_queue
WHERE cluster_id = 'local' AND status = 'pending'
ORDER BY priority DESC, created_at
FOR UPDATE SKIP LOCKED
LIMIT 1;
UPDATE job_queue
SET status = 'processing', claimed_at = NOW(), claimed_by = $worker_id
WHERE id = $job_id;
COMMIT;KEDA Configuration: triggers:
- type: postgresql
metadata:
query: "SELECT COUNT(*) FROM job_queue WHERE cluster_id = 'local' AND status = 'pending'"
targetQueryValue: "1"Phase 2: Split-Merge ProcessingGoal: Handle large projects by breaking them into chunks
Phase 3: Multi-Cluster DistributionGoal: Route work to multiple clusters based on capacity
Routing Logic: -- Check local capacity
SELECT current_jobs < (max_concurrent_jobs * 0.8)
FROM cluster_capacity WHERE cluster_id = 'local';
-- If under capacity: insert with cluster_id = 'local'
-- If at capacity: insert with cluster_id = 'global'Worker Consumption: -- Try local first
SELECT ... WHERE cluster_id = 'local' AND status = 'pending' ...
-- If empty, try global
SELECT ... WHERE cluster_id = 'global' AND status = 'pending' ...Phase 4: Production HardeningGoal: Reliability, observability, optimization
|
|
Work has progressed quite a bit on https://github.com/hotosm/ScaleODM Currently there is only a basic / standard workflow. We need to add split-merge logic. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Preamble
We need to handle two processing scenarios well:
For the split-merge cloud-native containers approach we need to do some working out of the process (explored below).
But from the DroneTM side, here is what we need:
Federated Kubernetes Cluster
We are diagramming an initial collab for University Columbia <> HOT infra linkage in this repo: https://github.com/ciesin/hot-docs
Test Control Plane
More details to come...
All reactions