OpenMLS provides a high-performance implementation of the MLS protocol, but optimal performance depends on how you configure and use the library. This guide covers key optimization strategies.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/openmls/openmls/llms.txt
Use this file to discover all available pages before exploring further.
Choose the right ciphersuite
Ciphersuite selection significantly impacts performance. OpenMLS supports multiple ciphersuites with different performance characteristics:Optimize key package generation
Key package creation is a common operation that can be optimized:Pre-generating key packages allows you to respond quickly to new group invitations without blocking on cryptographic operations.
Group size considerations
Performance characteristics change with group size. Consider these factors:Small groups (2-10 members)
- Commit operations are fast (typically < 10ms)
- Message encryption/decryption is minimal overhead
- Updates propagate quickly
Medium groups (10-100 members)
- Commit creation time scales with group size
- Consider batching member additions when creating groups
- Monitor ratchet tree depth and balance
Large groups (100+ members)
- Use
PURE_PLAINTEXT_WIRE_FORMAT_POLICYfor better performance if your transport provides encryption - Batch operations when possible
- Consider the tree state when optimizing update frequency
Tree state optimization
The ratchet tree’s state affects performance:Fresh tree after creation
Fresh tree after creation
Operations are fastest immediately after group creation when the tree is fully balanced and all members have just joined.
After many updates
After many updates
A tree where many members have sent updates may have different performance characteristics. Consider the update frequency in your application.
Blank nodes
Blank nodes
Trees with many blank nodes (after member removals) may impact performance. Large-scale removals followed by additions can help rebalance the tree.
Storage provider selection
Your choice of storage provider impacts I/O performance:Memory storage
Fastest for testing and development. No persistence.
SQLite storage
Good balance of performance and persistence for most applications.
Commit and update strategies
Batching operations
When adding multiple members, batch them in a single commit:Update frequency
Balance security and performance when deciding update frequency:Evaluate your threat model
Determine how often you need forward secrecy updates based on your security requirements.
Monitor group activity
Send updates based on message count or time intervals that make sense for your application.
Message processing
Optimize how you process incoming messages:Crypto provider selection
OpenMLS supports multiple crypto providers with different performance profiles:Monitoring and profiling
Measure performance in your specific context:Use Rust’s built-in benchmarking tools or Criterion.rs to establish performance baselines for your application.
Common scenarios
Stable groups
For groups with infrequent membership changes:- Optimize for message encryption/decryption speed
- Send periodic updates based on message count (e.g., every 1000 messages)
- Pre-generate key packages for potential new members
High-fluctuation groups
For groups with frequent joins and leaves (e.g., public channels):- Batch membership changes when possible
- Consider shorter update intervals to keep tree balanced
- Monitor tree blank node ratio
- Use efficient storage backend for high write volume
Long-offline devices
When devices may process many messages after being offline:- Process messages in batches if your protocol allows
- Consider maximum catchup limits
- Implement efficient message queuing
Next steps
Benchmarks
See detailed benchmark results and methodology.
API reference
Explore the complete OpenMLS API.