Skip to content
On this page

High Availability

All the methods you've used so far meant to tackle general availability demands. Although this chapter won't cover the exact step, but it will give you a good overview of how you should tackle high-availability demands.

In order for you to achieve high availability, you'll need to try to make your services region-free, meaning make each part of your application independent of the user location.

This is called Edge Computing, when each of the endpoints and the app components are spread around the glob, so there being delivered over the edge.

Good to know

edge = closest physical endpoint to the end-user.

Database

You'll need to use a region-free database. Out of the box Appwrite's supporting MariaDB only, but with a few changes you'll be able to make Appwrite use MySQL or PostgreSQL, both have HA DBaaS.

Storage

Next, You'll need to have a region-free storage. Appwrite let config the storage driver for:

  • Bucket files
  • Function builds
  • Functions deployments.

As of now the available drivers are

CompanyServiceRegion-freeFree egress
AmazonS3
DigitalOceanSpaces
BackblazeCloud Storage
LinodeBlock Storage
WasabiCloud Storage☑️
CloudflareR2 *️ ☑️☑️

* Appwrite doesn't support Cloudflare R2 out-of-the-box yet.

Availability zones

When deploying your Docker Swarm, you should deploy manager across multiple locations and multiple availability zone.

For example, if you're planning to deploy your Swarm in the US and the EU, you should deploy something like this.

toml
[us.west]
[az-1] managers= 1, loadbalancer = 1, workers = 10
[az-3] managers= 2, loadbalancer = 1, workers = 10

[us.east]
[az-1] managers= 2, loadbalancer = 1, workers = 10
[az-3] managers= 1, loadbalancer = 1, workers = 10

[eu.north]
[az-1] managers= 1, loadbalancer = 1, workers = 10
[az-3] managers= 2, loadbalancer = 1, workers = 10

[eu.south]
[az-1] managers= 2, loadbalancer = 1, workers = 10
[az-3] managers= 1, loadbalancer = 1, workers = 10

In case of a Horizontal + Decentralized cluster it's much easier, as follows.

toml
[us.west]
[az-1] loadbalancer = 1, services = 10
[az-3] loadbalancer = 1, services = 10

[us.east]
[az-1] loadbalancer = 1, services = 10
[az-3] loadbalancer = 1, services = 10

[eu.north]
[az-1] loadbalancer = 1, services = 10
[az-3] loadbalancer = 1, services = 10

[eu.south]
[az-1] loadbalancer = 1, services = 10
[az-3] loadbalancer = 1, services = 10

GeoDNS

The last step is to direct your traffic to the nearest available load-balancer, the best way to achieve this is by using GeoDNS service. GeoDNS will route the request for pre-defined* time to the nearest server.

* The pre-defined time is set by your DNS TTL value.

Recommend GeoDNS services:

Rough diagram

Here you can see a diagram that summarized the approach needed to have an HA Appwrite

null