Performance comparison of Django's main interactive frameworks
Which Django interactive framework is actually the fastest? Django LiveView, HTMX, Unicorn, Reactor, or good old server-side rendering? I don't know, but I'd like to find out. Is investing time in WebSockets a waste? Is hmtx slow? So many questions to answer.
The results were... surprising.
Technology Comparison
First, a quick overview of the technologies compared:
| Feature | Django LiveView | SSR | django-htmx | Unicorn | Reactor |
|---|---|---|---|---|---|
| Transport | WebSocket | HTTP | AJAX | AJAX | WebSocket |
| Update Type | Real-time | Full reload | Partial | Reactive | Real-time |
| Multi-user | ✅ Broadcast | ❌ | ❌ | ❌ | ✅ Broadcast |
| Infrastructure | Redis + Channels | Django only | Django only | Django only | Redis + Channels |
Performance Testing
To settle this question, I built an identical alert management system using each framework. The test workflow: click a button that creates a database record, wait for it to render on the page, navigate to a form (page/modal), intentionally fail validation, see error messages, submit correctly, return to the previous screen, and verify the new element appears. Pretty easy and common workflow.
Each framework was tested 10 times using Chrome DevTools Performance API, measuring:
- Response time: From button click to UI update
- Network requests: HTTP calls or WebSocket messages
- Data transfer: Bytes sent over the wire
Fair and square. Same system, same test, same browser.
Results Summary
| Implementation | Avg Response Time | Network Requests | Data Transfer | Technology |
|---|---|---|---|---|
| Django LiveView | 9.35ms | 0 (WebSocket) | 0.44 KB | WebSocket messages |
| Reactor | 12.00ms | 0 (WebSocket) | 0.51 KB | WebSocket components |
| django-htmx | 16.48ms | 1 HTTP request | 36.13 KB | AJAX partial HTML |
| Unicorn | 26.76ms | 1 HTTP request | 69.34 KB | AJAX component sync |
| SSR | 47.25ms | 2 HTTP requests | 8.30 KB | POST + redirect GET |
Performance Visualizations
All charts indicate that lower values are better for optimal performance.
Response Time Comparison
/https://andros.dev/media/blog/2025/12/benchmark-response-time.png)
Average response times across implementations. Django LiveView (9.35ms) is fastest, followed by Reactor (12.00ms), django-htmx (16.48ms), Unicorn (26.76ms), and SSR (47.25ms).
HTTP Requests per Action
/https://andros.dev/media/blog/2025/12/benchmark-network-requests.png)
Number of HTTP requests required per action. Django LiveView and Reactor use 0 HTTP requests (WebSocket), while SSR requires 2 (POST + redirect).
Data Transfer Overhead
/https://andros.dev/media/blog/2025/12/benchmark-data-transfer.png)
Amount of data transferred per action. Django LiveView (0.44 KB) and Reactor (0.51 KB) transfer minimal data, while Unicorn transfers the most (69 KB).
Performance Stability
/https://andros.dev/media/blog/2025/12/benchmark-stability.png)
Response time consistency across 10 iterations. Lower and flatter lines indicate better, more stable performance.
Key Findings
🏆 Speed Winner: Django LiveView (9.35ms)
- WebSocket communication eliminates HTTP overhead
- Real-time bidirectional connection already established
- Minimal data transfer (0.44 KB per action)
- Best for: Real-time dashboards, collaborative apps, maximum performance
🥈 Runner-up: Reactor (12.00ms)
- Phoenix LiveView-style architecture with WebSocket
- Component-based approach with excellent speed
- Only 28% slower than Django LiveView, 4x faster than SSR
- Best for: Structured components with performance close to Django LiveView
🥉 Third Place: django-htmx (16.48ms)
- Best AJAX solution, 38% faster than Unicorn
- Efficient partial updates, minimal JavaScript
- Good balance of speed and simplicity
- Best for: Modern UX without WebSockets
4️⃣ Fourth Place: Unicorn (26.76ms)
- Component-based with two-way data binding
- Full component state synchronization
- Larger payloads (69 KB) due to component data
- Best for: Interactive forms with complex state management
5️⃣ Traditional: SSR (47.25ms)
- Full page reload with complete render cycle
- Two HTTP requests (POST + redirect GET)
- Slowest but simplest infrastructure
- Best for: SEO-critical pages, simple CRUD apps
Conclusions
- WebSocket Dominance: Both Django LiveView (9.35ms) and Reactor (12.00ms) outperform HTTP-based solutions by 43-80%, with zero HTTP requests per action.
- Reactor vs Django LiveView: Reactor is 28% slower than Django LiveView but offers Phoenix LiveView-style components. Both transfer minimal data (0.44-0.51 KB) compared to AJAX solutions.
- Best AJAX Solution: django-htmx (16.48ms) is 38% faster than Unicorn (26.76ms), proving that simpler approaches often win in the AJAX category.
- Component Overhead: Unicorn's full state sync adds significant overhead (69 KB vs django-htmx's 36 KB), trading bandwidth for richer interactivity.
- Network Efficiency: WebSocket solutions (Django LiveView, Reactor) transfer 70-157x less data than AJAX solutions, demonstrating superior efficiency.
- Stability: WebSocket implementations show excellent consistency (std dev <1.2ms) while all frameworks maintain stable performance across iterations.
In summary, if maximum speed and efficiency are your goals, WebSocket-based frameworks like Django LiveView and Reactor are the clear winners. For those seeking a balance of speed and simplicity without WebSockets, django-htmx and Unicorn is a strong contender. If you prioritize simplicity and SEO, traditional SSR remains a viable option despite its slower performance.
Update (2026-04-14)
Six months later, I went back to the benchmark with two new pieces: djust, a Rust-powered Phoenix LiveView-style framework for Django that landed last year, joins the comparison. And the ASGI server swapped from Daphne to Uvicorn, which is noticeably faster for pure-Python frameworks.
Results
All six implementations, 10 iterations each, served by Uvicorn behind Django 5.1.
| Implementation | Avg Response Time | HTTP Requests | Data Transfer | Technology |
|---|---|---|---|---|
| Django LiveView | 30.66 ms | 0 (WebSocket) | 5.80 KB | WebSocket messages |
| djust | 34.57 ms | 0 (WebSocket) | 8.79 KB | WebSocket VDOM patches |
| django-htmx | 35.24 ms | 1 HTTP request | 4.39 KB | AJAX partial HTML |
| Reactor | 47.93 ms | 0 (WebSocket) | 1.64 KB | WebSocket diffs |
| Unicorn | 47.93 ms | 1 HTTP request | 6.33 KB | AJAX component sync |
| SSR | 55.57 ms | 2 HTTP requests | 8.24 KB | POST + redirect GET |
Updated charts
All charts indicate that lower values are better.
Response Time
/https://andros.dev/media/blog/2026/04/benchmark-update-response-time.png)
Django LiveView leads at 30.66 ms, djust and django-htmx are within 5 ms, and SSR closes the ranking at 55.57 ms.
HTTP Requests per Action
/https://andros.dev/media/blog/2026/04/benchmark-update-network-requests.png)
All three WebSocket frameworks hit zero HTTP requests. SSR still pays for the POST-redirect-GET round trip.
Data Transfer
/https://andros.dev/media/blog/2026/04/benchmark-update-data-transfer.png)
Reactor is the stingiest on the wire (1.64 KB, diff-based updates), django-htmx the lightest AJAX option (4.39 KB). djust sends more payload than the rest (8.79 KB) because it's shipping full VDOM patches over the wire.
Stability
/https://andros.dev/media/blog/2026/04/benchmark-update-stability.png)
SSR is the most jittery, which is consistent with its HTTP-heavy round trip. The WebSocket frameworks stay flat, with Django LiveView and djust almost overlapping.
- Technology Comparison
- Performance Testing
- Results Summary
- Performance Visualizations
- Response Time Comparison
- HTTP Requests per Action
- Data Transfer Overhead
- Performance Stability
- Key Findings
- Conclusions
- Update (2026-04-14)
- Results
- Updated charts
- Response Time
- HTTP Requests per Action
- Data Transfer
- Stability
Este trabajo está bajo una licencia Attribution-NonCommercial-NoDerivatives 4.0 International.
Apóyame en Ko-fi
Comentarios
Todavía no hay ningún comentario.