Stalwart Mail Server offers support for multiple database and storage backends. The choice of backend depends primarily on the scale and distribution of your mail server setup.
RocksDB is an embeddable, high performance, and persistent key-value store originally built by Facebook. It is particularly well-suited for storing data on fast storage devices, such as SSDs. With its efficient use of CPU and RAM, RocksDB is designed for fast data retrieval, making it a popular choice for various applications.
FoundationDB is a distributed database designed to handle large volumes of data across a network of machines. It combines the power of ACID (Atomicity, Consistency, Isolation, Durability) transactions with the scalability of NoSQL databases. FoundationDB is engineered to provide high performance, fault tolerance, and easy scalability, making it an ideal choice for distributed systems.
PostgreSQL, often known simply as Postgres, is a powerful, open-source object-relational database system. It is highly respected for its proven architecture, reliability, data integrity, robust feature set, and extensibility. PostgreSQL is designed to handle a range of workloads, from single machines to data warehouses or Web services with many concurrent users.
📄️ MySQL / MariaDB
MySQL is a widely used open-source relational database management system (RDBMS). It is renowned for its reliability, simplicity, and compatibility with various platforms and programming languages. MySQL is designed to efficiently manage large volumes of data, making it a popular choice for web applications and online transaction processing.
SQLite is a self-contained, serverless, and zero-configuration database engine, making it simple to manage. It is typically suited for small installations operating on a single nodes, owing to its simplicity and reliability for such setups. For redundancy, SQLite's data can be replicated using external solutions such as Litestream, which provides continuous replication of SQLite databases.
For distributed and larger-scale implementations, Stalwart Mail Server supports the use of S3-compatible storage services. S3, or Simple Storage Service, is a scalable object storage protocol used by many cloud providers. By using an S3-compatible service, Stalwart can store emails and blobs on remote servers, facilitating large-scale storage management, easy data replication, and backup, making it a viable option for businesses seeking robustness and scalability.
For single-node installations, Stalwart Mail Server supports storing emails and blobs on the local filesystem. This is done using a hashed directory structure, which is designed to prevent filesystem slowdowns when storing large numbers of files in a single directory.
Elasticsearch is a powerful, open-source, distributed search and analytics engine. It is built on Apache Lucene and is designed to handle a wide variety of data types, including textual, numerical, geospatial, structured, and unstructured data. Elasticsearch is known for its high scalability, real-time search capabilities, and ease of use. This makes it a flexible and robust solution for managing complex and large-scale data in various applications.
Redis (Remote Dictionary Server) is an in-memory data structure store, used as a database, cache, and message broker. It supports various data structures such as strings, hashes, lists, sets, and sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence. It's known for its high performance, flexibility, and a wide array of features.
The in-memory lookup store is a static key value store that is kept entirely in memory. They are defined directly in the configuration file and are useful for storing small amounts of static data that do not change often.