Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-28485

Re-use ZstdDecompressCtx/ZstdCompressCtx for performance

    XMLWordPrintableJSON

Details

    Description

      The zstd documentation recommends re-using context objects when possible, because their creation has some expense. They can be more cheaply reset than re-created. In ZstdDecompressor and ZstdCompressor, we create a new context object for every call to decompress() and compress(). In CPU profiles I've taken at my company, the constructor of ZstdDecompressCtx can sometimes represent 10-25% of the time spent in zstd decompression, which itself is 5-10% of a RegionServer's total CPU time. Avoiding this performance penalty won't lead to any massive performance boost, but is a nice little win.

      Attachments

        1. async-prof-pid-1324144-cpu-1.html
          274 kB
          Charles Connell
        2. async-prof-flamegraph-cpu_event-1712150670836-cpu.html
          514 kB
          Charles Connell

        Activity

          People

            charlesconnell Charles Connell
            charlesconnell Charles Connell
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: