Overview
Iris is built on a stateless, RAM-only architecture with a core principle:Zero Persistence Philosophy
No databases. No file storage. No request logs. Every request is processed entirely in memory and immediately discarded.
What Is Stateless?
In a stateless system, each request is completely independent:No Session State
No authentication tokens, cookies, or user sessions
No Data Retention
Images and embeddings are discarded after response
No History
No logs of who compared which faces
No Database
No PostgreSQL, MongoDB, Redis, or any persistence layer
Architecture Analysis
Let’s examine the codebase to understand how statelessness is enforced.Application State
The only shared state inmain.rs:28-33:
main.rs
engine: Arc<Mutex<FaceEngine>>
engine: Arc<Mutex<FaceEngine>>
Contains the neural network models (YuNet and SFace). These are static weights loaded from ONNX files at startup.No user data is stored here—only the trained model parameters that are identical for all requests.
limiter: SharedRateLimiter
limiter: SharedRateLimiter
stats: RequestStats
stats: RequestStats
Records aggregate statistics: total requests, requests per second/minute/hour.Again, RAM-only. Stats reset on server restart. No personally identifiable information (PII) is stored.
Request Processing Lifecycle
Trace a single request throughmain.rs:62-117:
Images Downloaded to RAM
main.rs
Mat objects in memory. No files written to disk.Face Detection & Recognition
main.rs
No Logging
Notice what’s absent from the code: ❌ Nolog::info!() or println!() statements logging request details❌ No database inserts or file writes
❌ No telemetry or analytics collection
❌ No error reporting services (like Sentry) that might leak data The only output is the startup message (
main.rs:125, 153):
main.rs
Privacy Benefits
1. No Data Breach Risk
You cannot leak data that you never store.
- No database to dump
- No files to exfiltrate
- No logs to analyze
2. GDPR/CCPA Compliance
Under data protection laws: ✅ No personal data collection: Images are not “collected,” only transiently processed✅ No retention period: Data is deleted within milliseconds
✅ No right to deletion: Nothing to delete—data never persists
✅ No data portability: Nothing to export
3. Anonymous Usage
The API has no concept of “users”:- No authentication required
- No API keys (optional, but not in the base implementation)
- No tracking of who submitted what
main.rs:41) is the only per-client state, and it’s ephemeral.
Performance Benefits
1. Horizontal Scalability
Stateless services scale trivially:2. No Database Bottleneck
Traditional face recognition systems:3. Lower Infrastructure Costs
No database means:- No PostgreSQL/MongoDB hosting fees
- No Redis cache layer
- No backup/restore infrastructure
- No DBA overhead
Traditional Stack
API server + Database + Cache + Backups = $200+/month
Iris Stack
Single API server = $20/month
Limitations & Trade-offs
1. No Historical Analysis
You cannot: ❌ Track which faces are searched most often❌ Build a “most wanted” list
❌ Analyze usage patterns over time
❌ Implement “recently compared” features If these are requirements, you need to add a persistence layer outside of Iris (e.g., in your client application).
2. No Caching
If the same face is compared multiple times:Why Not Add a Cache?
Why Not Add a Cache?
Caching introduces state, which:
- Increases memory usage
- Complicates deployment (need cache invalidation strategy)
- Adds privacy risk (cached data persists longer)
3. No Persistent Rate Limiting
Rate limits reset when the server restarts (main.rs:127-130):
main.rs
- Hit rate limit
- Wait for server restart (or crash it)
- Get fresh quota
Statistics Module Analysis
Thestats.rs module appears to contradict statelessness—let’s examine it.
What’s Stored?
stats.rs
- total: Atomic counter of all requests since startup
- timestamps: Queue of request times for the last hour
Is This “State”?
Yes, but it’s aggregate, anonymous state: ✅ No PII (personally identifiable information)✅ No request contents
✅ No IP addresses
✅ No images or embeddings Just counters: “5 requests in the last second.”
Memory Management
Old timestamps are pruned (stats.rs:35-39):
stats.rs
Deployment Considerations
Kubernetes/Docker
Stateless design makes containerization ideal:Crash Recovery
If the process crashes:- In-flight requests are lost (clients see connection errors)
- No data corruption (nothing to corrupt)
- Restart is instant (no database recovery needed)
Backup Strategy
There’s nothing to back up. The only files needed are:- The compiled binary
- ONNX model files
Comparing Architectures
Stateful Face Recognition API
Iris (Stateless)
When to Add State
You might need persistence if: 🔍 Building a search engine: Need to index millions of faces👤 User accounts: Require login and personalization
📊 Analytics: Must track usage patterns for billing
🔐 Audit logs: Legal requirement to log access
In these cases, add state outside Iris:
- Store embeddings in a vector database (Pinecone, Milvus, Qdrant)
- Log requests in a separate service (Elasticsearch, Splunk)
- Keep Iris itself stateless as the compute layer
Conclusion
Iris’s stateless design is a deliberate architectural choice that prioritizes:- Privacy: No data retention = no data breach
- Simplicity: No database = easier operations
- Scalability: Stateless services scale effortlessly
- Performance: RAM-only processing is fast