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

feat: Support pgzip as an alternative (de)compression implementation #5108

Merged
merged 4 commits into from Feb 16, 2021
Merged

feat: Support pgzip as an alternative (de)compression implementation #5108

merged 4 commits into from Feb 16, 2021

Conversation

terrytangyuan
Copy link
Member

For relatively large workflows, using pgzip to parallelize the (de)compression would greatly speed up the (de)hydration process, especially when the size overhead during compression can be neglected.

Signed-off-by: terrytangyuan terrytangyuan@gmail.com

Checklist:

go.mod Show resolved Hide resolved
go.mod Show resolved Hide resolved
"k8s.io/utils/env"
)

var gzipImpl = env.GetString(GZipImplEnvVarKey, PGZIP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know about this library - neat

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea it's super fast and works great for large workflows.

@@ -63,23 +73,52 @@ func DecodeDecompressString(content string) (string, error) {
return string(dBuf), nil
}

type GZipWriter interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this the same interface as io.Writer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not since io.Writer does not implement Close(). However I just found io.WriteCloser which is exactly what I needed. Just switched.

util/file/fileutil.go Outdated Show resolved Hide resolved
util/file/fileutil.go Outdated Show resolved Hide resolved
util/file/fileutil.go Outdated Show resolved Hide resolved
Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
case GZIP:
gzipReader, err = gzip.NewReader(buf)
default:
log.Infof("%s implementation for decompression is not supported. Fallback to PGZip.", gzipImpl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this logging - not needed

gzipReader, err = pgzip.NewReader(buf)
}
if err != nil {
log.Warnf("Error in decompressing: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this logging

}
if err != nil {
log.Warnf("Error in decompressing: %v", err)
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Errorf("failed to decompress: %w", err)

case GZIP:
gzipWriter = gzip.NewWriter(&buf)
default:
log.Infof("%s implementation for compression is not supported. Fallback to PGZip.", gzipImpl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this logging

Signed-off-by: terrytangyuan <terrytangyuan@gmail.com>
@alexec alexec merged commit b1535e5 into argoproj:master Feb 16, 2021
@terrytangyuan terrytangyuan deleted the zip-impl branch February 16, 2021 21:49
@simster7 simster7 mentioned this pull request Feb 23, 2021
34 tasks
@simster7 simster7 mentioned this pull request Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants