mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
3ea21273bc
* Try Ristretto cache * Tweak * It's beautiful * Update GMSL * More strict keyable interface * Fix that some more * Make less panicky * Don't enforce mutability checks for now * Determine mutability using deep equality * Tweaks * Namespace keys * Make federation caches mutable * Update cost estimation, add metric * Update GMSL * Estimate cost for metrics better * Reduce counters a bit * Try caching events * Some guards * Try again * Try this * Use separate caches for hopefully better hash distribution * Fix bug with admitting events into cache * Try to fix bugs * Check nil * Try that again * Preserve order jeezo this is messy * thanks VS Code for doing exactly the wrong thing * Try this again * Be more specific * aaaaargh * One more time * That might be better * Stronger sorting * Cache expiries, async publishing of EDUs * Put it back * Use a shared cache again * Cost estimation fixes * Update ristretto * Reduce counters a bit * Clean up a bit * Update GMSL * 1GB * Configurable cache sizees * Tweaks * Add `config.DataUnit` for specifying friendly cache sizes * Various tweaks * Update GMSL * Add back some lazy loading caching * Include key in cost * Include key in cost * Tweak max age handling, config key name * Only register prometheus metrics if requested * Review comments @S7evinK * Don't return errors when creating caches (it is better just to crash since otherwise we'll `nil`-pointer exception everywhere) * Review comments * Update sample configs * Update GHA Workflow * Update Complement images to Go 1.18 * Remove the cache test from the federation API as we no longer guarantee immediate cache admission * Don't check the caches in the renewal test * Possibly fix the upgrade tests * Update to matrix-org/gomatrixserverlib#322 * Update documentation to refer to Go 1.18
108 lines
5.5 KiB
Markdown
108 lines
5.5 KiB
Markdown
---
|
|
title: Planning your installation
|
|
parent: Installation
|
|
nav_order: 1
|
|
permalink: /installation/planning
|
|
---
|
|
|
|
# Planning your installation
|
|
|
|
## Modes
|
|
|
|
Dendrite consists of several components, each responsible for a different aspect of the Matrix protocol.
|
|
Users can run Dendrite in one of two modes which dictate how these components are executed and communicate.
|
|
|
|
* **Monolith mode** runs all components in a single process. Components communicate through an internal NATS
|
|
server with generally low overhead. This mode dramatically simplifies deployment complexity and offers the
|
|
best balance between performance and resource usage for low-to-mid volume deployments.
|
|
|
|
* **Polylith mode** runs all components in isolated processes. Components communicate through an external NATS
|
|
server and HTTP APIs, which incur considerable overhead. While this mode allows for more granular control of
|
|
resources dedicated toward individual processes, given the additional communications overhead, it is only
|
|
necessary for very large deployments.
|
|
|
|
Given our current state of development, **we recommend monolith mode** for all deployments.
|
|
|
|
## Databases
|
|
|
|
Dendrite can run with either a PostgreSQL or a SQLite backend. There are considerable tradeoffs
|
|
to consider:
|
|
|
|
* **PostgreSQL**: Needs to run separately to Dendrite, needs to be installed and configured separately
|
|
and and will use more resources over all, but will be **considerably faster** than SQLite. PostgreSQL
|
|
has much better write concurrency which will allow Dendrite to process more tasks in parallel. This
|
|
will be necessary for federated deployments to perform adequately.
|
|
|
|
* **SQLite**: Built into Dendrite, therefore no separate database engine is necessary and is quite
|
|
a bit easier to set up, but will be much slower than PostgreSQL in most cases. SQLite only allows a
|
|
single writer on a database at a given time, which will significantly restrict Dendrite's ability
|
|
to process multiple tasks in parallel.
|
|
|
|
At this time, we **recommend the PostgreSQL database engine** for all production deployments.
|
|
|
|
## Requirements
|
|
|
|
Dendrite will run on Linux, macOS and Windows Server. It should also run fine on variants
|
|
of BSD such as FreeBSD and OpenBSD. We have not tested Dendrite on AIX, Solaris, Plan 9 or z/OS —
|
|
your mileage may vary with these platforms.
|
|
|
|
It is difficult to state explicitly the amount of CPU, RAM or disk space that a Dendrite
|
|
installation will need, as this varies considerably based on a number of factors. In particular:
|
|
|
|
* The number of users using the server;
|
|
* The number of rooms that the server is joined to — federated rooms in particular will typically
|
|
use more resources than rooms with only local users;
|
|
* The complexity of rooms that the server is joined to — rooms with more members coming and
|
|
going will typically be of a much higher complexity.
|
|
|
|
Some tasks are more expensive than others, such as joining rooms over federation, running state
|
|
resolution or sending messages into very large federated rooms with lots of remote users. Therefore
|
|
you should plan accordingly and ensure that you have enough resources available to endure spikes
|
|
in CPU or RAM usage, as these may be considerably higher than the idle resource usage.
|
|
|
|
At an absolute minimum, Dendrite will expect 1GB RAM. For a comfortable day-to-day deployment
|
|
which can participate in federated rooms for a number of local users, be prepared to assign 2-4
|
|
CPU cores and 8GB RAM — more if your user count increases.
|
|
|
|
If you are running PostgreSQL on the same machine, allow extra headroom for this too, as the
|
|
database engine will also have CPU and RAM requirements of its own. Running too many heavy
|
|
services on the same machine may result in resource starvation and processes may end up being
|
|
killed by the operating system if they try to use too much memory.
|
|
|
|
## Dependencies
|
|
|
|
In order to install Dendrite, you will need to satisfy the following dependencies.
|
|
|
|
### Go
|
|
|
|
At this time, Dendrite supports being built with Go 1.18 or later. We do not support building
|
|
Dendrite with older versions of Go than this. If you are installing Go using a package manager,
|
|
you should check (by running `go version`) that you are using a suitable version before you start.
|
|
|
|
### PostgreSQL
|
|
|
|
If using the PostgreSQL database engine, you should install PostgreSQL 12 or later.
|
|
|
|
### NATS Server
|
|
|
|
Monolith deployments come with a built-in [NATS Server](https://github.com/nats-io/nats-server) and
|
|
therefore do not need this to be manually installed. If you are planning a monolith installation, you
|
|
do not need to do anything.
|
|
|
|
Polylith deployments, however, currently need a standalone NATS Server installation with JetStream
|
|
enabled.
|
|
|
|
To do so, follow the [NATS Server installation instructions](https://docs.nats.io/running-a-nats-service/introduction/installation) and then [start your NATS deployment](https://docs.nats.io/running-a-nats-service/introduction/running). JetStream must be enabled, either by passing the `-js` flag to `nats-server`,
|
|
or by specifying the `store_dir` option in the the `jetstream` configuration.
|
|
|
|
### Reverse proxy (polylith deployments)
|
|
|
|
Polylith deployments require a reverse proxy, such as [NGINX](https://www.nginx.com) or
|
|
[HAProxy](http://www.haproxy.org). Configuring those is not covered in this documentation,
|
|
although a [sample configuration for NGINX](https://github.com/matrix-org/dendrite/blob/main/docs/nginx/polylith-sample.conf)
|
|
is provided.
|
|
|
|
### Windows
|
|
|
|
Finally, if you want to build Dendrite on Windows, you will need need `gcc` in the path. The best
|
|
way to achieve this is by installing and building Dendrite under [MinGW-w64](https://www.mingw-w64.org/).
|