huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
242 stars 80 forks source link

Tenants watch triggers update of all tenants on a single tenant update #7102

Open RafaPolit opened 3 months ago

RafaPolit commented 3 months ago

Describe the bug The current Tenant implementation loads in memory all tenants in the shared tenant DB.

There is a watch that reloads ALL tenants to DB upon any tenant update.

Our current manager creates tenant logs and usage statistics which is triggering this update in sequence for all tenants, creating a large network bottleneck that is not scalable as more tenants and more backend servers would eventually bring back the problem of memory run that was fixed by only fetching the required data.

We need to improve on this implementation to just update the updated tenants or not rely on tenants-in-memory at all.