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

FLAGS_compression_parallel_threads of IAA #6

Open
gy-deng opened this issue Oct 14, 2024 · 7 comments
Open

FLAGS_compression_parallel_threads of IAA #6

gy-deng opened this issue Oct 14, 2024 · 7 comments

Comments

@gy-deng
Copy link

gy-deng commented Oct 14, 2024

I found a parameter called FLAGS_compression_parallel_threads in db_bench_tool. When using IAA as the compression type, setting FLAGS_compression_parallel_threads to a value greater than 1 significantly improves compression performance.

I would like to ask:

  1. Does this parameter take advantage of IAA's multi-threading capabilities?
  2. Is the performance improvement related to optimizations in IAA, or is it simply due to the benefit of multi-threading?

My CPU is: Intel(R) Xeon(R) Gold 5420+

@lucagiac81
Copy link
Contributor

Hi. That option enables multiple threads for compression. So, there will be multiple threads submitting compression jobs to IAA, allowing higher utilization of the devices.

@gy-deng
Copy link
Author

gy-deng commented Oct 15, 2024

Thank you for your reply.

In addition, I would like to ask two more questions:

Parallelism of IAA: How is the parallelism of IAA? How can I view its maximum parallelism? Is there any relevant documentation to support it?
Specifying IAA compression method: How can I specify IAA as the compression method in the compression_per_level setting? I have tried using kPluginCompression, but when running it, the error appears: open error: Invalid argument: Compression type is invalid.
Thank you for your assistance!

@lucagiac81
Copy link
Contributor

The IAA spec has more information on the architecture. There is a link on the IAA page.

To set IAA compression per level, you can use the compressor_per_level option added in PR 6717. It takes a vector of compressors (colon-separated). For each compressor, the syntax is the same as when setting the compressor option. For example:
compressor_per_level={{id=Compressor1;opt=value;}:{id=Compressor2;opt=value;}}
There is an example in the unit tests. We will add an example in the PR description and eventually docs.

@gy-deng
Copy link
Author

gy-deng commented Oct 17, 2024

I find the flag QPL_FLAG_ZLIB_MODE suppots adding ZLIB header and trailer information to raw Deflate stream from IAA.
Does it means the IAA compressed SSTable can be decompressed by ZLIB on CPU?
How should I configure the compressor_per_level to support it?

Thank you!

@gy-deng
Copy link
Author

gy-deng commented Oct 17, 2024

I try to call ZLIB uncompressor for kPluginCompression SSTable, but it comes to a segment fault.
image
Can you give me some advice?

Thank you!

@lucagiac81
Copy link
Contributor

I find the flag QPL_FLAG_ZLIB_MODE suppots adding ZLIB header and trailer information to raw Deflate stream from IAA. Does it means the IAA compressed SSTable can be decompressed by ZLIB on CPU? How should I configure the compressor_per_level to support it?

Thank you!

Both the zlib library and QPL support 3 formats: deflate raw (no header/trailer), zlib (raw + zlib header/trailer), and gzip (raw + gzip header/trailer).

The IAA-compressed blocks can technically be decompressed by zlib, but that selection is not currently possible in RocksDB. The compressed blocks have compression type id set to the IAA plugin, and RocksDB will use the corresponding Compressor to decompress the blocks (the zlib Compressor has a different id). Compatibility across compressors is currently not supported, although we are looking into options to enable this (e.g., have an accelerated version of the zlib Compressor).

compressor_per_level won't achieve that. Data may be decompressed with zlib at one level and recompressed with IAA at the next level or vice versa. However, the data at a certain level will always be handled by the same Compressor for compression and decompression.

@lucagiac81
Copy link
Contributor

I try to call ZLIB uncompressor for kPluginCompression SSTable, but it comes to a segment fault. image Can you give me some advice?

Thank you!

Are you trying to force the decompressor to be ZlibCompressor instead of IAACompressor for blocks compressed by IAA? That may work as proof of concept, but I'm not sure. Let me think about it.

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

No branches or pull requests

2 participants