Repository navigation
Conversation
78f710b to
c2a0e14
Compare
reltuk
left a comment
There was a problem hiding this comment.
I'm a little skeptical of making this configurable from an environment variable. I know we did a similar thing with commit cache, but that was because we were going from small -> large for a particular use case and we wanted to build an escape hatch if we critically regressed anyone.
In general the node cache and the sizecache on ValueStore are a pretty big wart, not least of all because they aren't configurable on a per-server or per-database level, as you've rightly pointed out here here with this PR.
We are certainly interested in making Dolt work better in low memory environments and we are ammenable to changes which move us in that direction. I worry that these specific env variables might be too tightly coupled to the existing caches and discovering and appropriately setting them is an experts task which we have little bandwidth to support in general.
What do you think about a different approach where we do one of the following:
- Gracefully scale these caches from some minimum size to their existing defaults based on existing configured GOMEMLIMITs. Pairs nicely with #10813.
- Bimodally choose between some small limit and the existing default based on GOMEMLIMIT.
- Have a generic boolean-optioned env var which configures smaller defaults for these and potentially other caches in the future. DOLT_LOWMEM=, for example.
- Like 3, but that variable is enum-valued or float-valued. Float-valued selects a point on a linear scale from min-to-max for these and other similar sized caches. enum-valued picks fixed sizes at each point for various classes of requested constrained memory utilization.
|
@reltuk thanks for taking a look! I think I'll close these env var PRs in favor of this approach based on your feedback: #10820 what do you think? it should scale gracefully based on GOMEMLIMIT, based on the ratios that were already implemented. additional configuration probably makes sense for followup, but maybe it makes sense to just give a tuner where you can set the ratio of reserved memory to favor node cache for reads and memtable for writes? |
|
closing in favor of #10820 |
|
to make it easier since there are already a few PRs, i created an issue to track the concept |
The prolly tree node cache is hardcoded at 256 MiB and is the dominant memory consumer in Dolt. This makes it configurable via the
DOLT_NODE_CACHE_SIZEenvironment variable, following the exact same pattern as the existingDOLT_COMMIT_CACHE_SIZEenv var.For memory-constrained deployments (containers, small VMs), setting
DOLT_NODE_CACHE_SIZE=33554432(32 MiB) significantly reduces RSS with minimal performance impact for small datasets.No default behavior change — without the env var, cache remains 256 MiB.
go/store/prolly/tree/node_store.go—const cacheSizechanged tovar,init()reads env vargo/libraries/doltcore/dconfig/envvars.go—EnvNodeCacheSizeconstantgo/store/prolly/tree/node_cache_test.go— tests for valid, invalid, zero, and negative values