RocksDB & Port 25 Tuning
Sizing IMAP IDLE Sockets, ulimit -n & Epoll File Descriptors
Prevent Too Many Open Files errors when 100+ users leave Thunderbird, Apple Mail, and mobile IMAP IDLE connections open simultaneously.
ulimit -n >= 8192 · ~8 FDs/Account · 150 KB/Idle Socket
Why Each IMAP Client Opens Three to Five Parallel Connections
Desktop clients like Thunderbird and Apple Mail keep separate persistent TCP sockets open for INBOX IDLE, Sent, Drafts, and background folder fetches. Multiply active seats by 4x plus RocksDB SSTable handles when sizing LimitNOFILE.
Tokio Async Epoll Efficiency in Rust
Unlike preforked Dovecot worker processes that consume several megabytes per connection, Stalwart handles thousands of idle TLS sockets inside Tokio epoll loops at roughly 150 KB per connection.
Measured Thresholds & Stalwart Configuration Parameters
| Active Mailboxes | Expected Concurrent Sockets | Minimum systemd LimitNOFILE |
|---|---|---|
| 10 - 25 Mailboxes | 40 - 120 TCP sockets | 4096 |
| 50 - 150 Mailboxes | 200 - 650 TCP sockets | 8192 - 16384 |
| 250 - 1,000 Mailboxes | 1,000 - 4,000 TCP sockets | 32768 - 65536 |