Bundle download limit?

356 views Asked by At

encountering a bit of an issue that I would need to find a work around for. OPA Engine version is 0.23.2 and I am trying to download a bundle, but I am getting the following error message "Bundle download failed: bundle exceeded max size (1073741824 bytes)"

1

There are 1 answers

4
Patrick East On

The 1GB limit is hard coded (as of now) https://github.com/open-policy-agent/opa/blob/63560e0d1e767a8c973bfa217d3c734adea6d5f7/bundle/bundle.go#L42

Keep in mind that 1GB of gzipped json data is likely to use a significant amount of memory when uncompressed and loaded into memory. To give some context on why that limit is there... Rule of thumb is that its something like 20x from raw JSON -> golang/opa data structures in memory, and the gzip compression varies more but I think a 5:1 ratio is pretty reasonable. Napkin math on that works out to like 100GB of memory for OPA to load a 1GB bundle (1520). It is unlikely that most OPA use-cases would be able/want to have that happen, hence the error.

EDIT: That 1GB limit turns out to not be for the compressed bundle size but instead for the uncompressed JSON files. So the memory expansion isn't as big of a ceiling (however the example above still hold true for a 1GB compressed sized bundle)

I would recommend filing an issue, it seems like we could probably expose a config option to increase the limit for use-cases where the memory usage is acceptable (lower ratio for gzip, less overhead on the structures, etc.. depends on the JSON data)