Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to write state using compact representation #35175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexott
Copy link
Contributor

@alexott alexott commented May 17, 2024

This PR allows to write JSON using compact (non-indented) representation if the TF_USE_COMPACT_STATE_FORMAT environment variable is defined. This significantly improves performance when working with huge states.

For example (on ~450k objects in the state):

  • state size is decreased from 510.1MB to 386.6MB
  • Time to write to S3 decreased from 112 seconds to 94 seconds
  • Time to read from S3 decreased from 87 seconds -> 55 seconds

Fixes #35174

Target Release

1.8.x

Draft CHANGELOG entry

NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES | EXPERIMENTS

This PR allows to write JSON using compact (non-indented) representation if the
`TF_USE_COMPACT_STATE_FORMAT` environment variable is defined.  This significantly
improves performance when working with huge states.

For example (on ~450k objects in state):

* state size is decreased from 510.1MB to 386.6MB
* Time to write to S3 decreased from 112 seconds to 94 seconds
* Time to read from S3 decreased from 87 seconds -> 55 seconds

Fixes hashicorp#35174

Signed-off-by: Alex Ott <alexott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pretty-printed JSON representation of a state increases file size by ~20-25%
2 participants