Inconsistent results for activeOrder query in a horizontally-scaling environment #2851
-
Hi everyone, I was stumbling over a weird issue, where I'd be happy to get some deeper insights into how Vendure works internally: My Vendure backend is deployed with horizontal scaling (meaning there are at least 2 completely separate Vendure instances running for redundancy) on AWS. All caching is disabled, meaning all GraphQL requests represent real-time data from Vendure. The storefront adds items to the cart, using the bearer token-based authentication, which works fine. After adding items to the cart, if I execute the Now my only guess is that, given the backend is scaled horizontally, the request sometimes ends on instance A and sometimes on instance B. And although afaik there shouldn't be a difference, as the DB is the same for both instances, I was wondering if there is something happening directly on the instance that might lead to this behavior. Maybe someone with deeper insights into the Vendure core could shed some light on this. My assumption might be totally wrong and the reason is something completely different, but at the moment it's the only idea I have left. :-/ Thanks for some input and help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, you are running into the fact that by default the session cache is in-memory. This is covered here: https://docs.vendure.io/guides/deployment/horizontal-scaling#multi-instance-configuration |
Beta Was this translation helpful? Give feedback.
Hi, you are running into the fact that by default the session cache is in-memory. This is covered here: https://docs.vendure.io/guides/deployment/horizontal-scaling#multi-instance-configuration