Divanex Emblem
Divanex Technologies

Engineering High-Scale Reality

0%
Click anywhere to skip
ARCHITECTURAL CASE STUDY8 min read

Engineering Sub-15 Minute Hyperlocal Delivery: Dispatch Algorithms, Driver Batching & Live GPS Telemetry

How we engineered the real-time dispatch core for Fynito, achieving high-throughput rider matching with dynamic geofencing.

Rajan S.

Rajan S.

Lead Systems Architect, Divanex

Engineering Sub-15 Minute Hyperlocal Delivery: Dispatch Algorithms, Driver Batching & Live GPS Telemetry
FIG 1.0 // ARCHITECTURE BLUEPRINTFood Delivery & Logistics
DOMAIN

Food Delivery & Logistics

VERIFICATION

Production Tested

RIGOR LEVEL

Lead Architects & CTOs

ESTIMATED TIME

8 min read

Executive Summary & Architectural Takeaways

A deep dive into building real-time dispatch systems: sub-second driver matching using H3 hexagonal spatial indexing, WebSocket order states, and battery-optimized mobile GPS telemetry.

The 15-Minute Logistics Challenge #



Hyperlocal food and grocery platforms operate on razor-thin delivery windows. When an order is placed, three critical clocks start ticking simultaneously:

1. **Merchant Prep Time:** Kitchen or dark store picking & packing (5–8 minutes). 2. **Driver Assignment & Ingress:** Finding the nearest active rider travelling toward the merchant (3–5 minutes). 3. **Last-Mile Transit:** Dispatching the rider to the customer's doorstep with turn-by-turn routing (4–7 minutes).

At Divanex, while architecting the multi-vendor **Fynito delivery platform**, our core challenge was eliminating the "dispatch lag" where orders waited 30–60 seconds simply searching for a driver.

---

Uber H3 Spatial Hexagonal Clustering #



Traditional radial distance queries (`ST_DWithin` in PostGIS) require continuous spatial index scans that degrade under thousands of active GPS pings.

Instead, we map geographical coordinates into discrete **Uber H3 Resolution 8 & 9 hexagons**:

TYPESCRIPT SNIPPET
PRODUCTION SPEC
import { latLngToCell, gridDisk } from "h3-js";

export function findEligibleDrivers(merchantLat: number, merchantLng: number, maxRadiusHops = 2) { // Convert merchant coords to Resolution 8 H3 Index const merchantHex = latLngToCell(merchantLat, merchantLng, 8); // Get all neighboring hex cells within distance const searchRing = gridDisk(merchantHex, maxRadiusHops); // Query Redis In-Memory Hash Set for active riders in these cells return redis.sunion(...searchRing.map(hex => `riders:cell:${hex}`)); }


By organizing riders into in-memory Redis sets partitioned by H3 cell ID, driver discovery latency dropped from **420ms to under 14ms** across 15,000 concurrent delivery riders.

---

Dynamic Order Batching & Route Optimization #



When two customers in the same residential apartment complex order from neighboring restaurants within 3 minutes of each other, assigning separate riders doubles operational costs.

Our batching engine evaluates: - **Angle Alignment:** Rider trajectory must not divert by more than 15 degrees. - **Thermal Decay Threshold:** Hot food must never sit in transit for longer than 18 minutes total. - **Dynamic Payout Multipliers:** Automatically crediting the rider with a 1.4x bonus while reducing platform delivery cost by 35%.

---

Battery-Efficient Driver Telemetry (MQTT vs WebSockets) #



Continuously polling GPS on mobile devices burns rider batteries in under 4 hours. We implemented an adaptive throttle protocol: - **Rider Moving (> 15 km/h):** Transmit GPS packet every 3 seconds over lightweight MQTT with QoS 0. - **Rider Stationary (Traffic light / Waiting at Restaurant):** Back off GPS broadcast interval to every 15 seconds. - **Device Standby:** Wake on high-priority geofence entry events using native iOS/Android background location fences.

---

Key Architectural Takeaways #



- Pre-compute spatial indexes with H3 to keep real-time matching strictly in-memory. - Use MQTT gateways for high-frequency IoT/mobile telemetry to save 70% mobile bandwidth and 45% device battery. - Always implement deterministic idempotency keys on driver assignment transactions to avoid split-second race conditions.
TOPICS & SYSTEM PRIMITIVES
#Hyperlocal Delivery#Logistics#WebSocket#H3 Spatial Index#Real-Time Tracking
Share with engineers:
Rajan S.

Rajan S.

PRINCIPAL AUTHOR

Lead Systems Architect, Divanex

Part of the Divanex Principal Architecture pod specializing in high-concurrency cloud systems, distributed databases, HL7 integrations, and enterprise AI workflows.

Recommended Engineering Reads

More architectural blueprints from our solutions engineering pod

View All Blueprints
GLOBAL TIMEZONE OVERLAP // CLIENT COVERAGE

Global Client Coverage & Regional Desks

Primary engineering runs out of our Jaipur HQ, with dedicated client coverage and active timezone overlap across APAC, the Middle East, and North America.

OPERATING HOURS Live Now
Mon – Fri: 10:00 AM – 08:00 PM
Sat–Sun: Closed (24/7 Escalations Active)
WhatsApp Direct

India

Jaipur, Rajasthan

IN
Engineering HQ & Core R&D Lab
LOCAL TIME (IST)IST (UTC+5:30)
Loading...
Active
PHYSICAL ADDRESS
Office 104, Vaishali Tower 2nd, Nursery Circle, Vaishali Nagar, Jaipur 302021

Hong Kong

Tsuen Wan, New Territories

HK
APAC Client Coverage Desk
LOCAL TIME (HKT)HKT (UTC+8:00)
Loading...
Active
PHYSICAL ADDRESS
FLAT/RM E (36) 3/F Superluck Industrial Centre Phase 2, 57 Sha Tsui Rd, Tsuen Wan

United Arab Emirates

Dubai Media City

AE
MENA Client Coverage Desk
LOCAL TIME (GST)GST (UTC+4:00)
Loading...
Active
PHYSICAL ADDRESS
Building C8, Dubai Media City, Dubai, United Arab Emirates

Canada

Newmarket, Greater Toronto

CA
North America Client Coverage Desk
LOCAL TIME (EST)EST (UTC-5:00)
Loading...
Active
PHYSICAL ADDRESS
105 Sawmill Valley Dr, Newmarket, ON L3X 1S4, Canada
Enterprise Multi-Region SLA: All client communications routed to nearest regional engineering lead within < 15 minutes.
100% In-House Engineers
Scroll to Content(0%)