An engineering reference for backend, IoT, and mobility teams building low-latency spatial systems.
Spatial containment, streaming polygon indexing, async Python pipelines, reliable trigger routing, and production observability β grounded in real benchmarks and production-hardened code.
π Read it live β www.real-time-geofencing.org
Real-Time Geofencing is a focused, deeply technical reference for engineers who resolve hundreds of thousands of GPS pings per second against tens of thousands of mutating polygons inside single-digit-millisecond budgets. Every page documents a production trade-off β not a tutorial β with measured throughput and latency figures, valid Python 3.11+ code, Big-O analysis, and hand-authored diagrams.
It is written for the people who own the latency budget: backend and platform engineers, IoT and mobility platform developers, Python GIS architects, and logistics or ride-hailing engineering teams.
The material is organised into three tracks, each anchored by an in-depth overview page:
Pipeline partitioning and SLA enforcement, per-phase latency budgets, streaming vs batch evaluation, point-in-polygon algorithm benchmarks, async Python execution patterns, deterministic memory and cache locality, event-time ordering under clock skew, and graceful fallback when GPS signals drop.
Index-primitive selection, Uber H3 hexagon indexing, quadtrees vs R-trees, dynamic spatial hashing, polygon simplification for high-throughput streams, lock-free index updates, and the memory footprint of streaming polygon indexes β including named comparisons like Shapely vs Rtree vs libspatialindex and H3 vs S2.
The downstream half of the pipeline: reliable trigger routing over Kafka and Redis Streams, idempotent emission, dead-letter and poison-message handling, backpressure and flow-control strategies, circuit breakers for slow consumers, and production monitoring and observability (Prometheus, py-spy, GC-pause alerting).
- Real numbers, not vibes. Every performance claim carries a figure β
25k evaluations/sec,P99 < 8ms at 50k events/sec,~0.18ms per coordinate pair,RSS capped at 1.5GB. - Runnable code. Type-annotated Python 3.11+ with asyncio patterns, backpressure handling, and inline notes on the non-obvious decisions.
- Custom diagrams. Every overview and guide carries an original, accessible inline SVG explaining the hardest concept on the page β no stock art.
- Operator runbooks. Numbered, tool-specific debugging steps (py-spy, tracemalloc,
gc.get_stats, queue-depth polling) you can actually follow at 3 a.m. - Tight cross-linking. 50+ interlinked pages so you're always one or two clicks from the related trade-off.
- Eleventy β static site generator
- KaTeX β math typesetting for Big-O and latency formulas
- Prism β code syntax highlighting
- Hand-authored inline SVG diagrams and a progressive-web-app shell
- Deployed on Cloudflare Workers
npm install # install dependencies
npm run serve # local dev server with live reload
npm run build # production build into _site/
npm run deploy # build and deploy to CloudflareIssues and pull requests that sharpen the technical accuracy, add a missing benchmark, or improve a diagram are welcome. Please keep the house style: concrete figures, valid typed Python, and one strong diagram over many weak ones.