DEV Community

stampiq
stampiq

Posted on

How We Built a Sub-5ms Event Check-In System Using Edge Compute and Redis

If you have ever built software for physical venues, you know that the morning registration rush is essentially a localized DDoS attack on your infrastructure.

Recently, our team was tasked with overhauling the architecture for massive B2B exhibitions out in Riyadh. The requirement? Process 15,000 corporate delegates within a tight 90-minute morning window. No queues. No crashes. No excuses.

Here is a breakdown of why standard cloud architectures fail at this scale, and how we shifted to an offline-first edge topology to achieve sub-5ms validation times.

The Problem: The Cloud API Bottleneck
Most off-the-shelf ticketing systems rely on a synchronous client-to-cloud model:

Attendee presents a QR code.

The scanner app makes a REST API call to a remote database to validate the token.

The server checks the state, updates the ledger, and returns 200 OK.

This works perfectly for a 200-person local meetup. But when you get 15,000 people inside a concrete exhibition hall, local cellular towers saturate instantly. Packet loss spikes. That 40ms API call suddenly takes 8,000ms. If your physical turnstiles lock up for 8 seconds per person, lines back up into the street, and venue safety becomes a severe operational risk.

The Solution: Offline-First Edge Nodes
To solve this, we had to completely decouple our front-gate validation from open internet reliance. We adopted a decentralized edge topology, a core feature of leading smart event platforms in saudi arabia.

Instead of hitting the cloud for every scan, we pushed the data to the hardware.

  1. Pre-Event Snapshot & Local Sync
    Before the venue doors open, our central cloud database (the source of truth) pushes an encrypted snapshot of the entire registered attendee ledger down to industrial micro-PCs (Raspberry Pi 4s or Intel NUCs) sitting locally at each gate cluster.

  2. In-Memory Caching with Redis
    These local edge nodes load the verification tokens directly into a local Redis instance. Redis operates entirely in RAM, making read/write operations incredibly fast.

Here is a simplified conceptual look at the local edge validation logic:

Python
import redis
import time

Connect to the local edge Redis instance

r = redis.Redis(host='localhost', port=6379, db=0)

def process_gate_scan(qr_token):
start_time = time.time()

# O(1) time complexity check in local memory
if r.sismember("valid_attendees", qr_token):
    # Prevent double-entry
    if not r.sismember("checked_in_attendees", qr_token):
        r.sadd("checked_in_attendees", qr_token)
        trigger_turnstile_relay() # Open the gate
        buffer_to_cloud_queue(qr_token) # Save for async sync

        latency = (time.time() - start_time) * 1000
        print(f"✅ Access Granted in {latency:.2f}ms")
        return True
    else:
        print("❌ Error: Badge already scanned.")
        return False
else:
    print("❌ Error: Invalid Token.")
    return False
Enter fullscreen mode Exit fullscreen mode

By keeping the lookup on the local wired Intranet switch, our validation latency dropped from a volatile multi-second loop down to a consistent 3 to 5 milliseconds. The crowd moved at a normal walking pace without stopping. We essentially built an unbreakable event registration service in riyadh that survives even if the venue’s external fiber line gets physically cut.

Passive Telemetry: Moving Beyond Barcodes
Getting people inside is only half the battle. Once 15,000 people are on the floor, organizers need to track spatial movement to manage crowd density and prove ROI to exhibitors.

Forcing attendees to stop and scan a barcode at every booth ruins the UX. Instead, we shifted to IoT and passive telemetry.

By utilizing ultra-lightweight UHF (Ultra-High Frequency) chips embedded inside the physical badges, we deployed an rfid attendee tracking network. Long-range antenna arrays mounted above internal doorways passively read the UIDs as attendees walk naturally through the venue. No stopping, no manual scanning.

Asynchronous Data Streaming (MQTT)
Since the gates and RFID antennas operate on the edge, how do we get the data back to the central server?

We use a background daemon running an MQTT client. It reads from the local append-only log and streams the data asynchronously back to the cloud. If the internet drops, it just buffers locally and fires the payload the second the connection stabilizes.

Once the data hits the cloud, it pipes directly into a real-time event analytics dashboard. This allows the venue operations team to view live heatmaps of crowd density vectors, dynamically reallocate security staff, and provide sponsors with mathematically verified lead data while the event is still happening.

Takeaway
When engineering for mass human gatherings, assume the network will fail. By shifting your architecture to the edge and relying on asynchronous syncing, you can build venue infrastructure that is blazingly fast, highly fault-tolerant, and invisible to the end user.

What is your preferred tech stack for bridging physical hardware relays with cloud analytics? Let me know in the comments.

Top comments (0)