# Can bitwarden\_rs tolerate being clustered?

**URL:** <https://vaultwarden.discourse.group/t/can-bitwarden-rs-tolerate-being-clustered/713>\
**Category:** Help\
**Created:** [March 11, 2021, 8:41pm UTC](https://vaultwarden.discourse.group/t/can-bitwarden-rs-tolerate-being-clustered/713 "2021-03-11T20:41:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nneul](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/nneul/32/254_2.png) [@nneul](https://vaultwarden.discourse.group/u/nneul)\
**Post date:** [March 11, 2021, 8:41pm UTC](https://vaultwarden.discourse.group/t/can-bitwarden-rs-tolerate-being-clustered/713/1 "2021-03-11T20:41:56Z")

</div>

Level 1:

Will it’s implementation tolerate having two or more instances running against same database (mariadb) for failover purposes, with only a single instance actively serving users (though both running) at same time?

Level 2:

Are it’s internal operations of the server stateless outside of backend database, such that it could tolerate being hit from multiple container instances at the same time? (Assume round-robin or without-warning failover between nodes.)

In both cases, key question is whether any in-memory state is maintained that could be corrupted by having two containers running at same time against same DB?

---

<div class="post-metadata">

**Author:** ![nneul](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/nneul/32/254_2.png) [@nneul](https://vaultwarden.discourse.group/u/nneul)\
**Post date:** [March 11, 2021, 8:54pm UTC](https://vaultwarden.discourse.group/t/can-bitwarden-rs-tolerate-being-clustered/713/2 "2021-03-11T20:54:44Z")

</div>

Found this, so looks like that answers my question:

> [@Is the bitwarden rs service stateless if its using postgres backend?](https://vaultwarden.discourse.group/t/is-the-bitwarden-rs-service-stateless-if-its-using-postgres-backend/450):
>
> I’m deploying on Kubernetes. I was hoping to deploy the Bitwarden server in a deployment with 3 replicas and then have a single stateful state postgres instance with an open ebs volume. Do bitwarden rs instance have any state to worry about if the postgres db is not colocated? One reason I ask is because the docs point at this setup as an example: [https://github.com/icicimov/kubernetes-bitwarden\_rs/blob/7b6c0d49f9c5f5c6b7fce31a2a97bca9df8d0d25/statefulset.yml#L2-L3](https://github.com/icicimov/kubernetes-bitwarden_rs/blob/7b6c0d49f9c5f5c6b7fce31a2a97bca9df8d0d25/statefulset.yml#L2-L3) p.s … Just setting the postg…

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [March 11, 2021, 9:06pm UTC](https://vaultwarden.discourse.group/t/can-bitwarden-rs-tolerate-being-clustered/713/3 "2021-03-11T21:06:33Z")

</div>

My answer on that post you refer to still applies.  
So, in short, yes it could work with some caveats to keep in mind.

- Attachments probably need to be on some shared storage. (Same goes for icons etc…)
- The rsa key’s used for the JWT need to be shared.
- Websockets will not work fully if using round-robin.
