Repository navigation
Thinking about ~1M small banks (one per user) on open-source Hindsight – where would you start? #6248
Replies: 1 comment
|
I haven't run 500K+ banks myself, so this is from reading the code, not from experience. But there is one concrete wall to know about, and a setting that moves it. By default, every bank gets its own vector indexes the moment it is created. Banks share one At 1M banks that would be about 3M indexes on one table. The code comments say what that costs. Each index is enumerated and locked at plan time by queries from every other bank, and opened by every write to the table. A small bank's index never repays that, because the hindsight/hindsight-api-slim/hindsight_api/_vector_index.py Lines 256 to 271 in bc5ea19 So the first thing I would do is set With per-user banks of a few hundred or thousand memories, most banks would then never get an index, and that is the intended path for small banks. On the second question, I'd plan for several Hindsight instances, each with its own Postgres, behind a router that maps user ID to shard. Even with the setting above, every bank's rows still land in one shared There is also a tenant-schema mechanism in the codebase (the admin CLI has Practical test plan: create a few hundred thousand synthetic banks with the threshold set, retain a small number of memories into each, then measure recall latency for a random bank while a background writer is active. If recall latency grows with total bank count, shard sooner. (I looked this up in the code with help from an AI assistant; the links are to the lines I checked.) |
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
First, thank you for Hindsight. I've spent the last few days reading the docs, the release notes and the Memlake write-up.
I'm working on a B2C product where every user gets their own memory. That means one bank per user, and a lot of users: I'm planning for somewhere between 500K and 1M. Each bank would stay small, just one person's memories over time. Isolation between users matters a lot to me, and so does time (knowing what happened and when).
I'm only looking at the open-source version, on Postgres. I did notice that the Enterprise side has answers for scaling on the number of memories, and that's great, but it's not my situation. My challenge is the opposite: not huge banks, but a huge number of tiny ones. I don't have the budget for Enterprise right now. What I do have is time, and I'm ok to build and test things myself.
So my question is a pretty open one: what would you put around Hindsight to get to 500K–1M banks?
A few things I'm wondering about, in case they help frame it:
Even a partial answer or a "don't do this" would help me a lot. If I end up building something, I'd be glad to write up what I learn and share it here.
All reactions