Scaling Django REST APIs for 700+ Outlets
Strategies and optimizations for managing thousands of concurrent data points and media uploads in a large mobile workforce.

Zahed Hasan
Engineering Manager at Syscomatic LLC

Django is notoriously fast to build with, but scaling it to handle thousands of concurrent spatial requests and heavy image uploads requires stepping significantly outside the default ORM constraints.
The Scale Problem
When dealing with live GPS integration for 700+ outlets, traditional relational joins on PostgreSQL can quickly bottleneck. We had to rethink how we queried and structured our geospatial analytics to avoid catastrophic latency spikes during peak audit hours.
- 700+ outlets generating concurrent GPS pings
- High-resolution image uploads from field audits (5-15 MB each)
- Real-time dashboard aggregations for management
- Complex geospatial queries for route optimization
Architecture Decisions
We implemented heavily tuned read-replicas, pushed complex analytical aggregations into asynchronous Celery queues backed by Redis, and set up granular query caching. Media assets from audits were offloaded immediately to S3 using pre-signed URLs, meaning our application servers never choked on streaming giant high-res files.
# Celery task for async report generation
@shared_task(bind=True, max_retries=3)
def generate_outlet_report(self, outlet_id, date_range):
try:
data = OutletAudit.objects.filter(
outlet_id=outlet_id,
created_at__range=date_range
).select_related("agent", "zone")
report = ReportBuilder(data).compile()
cache.set(f"report_{outlet_id}", report, timeout=3600)
return report.id
except Exception as exc:
raise self.retry(exc=exc)
The Results
The result was cutting down aggregate reporting generation from hours into pure real-time data. Management could now view live dashboards with sub-second latency, even during peak operational hours.
Moving from synchronous report generation to async Celery pipelines reduced our P95 response time from 12 seconds to under 200ms.
Tags

Written by Zahed Hasan
Engineering Manager & Co-Founder at Syscomatic LLC. Building scalable web and mobile solutions for enterprise clients.