Skip to content

[SPARK-19112][CORE] add codec for ZStandard - #17303

Closed
dongjinleekr wants to merge 1 commit into
apache:masterfrom
dongjinleekr:feature/SPARK-19112
Closed

[SPARK-19112][CORE] add codec for ZStandard#17303
dongjinleekr wants to merge 1 commit into
apache:masterfrom
dongjinleekr:feature/SPARK-19112

Conversation

@dongjinleekr

@dongjinleekrdongjinleekr commented Mar 15, 2017

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Hadoop & HBase started to support ZStandard Compression from their recent releases. This update enables saving a file in HDFS using ZStandard Codec, by implementing ZStandardCodec. It also requires adding a new configuration for default compression level, for example, 'spark.io.compression.zstandard.level.'

How was this patch tested?

3 additional unit tests in CompressionCodecSuite.scala.

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@srowen

Copy link
Copy Markdown
Member

Same questions from last PR -- can this be something the user includes if needed or is there value in integrating it into Spark? where would it come into play and with what versions of Hadoop et al?

@tgravescs

Copy link
Copy Markdown
Contributor

this should not be needed just to use to write to hdfs. The regular hadoop input/output type formats have support for it if you are using the right version (I think hadoop 2.8).

This seems to be adding the support to the spark.io.compression.codec for internal compression. From what I've heard zstd is better then the other codecs since it gives Gzip level Compression with Lz4 level CPU usage. So if you have a job that had a ton of intermediate data or was causing network issues you may want to use ztsd to get the gzip compression levels without much cpu penalty.

@dongjinleekr It doesn't looks like you ran any manual tests on a real cluster? It would be nice to have some basic performance/compression numbers to show it actually working. Are you planning on actually using zstd in your spark deployment?

@rxin

rxin commented Mar 15, 2017

Copy link
Copy Markdown
Contributor

Yes it'd be nice to have some benchmark on this.

@maropu

maropu commented Apr 28, 2017

Copy link
Copy Markdown
Member

I did quick benchmarks by using a TPCDS query (Q4) (I just referred the previous work in #10342)
Based on the result, it seems it's a bit earlier to implement this?;

scaleFactor: 4
AWS instance: c4.4xlarge -- zstd
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 53.315878375s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 53.468174668s
Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 57.282403146s -- lz4
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 20.779643053s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 16.520911319s
Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 15.897124967s
-- snappy
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 21.132412036999998s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 15.908867743999998s Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 15.789648712s
-- lzf
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 21.339518781s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 16.881225328s Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 15.813455479s

@srowen

Copy link
Copy Markdown
Member

OK, seems like we should close this.

class ZStandardCompressionCodec(conf: SparkConf) extends CompressionCodec {

override def compressedOutputStream(s: OutputStream): OutputStream = {
val level = conf.getSizeAsBytes("spark.io.compression.zstandard.level", "3").toInt

@Cyan4973Cyan4973May 8, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use cases which favor speed over size should prefer using level 1.
Compression speed difference can be fairly large.

@maropu

maropu commented May 9, 2017

Copy link
Copy Markdown
Member

@Cyan4973 I quickly checked again;

scaleFactor: 4
AWS instance: c4.4xlarge // In this bench, I used `local-cluster` (`local` used in the benchmark above)
./bin/spark-shell --master local-cluster[4,4,7500] \
--conf spark.driver.memory=1g \
--conf spark.executor.memory=7g \
--conf spark.io.compression.codec=xxx
--- zstd (level=3)
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 36.517211838s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 25.026869575s Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 24.370711575s --- zstd (level=1)
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 29.654705815s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 20.638918335s
Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 19.928730758999997s
--- lz4
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 27.422360631s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 17.38519278s
Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 15.779084563s
--- snappy
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 27.476569521000002s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 16.438640631s Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 14.949329456s
--- lzf
Running execution q4-v1.4 iteration: 1, StandardRun=true
Execution time: 27.853010073s
Running execution q4-v1.4 iteration: 2, StandardRun=true
Execution time: 17.431232532000003s
Running execution q4-v1.4 iteration: 3, StandardRun=true
Execution time: 15.916569896999999s

zstd was still worse than the others. Not sure though, there might be the winner case where zstd overcomes the others in more larger data set.

@Cyan4973

Copy link
Copy Markdown

@maropu : What about compression ratios ?

@srowensrowen mentioned this pull request May 17, 2017
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
## What changes were proposed in this pull request?
This PR proposes to close PRs ...
- inactive to the review comments more than a month
- WIP and inactive more than a month
- with Jenkins build failure but inactive more than a month
- suggested to be closed and no comment against that
- obviously looking inappropriate (e.g., Branch 0.5)
To make sure, I left a comment for each PR about a week ago and I could not have a response back from the author in these PRs below:
Closesapache#11129Closesapache#12085Closesapache#12162Closesapache#12419Closesapache#12420Closesapache#12491Closesapache#13762Closesapache#13837Closesapache#13851Closesapache#13881Closesapache#13891Closesapache#13959Closesapache#14091Closesapache#14481Closesapache#14547Closesapache#14557Closesapache#14686Closesapache#15594Closesapache#15652Closesapache#15850Closesapache#15914Closesapache#15918Closesapache#16285Closesapache#16389Closesapache#16652Closesapache#16743Closesapache#16893Closesapache#16975Closesapache#17001Closesapache#17088Closesapache#17119Closesapache#17272Closesapache#17971
Added:
Closesapache#17778Closesapache#17303Closesapache#17872
## How was this patch tested?
N/A
Author: hyukjinkwon <gurwls223@gmail.com>
Closesapache#18017 from HyukjinKwon/close-inactive-prs.
Sign up for freeto 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.

7 participants

@dongjinleekr@AmplabJenkins@srowen@tgravescs@rxin@maropu@Cyan4973