intel / iaa-plugin-rocksdb

Apache License 2.0
14 stars 4 forks source link

FLAGS_compression_parallel_threads of IAA #6

Open gy-deng opened 1 month ago

gy-deng commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 4 weeks ago

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_perlevel 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 commented 4 weeks ago

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 commented 4 weeks ago

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 commented 8 hours ago

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 commented 8 hours ago

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.