1. Question
2. Answer
Step 1: Estimating Memory Usage per XMPP User
An XMPP user’s memory consumption depends on:
- Base memory overhead of the XMPP server (Prosody).
- Memory used per XMPP connection (message handling, presence updates, and session state).
- TLS overhead per connection.
Memory Estimates
- Prosody Base Memory: ~50MB (idle)
- Memory per Active XMPP Client:
- Base connection overhead: 3MB
- Active message processing, presence updates, TLS buffers: 2MB
- Total per user: ~5MB per active connection
Step 2: Available Memory and Maximum Users (No Web Client Used)
System Memory Usage
- Total RAM: 2GB = 2048MB
- OS (Alpine Linux) + System Services: ~100MB
- Prosody (base usage): ~50MB
- Other services (logs, networking, security, etc.): ~100MB
- Available for XMPP traffic:
Max Users (No Web Client)
Step 3: Available Memory and Maximum Users (With Web Client Used)
The Movim web client is a PHP-based XMPP client running on a web server (e.g., Nginx + PHP-FPM).
Memory Overhead for Movim
- Nginx + PHP backend: 200MB
- Per-user PHP-FPM session: 10MB per user
- Prosody (base usage): 50MB
Available Memory for XMPP with Web Client
Each web client user also consumes 5MB for XMPP, so total per-user memory usage is:
Max Users (With Web Client)
Step 4: Bandwidth Considerations (Including TLS Overhead)
Your server has 150 Mbit/sec (18.75 MB/sec) available.
Estimating Per-User Bandwidth Consumption
- Baseline XMPP text traffic: ~25 Kbit/sec per user (~3.125 KB/sec).
- TLS overhead: ~20% extra for encryption.
- Adjusted per-user bandwidth:
Max Users Based on Bandwidth
Bandwidth is not a bottleneck, as RAM limits the number of users long before reaching the bandwidth cap.
Step 5: Considering Spikes in Usage
- Peak Traffic Scenarios:
- Spikes in presence updates or burst message sending can temporarily increase bandwidth per user to ~50 Kbit/sec.
- In this case, max bandwidth capacity drops to 3000 users, which is still well above the RAM-imposed limits.
- TLS Session Resumption & Reconnects:
- When many users reconnect simultaneously, TLS handshakes may spike CPU usage rather than memory or bandwidth.
- This might require limiting reconnect rates in the server config.
Final Results Summary
Scenario | Available RAM for XMPP | Max Users (RAM) | Max Users (Bandwidth) | Actual Limit |
---|---|---|---|---|
No Web Client | 1798MB | ~359 | ~5000 | ~359 (RAM-limited) |
With Web Client | 1598MB – 10N | ~106 | ~5000 | ~106 (RAM-limited) |
Conclusion
- RAM is the limiting factor, not bandwidth.
- The server can support ~359 XMPP users when using external XMPP clients.
- With Movim web clients, this drops to ~106 users due to PHP-FPM overhead.
- TLS overhead slightly increases bandwidth but does not significantly impact user capacity.
Would you like me to consider any additional factors, such as CPU constraints or optimizations?