<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Himanshu Kashyap</title>
    <description>The latest articles on DEV Community by Himanshu Kashyap (@himanshu_kashyap_d5024f68).</description>
    <link>https://dev.to/himanshu_kashyap_d5024f68</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4260501%2F5262aa65-1c99-4e42-b553-f4858c7467c4.jpg</url>
      <title>DEV Community: Himanshu Kashyap</title>
      <link>https://dev.to/himanshu_kashyap_d5024f68</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/himanshu_kashyap_d5024f68"/>
    <language>en</language>
    <item>
      <title>Architecture Review: Scaling Django + PostgreSQL + Redis + SSE for a Consumer GPS Tracking App</title>
      <dc:creator>Himanshu Kashyap</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:36:30 +0000</pubDate>
      <link>https://dev.to/himanshu_kashyap_d5024f68/architecture-review-scaling-django-postgresql-redis-sse-for-a-consumer-gps-tracking-app-1ch9</link>
      <guid>https://dev.to/himanshu_kashyap_d5024f68/architecture-review-scaling-django-postgresql-redis-sse-for-a-consumer-gps-tracking-app-1ch9</guid>
      <description>&lt;p&gt;Hi everyone,&lt;/p&gt;

&lt;p&gt;We're developing a consumer GPS tracking application using Flutter for Android and iOS, backed by Django, PostgreSQL, Redis, Celery and Python.&lt;/p&gt;

&lt;p&gt;Our target customers are individuals who purchase a GPS tracking device and use our mobile application to monitor their vehicle's location, receive alerts and access location history.&lt;/p&gt;

&lt;p&gt;We've implemented our backend and would appreciate feedback from developers experienced with Django, IoT systems and real-time mobile applications.&lt;/p&gt;

&lt;p&gt;I've attached our current backend architecture diagram for reference.&lt;/p&gt;

&lt;p&gt;Current architecture&lt;/p&gt;

&lt;p&gt;GPS devices communicate using the GT06 protocol over TCP.&lt;/p&gt;

&lt;p&gt;A custom Python listener receives and decodes GPS packets, processes them through our Django application logic and persists tracking records in PostgreSQL.&lt;/p&gt;

&lt;p&gt;For real-time updates, we use Redis Pub/Sub notifications and Django ASGI with Server-Sent Events (SSE).&lt;/p&gt;

&lt;p&gt;Our backend includes:&lt;/p&gt;

&lt;p&gt;Django REST APIs for mobile application operations.&lt;/p&gt;

&lt;p&gt;PostgreSQL for tracking history, current location, device access and durable events.&lt;/p&gt;

&lt;p&gt;Redis Pub/Sub for transient notifications.&lt;/p&gt;

&lt;p&gt;A shared Redis reader with latest-location coalescing.&lt;/p&gt;

&lt;p&gt;A bounded database query scheduler.&lt;/p&gt;

&lt;p&gt;Django ASGI for location and event SSE.&lt;/p&gt;

&lt;p&gt;Celery for asynchronous background processing.&lt;/p&gt;

&lt;p&gt;Flutter as the mobile application.&lt;/p&gt;

&lt;p&gt;PostgreSQL remains the authoritative data source.&lt;/p&gt;

&lt;p&gt;Expected workload&lt;/p&gt;

&lt;p&gt;Initially, we expect around 100–500 active GPS devices, potentially increasing to 1,000–2,000.&lt;/p&gt;

&lt;p&gt;A moving GPS device typically sends one packet every 10 seconds.&lt;/p&gt;

&lt;p&gt;Devices&lt;/p&gt;

&lt;p&gt;Approximate incoming packets/sec&lt;/p&gt;

&lt;p&gt;100&lt;/p&gt;

&lt;p&gt;10&lt;/p&gt;

&lt;p&gt;500&lt;/p&gt;

&lt;p&gt;50&lt;/p&gt;

&lt;p&gt;1,000&lt;/p&gt;

&lt;p&gt;100&lt;/p&gt;

&lt;p&gt;2,000&lt;/p&gt;

&lt;p&gt;200&lt;/p&gt;

&lt;p&gt;These are workload estimates, not benchmark-verified capacity figures.&lt;/p&gt;

&lt;p&gt;Our initial application server has 2 vCPUs and 4 GB RAM, with PostgreSQL hosted separately.&lt;/p&gt;

&lt;p&gt;Our questions&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Django and GPS ingestion&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Is a custom TCP listener combined with an existing Django backend an appropriate architecture for this workload?&lt;/p&gt;

&lt;p&gt;Would you recommend individual database writes, bounded batch writes, or a separate ingestion queue?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Redis and real-time communication&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a consumer Flutter application, is Django ASGI with SSE a good choice for live GPS location updates?&lt;/p&gt;

&lt;p&gt;Would WebSockets or another approach provide meaningful benefits, especially given mobile-network interruptions and background execution restrictions?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Efficient location delivery&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We've implemented a shared Redis reader and latest-location coalescing to reduce duplicate queries and notifications.&lt;/p&gt;

&lt;p&gt;Are there better patterns for handling hundreds or thousands of connected mobile clients while minimizing CPU and PostgreSQL usage?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authentication and authorization&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each customer should receive location updates only for devices they are authorized to access.&lt;/p&gt;

&lt;p&gt;How would you enforce changing device permissions efficiently across persistent SSE connections without repeatedly querying PostgreSQL for every GPS update?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Database scalability&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;GPS devices continuously generate historical tracking data.&lt;/p&gt;

&lt;p&gt;What PostgreSQL strategies would you recommend for indexing, partitioning, retention and querying historical locations while maintaining efficient real-time writes?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Infrastructure and performance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Which backend components would you optimize first to support 1,000–2,000 active devices with reasonable server costs?&lt;/p&gt;

&lt;p&gt;What performance metrics and load-testing methodology would you recommend before increasing infrastructure capacity?&lt;/p&gt;

&lt;p&gt;Our objective&lt;/p&gt;

&lt;p&gt;We want to keep our existing Django application and gradually optimize it rather than introduce unnecessary architectural complexity.&lt;/p&gt;

&lt;p&gt;The redesigned real-time backend is currently deployed in UAT, but full authenticated mobile SSE validation and large-scale benchmarks are still pending.&lt;/p&gt;

&lt;p&gt;We would particularly appreciate feedback from anyone who has built consumer GPS tracking, IoT telemetry or real-time mobile applications using Django.&lt;/p&gt;

&lt;p&gt;Based on the attached architecture, what would you change first to improve scalability, reliability and resource efficiency?&lt;/p&gt;

&lt;p&gt;Thanks in advance!&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy4ptf6crtz29q0pyd841.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy4ptf6crtz29q0pyd841.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>django</category>
      <category>iot</category>
    </item>
  </channel>
</rss>
