Back

How we can scale on the redis side ?

  • 0
  • Self Hosted
  • Databases
  • General
debug
19 Mar, 2025, 09:13

On my instance, i have really tons of request made each second (see pictures, the blue is because my boss want enterprise color everywhere...)

My problem is that i am bottleneck by the redis, i have tried to setup the redis as a clustered one but it does not seems to work.

Currently i have 2 vps 16vcore and 16go RAM, i would like to scale to be able to take more.

My base idea was to setup the redis as a cluster + the mariadb on one of the VPS and appwrite on the other one.

@D5 here the post

TL;DR
Developers are discussing how to scale on the Redis side, specifically regarding support for the brpop command. It seems that the proxy being used does not fully support Redis cluster operations, leading to errors. The issue might be related to the lack of native Redis cluster support in appwrite/utopia, causing errors like "MOVED" and hindering performance under high load. One suggested solution is to use Twemproxy or Envoy proxy. The developer is considering setting up Redis as a cluster to improve scalability and reduce bottlenecks.
D5
19 Mar, 2025, 09:16

Are you setting a password for the Redis cluster?

debug
19 Mar, 2025, 09:16

No, as we discuss previously you not support password on redis

D5
19 Mar, 2025, 09:17

Also, congratulations. If that's not a DDoS and real/valid requests 🙂

D5
19 Mar, 2025, 09:17

Okay, what error are you getting?

debug
19 Mar, 2025, 09:20
TypeScript
appwrite  | Fatal error: Uncaught RedisException: MOVED 5994 172.18.0.4:7001 in /usr/src/code/vendor/utopia-php/cache/src/Cache/Adapter/Redis.php:39
appwrite  | Stack trace:
appwrite  | #0 /usr/src/code/vendor/utopia-php/cache/src/Cache/Adapter/Redis.php(39): Redis->hGet('default-cache-_...', 'default-cache-_...')
appwrite  | #1 /usr/src/code/vendor/utopia-php/cache/src/Cache/Adapter/Sharding.php(55): Utopia\Cache\Adapter\Redis->load('default-cache-_...', 86400, 'default-cache-_...')
appwrite  | #2 /usr/src/code/vendor/utopia-php/cache/src/Cache/Cache.php(49): Utopia\Cache\Adapter\Sharding->load('default-cache-_...', 86400, 'default-cache-_...')
appwrite  | #3 /usr/src/code/vendor/utopia-php/database/src/Database/Database.php(2925): Utopia\Cache\Cache->load('default-cache-_...', 86400, 'default-cache-_...')
appwrite  | #4 /usr/src/code/vendor/utopia-php/database/src/Database/Database.php(1283): Utopia\Database\Database->getDocument(Object(Utopia\Database\Document), 'audit')
appwrite  | #5 /usr/src/code/vendor/utopia-php/database/src/Database/Database.php(495): Utopia\Database\Database->Utopia\Database\{closure}()
appwrite  | #6 /usr/src/code/vendor/utopia-php/database/src/Database/Database.php(1283): Utopia\Database\Database->silent(Object(Closure))
appwrite  | #7 /usr/src/code/app/http.php(198): Utopia\Database\Database->getCollection('audit')
appwrite  | #8 [internal function]: {closure}()
appwrite  | #9 {main}
appwrite  |   thrown in /usr/src/code/vendor/utopia-php/cache/src/Cache/Adapter/Redis.php on line 39
debug
19 Mar, 2025, 09:23

Sorry, i'm more on the dev side than the admin system side, its the first time i have this kind of problem.

D5
19 Mar, 2025, 09:25

From what I understand, appwrite/utopia doesn't support natively Redis cluster so that's why it throws that error.

D5
19 Mar, 2025, 09:25

Alternatively you will need to use a proxy

D5
19 Mar, 2025, 09:27

Like twemproxy

D5
19 Mar, 2025, 09:27

So it acts as a single Redis instance, but it's actually a cluster

debug
19 Mar, 2025, 09:28

How do you scale on your side I have tried twemproxy but it does not support brpop command. And appwrite seems to use this kind of redis command

D5
19 Mar, 2025, 09:33

Well, I didn't need to scale it horizontally yet. Cloud needed it, but no idea how they handle it.

From what I understand they use a proxy.

Maybe you can try envoy proxy?

debug
19 Mar, 2025, 09:36

i will retry twemproxy, maybe i have not configured it correctly, if its possible could you ask how the cloud version scale ?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more