π avx-http - AVL Platform HTTP Client/Server
Native HTTP library optimized for Brazilian infrastructure and AVL Platform services.
π Features
-
π§π· Brazilian Infrastructure Optimized
- Regional routing (SΓ£o Paulo DC preference)
- Smart retries for Brazilian ISP flakiness
- < 500Β΅s request overhead
- Native connection multiplexing
-
β‘ High Performance
- 100k+ requests/sec on single core
- Zero-copy body parsing
- Automatic compression with
avila-compress - Connection pooling
-
π§ AVL Platform Native
- Built-in AVL authentication (JWT, API keys)
- AvilaDB connection integration
- Automatic telemetry and tracing
- Cost tracking per request
-
π οΈ Developer Friendly
- Simple async/await API
- Type-safe route handlers
- Built-in OpenAPI generation
- Comprehensive error handling
π¦ Installation
[]
= "0.1"
= { = "1", = ["full"] }
π― Quick Start
HTTP Client
use Client;
async
HTTP Server
use ;
async
async
async
π¨ Advanced Features
Connection Pooling
let client = builder
.pool_max_connections
.pool_idle_timeout
.build?;
Request Retries
let response = client
.get
.retry // Retry up to 3 times
.timeout
.send
.await?;
Automatic Compression
let response = client
.post
.body
.compress // Automatically compress with avila-compress
.send
.await?;
Regional Routing
// Prefer Brazilian data centers
let client = builder
.region
.fallback_region
.build?;
π Performance
Benchmarks on AWS c6i.xlarge (SΓ£o Paulo region):
| Operation | avx-http | reqwest | Improvement |
|---|---|---|---|
| Simple GET | 480Β΅s | 2.1ms | 4.4x faster |
| JSON POST | 520Β΅s | 2.3ms | 4.4x faster |
| Large file (1MB) | 15ms | 18ms | 20% faster |
| Compressed (10KB) | 1.2ms | 3.1ms | 2.6x faster |
π§ͺ Testing
# Run all tests
# Run benchmarks
# Test with real HTTP requests
πΊοΈ Roadmap
- HTTP/1.1 client
- Basic server with routing
- HTTP/2 support
- HTTP/3 / QUIC support
- WebSocket support
- Server-Sent Events (SSE)
- Built-in rate limiting
- Circuit breaker pattern
- OpenAPI generation
- Native AvilaDB integration
π― Use Cases
API Gateway
// High-performance gateway for AVL Platform services
let gateway = bind
.router
.rate_limit
.compression
.cors
.run
.await?;
Microservice Communication
// Fast inter-service calls
let auth_client = builder
.base_url
.timeout
.build?;
Data Ingestion
// Stream large datasets to AvilaDB
let response = client
.post
.stream
.compress
.send
.await?;
π€ Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
π License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Built with β€οΈ for the AVL Platform and Brazilian research infrastructure π§π·