r/mongodb • u/nhrtrix • 3h ago
I measured a 1,000-database test-data setup with MongoDB and KryptonDB
Disclosure: we built KryptonDB. It’s a local, in-memory database that speaks the MongoDB wire protocol for a documented subset
we built it for tests and coding agents that need separate databases seeded with the same data. Its forkDatabase command is a KryptonDB extension, not a MongoDB command.
we attached a short video of a memory comparison. I ran both servers on the same Linux host, with a fresh server process for each run. MongoDB got a new, empty data directory each time; I recorded its baseline before adding user data.
for the workload, each server received the same 10,000 documents, then held 1,000 databases containing that seed. I read one document from each database and inserted 10 new documents into each of 100 databases.
MongoDB used $out to make full collection copies. KryptonDB made copy-on-write branches from the seed.
Median process-tree PSS across three runs:
- Empty server: MongoDB
161.27 MiBvs KryptonDB9.89 MiB - 1,000 databases: MongoDB
1.62 GiBvs KryptonDB22.49 MiB - After one read per database: MongoDB
1.63 GiBvs KryptonDB23.20 MiB - After the inserts: MongoDB
1.63 GiBvs KryptonDB24.02 MiB - Idle CPU after database creation:
2.40%vs0.10%of one core, measured over 10 seconds with no client connected
the copy methods differ, and the memory numbers are process-tree PSS for this host and workload, PSS does not measure all host page cache or MongoDB’s full on-disk data.
other MongoDB copy or storage setups may produce different results.
KryptonDB is for disposable local development and test data. It supports a subset of MongoDB behavior, does not clone a live MongoDB deployment, and is not a MongoDB or Atlas replacement.
its default in-memory data is cleared when the server stops, it has no authentication or TLS, so I keep it bound to loopback.
for those running MongoDB-backed tests, how do you give each worker its own seeded data today?
what would you want validated before trying a local branch workflow?