Skip to content

Commit

Permalink
docs: Add some docs on persistence implementaions
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernauer committed Jan 16, 2024
1 parent f4c9cae commit daaa0c4
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ A highly available load balancer with support for queueing, routing and auto-sca
* [Example setups](./docs/example-setups.md)
* [Routing](./docs/routing/index.md)
* [PythonScriptRouter](./docs/routing/PythonScriptRouter.md)
* [Persistence](./docs/persistence/index.md)
* [In-memory](./docs/persistence/in-memory.md)
* [Redis](./docs/persistence/redis.md)
* [Postgres](./docs/persistence/postgres.md)
* [Scaling](./docs/scaling/index.md)
* [Stackable](./docs/scaling/stackable.md)

Expand Down
6 changes: 3 additions & 3 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ This imposes the following requirements on the underlying persistence:

The trait `trino_lb_persistence::Persistence` (think of an interface) allows for multiple persistence implementations. Currently the following implementations are available:

1. **In-memory**: Volatile persistence mainly intended for development or testing purposes.
2. **Redis**: Uses a [Redis Cluster](https://redis.io/docs/management/scaling/) as a distributed key-value store.
3. **Postgres**: **Experimental** We have seen a few queries too much being send to the Trino clusters, probably related to some transactional problems. Also performance measurements are missing.
1. [In-memory](./persistence/in-memory.md): Volatile persistence mainly intended for development or testing purposes.
2. [Redis](./persistence/redis.md): Uses a [Redis Cluster](https://redis.io/docs/management/scaling/) as a distributed key-value store.
3. [Postgres](./persistence/postgres.md): **Experimental**, as performance measurements are missing.

In case you are interested in a implementation for a different persistence please feel free to open an issue or pull request!

Expand Down
17 changes: 17 additions & 0 deletions docs/persistence/in-memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# In-memory persistence

This persistence stores the data in the RAM of the trino-lb server.
This implies all queued and running queries will be lost when trino-lb is restarted.
Additionally, as multiple trino-lb instances do not share their memory, you can not run multiple trino-lb instances for scalability or availability reasons.

Because of these restrictions the in-memory persistence is only recommended for testing purpose.

## Configuration

The configuration of the in-memory persistence is the most simple, as it does not require any configurations and can be configured as follows:

```yaml
trinoLb:
persistence:
inMemory: {}
```
7 changes: 7 additions & 0 deletions docs/persistence/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Persistence

Currently the following persistence implementations are available:

1. [In-memory](./in-memory.md): Volatile persistence mainly intended for development or testing purposes.
2. [Redis](./redis.md): Uses a [Redis Cluster](https://redis.io/docs/management/scaling/) as a distributed key-value store.
3. [Postgres](./postgres.md): **Experimental**, as performance measurements are missing.
20 changes: 20 additions & 0 deletions docs/persistence/postgres.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Postgres persistence

## Configuration

You only need to provide the url the Postgres is available at.
Authentication is supported by providing username and password in the url.

```yaml
trinoLb:
persistence:
postgres:
url: postgres://trino-lb:[email protected]/trino_lb
maxConnections: 10 # optional, defaults to 10
```
## Example installation
The above configuration works with a Postgres installed with the following command:
`helm install postgres bitnami/postgresql --version 13.2.18 --set auth.username=trino-lb,auth.password=trino-lb,auth.database=trino_lb`
20 changes: 20 additions & 0 deletions docs/persistence/redis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Redis persistence

The Redis persistence currently only supports a [Redis Cluster](https://redis.io/docs/management/scaling/) as a distributed key-value store.
A single-instance Redis server is currently not supported but would be an easy addition.

The Redis persistence is the most tested implementation and is currently the recommended choice for production systems.

## Configuration

You only need to provide the endpoint the Redis cluster is available at.
Authentication is supported by providing the password in the endpoint (the username is set to an empty string).

The following configuration connects to the Redis cluster running at `trino-lb-redis-cluster.trino-lb.svc.cluster.local` on Port `6379` secured with the password `redis`.

```yaml
trinoLb:
persistence:
redis:
endpoint: redis://:[email protected]:6379/
```

0 comments on commit daaa0c4

Please sign in to comment.