# Rust Framework Performance Research: Actix vs Axum **Focus**: Throughput, Async I/O, Concurrent Connections (1000+) **Date**: 2026-02-14 ## Critical Requirements ### Throughput Optimization - Large data transfers (encrypted health data) - Real-time sensor data streaming - Batch operations for mobile sync - Multiple concurrent queries per user ### Async/Lazy Loading - Lazy data decryption - Lazy relationship loading - Lazy data transformation - Background job processing ### Concurrency (1000+ connections) - Connection pooling efficiency - Memory per connection - Context switching overhead - Async runtime scalability ### Data Flow Architecture Client Request -> Rust API -> MongoDB (Encrypted) | v Large encrypted data transfer | v Decrypt on client or Node.js web server --- ## Performance Metrics to Compare ### 1. Throughput (MB/s) - Single large JSON response - Streaming responses - Batch operations - WebSocket data transfer ### 2. Latency (ms) - P50, P95, P99 response times - Cold start latency - Database query latency - WebSocket frame latency ### 3. Concurrent Connections - 1,000 connections memory usage - 10,000 connections memory usage - Connection churn (connect/disconnect rate) - Keep-alive efficiency ### 4. Async Efficiency - Context switching overhead - Task scheduler efficiency - I/O polling (epoll/io_uring) - Backpressure handling --- ## Research Tasks ### Task 1: Latest Benchmarks (30 min) Search for: - TechEmpower Framework Benchmarks 2024-2025 - JSON serialization benchmarks - Multiple queries benchmark - Plaintext benchmark - Data update benchmark - Fortunes benchmark (templating) Sources: - https://www.techempower.com/benchmarks/ - GitHub benchmark repositories - Academic papers on web framework performance ### Task 2: Async Runtime Comparison (30 min) Tokio (Axum) vs Actix-rt (Actix) Questions: - Which is more efficient for I/O-bound workloads? - How do they compare for database queries? - Memory footprint differences? - CPU efficiency under load? - Work-stealing scheduler differences? Key Metrics: - Tasks per second - Memory per task - Context switch overhead - I/O polling efficiency ### Task 3: Throughput Under Load (45 min) Search for: - Real-world throughput comparisons - Large file transfer performance - Streaming performance (chunked transfer) - WebSocket throughput tests - Memory pressure behavior Keywords: - actix web throughput benchmark - axum throughput benchmark - rust web framework 1000 concurrent - rust websocket performance ### Task 4: Connection Pooling (30 min) Research: - Deadpool vs r2d2 connection pooling - Integration with both frameworks - Pool size recommendations - Connection reuse efficiency - Pool contention under high concurrency ### Task 5: MongoDB + Async Patterns (45 min) Investigate: - Official MongoDB async driver performance - Cursor streaming efficiency - Batch operation support - Lazy loading patterns - Connection pool behavior Key Libraries: - mongodb: Official async driver - deadpool: Generic connection pool - bson: Document serialization ### Task 6: WebSocket Performance (30 min) Compare: - actix-web-actors vs axum-websockets - Message throughput - Connection stability - Memory per connection - Scaling strategies ### Task 7: Memory Efficiency (30 min) Research: - Memory usage per 1000 connections - Memory leaks reports - Copy-on-write optimization - Zero-copy patterns - Buffer reuse strategies ### Task 8: Lazy Loading Patterns (30 min) Investigate: - Async lazy evaluation in Actix - Async lazy evaluation in Axum - Streaming response patterns - Deferred execution support - Backpressure handling --- ## Search Queries ### Performance Benchmarks - rust actix web benchmark 2024 - rust axum benchmark 2024 - techempower rust framework benchmarks - actix vs axum performance comparison - rust web framework throughput ### Async & Concurrency - tokio vs actix-rt performance - rust async runtime comparison - 1000 concurrent connections rust - rust web framework memory efficiency - rust async io benchmark ### MongoDB & Database - rust mongodb driver benchmark - async mongodb rust performance - deadpool connection pool benchmark - rust mongodb cursor streaming ### WebSocket & Real-time - rust websocket performance benchmark - actix websocket throughput - axum websocket performance - rust 1000 websocket connections ### Real-world Experiences - actix production performance issues - axum production performance issues - rust web framework 10000 concurrent connections - rust framework memory leak production - migrating from actix to axum performance --- ## Data Collection Plan ### Quantitative Metrics - Requests per second (RPS) - MB/s throughput - Memory usage (RSS, heap) - CPU usage per 1000 connections - Latency percentiles (P50, P95, P99) - WebSocket messages per second ### Qualitative Data - Ease of implementing streaming responses - Quality of async/await support - Error handling ergonomics - Testing and profiling tools - Production war stories --- ## Expected Findings ### Hypothesis 1: Axum may excel in I/O throughput - Built on Tokio async runtime - Tower middleware ecosystem - Modern async/await from ground up - Zero-copy request/response handling ### Hypothesis 2: Actix may excel in raw CPU performance - Actor model parallelism - Proven track record - Optimized for high concurrency - Extensive benchmark tuning ### Hypothesis 3: Both likely handle 1000+ connections - Rust's zero-cost abstractions - Efficient async runtimes - Memory-efficient networking - epoll/io_uring support --- ## Sources to Check ### Official Documentation - Actix Web: https://actix.rs/docs/ - Axum: https://docs.rs/axum/ - Tokio: https://tokio.rs/docs/ - Tower: https://docs.rs/tower/ ### Benchmarks - TechEmpower: https://www.techempower.com/benchmarks/ - Rust Web Framework Benchmark (GitHub) - Various GitHub repos with framework comparisons ### Community Discussions - Reddit: r/rust - Discord: Rust server - Stack Overflow: Performance questions - GitHub Issues: Performance-related issues ### Blog Posts & Articles - Framework comparison posts (2024-2025) - Performance optimization guides - Production deployment stories - Migration experiences --- ## Research Output After completing research, produce: 1. Performance Comparison Table 2. Async Efficiency Analysis 3. MongoDB Integration Score 4. WebSocket Performance 5. Final Recommendation --- ## Timeline - Total Research Time: 4-5 hours - Documentation Search: 1.5 hours - Community Research: 1.5 hours - Benchmark Analysis: 1 hour - Compilation & Notes: 1 hour