spicedb
spicedb copied to clipboard
Set debug.SetMemoryLimit based on Kubernetes environment
SpiceDB often runs in memory constrained environments. We should set the soft memory limit based on how much memory the container that we're running in has.
https://pkg.go.dev/runtime/debug@master#SetMemoryLimit
Searched GitHub to see how folks were using this, to try and see if there was a library that looked into cgroups and called this function. I did not find anything that accomplished that, but I did discover how TiDB is tuning the runtime with that call: https://pkg.go.dev/github.com/pingcap/tidb/util/gctuner?utm_source=godoc
We can close this now that we are using GOMEMLIMIT