public boolean isBlobCompressible(BlobProperties blobProperties) {
    Objects.requireNonNull(blobProperties, "blobProperties cannot be null.");

    // Return false if compression is disabled.  No need to emit metrics.
    if (!isCompressionEnabled) {
      return false;
    }

    // Check content-encoding. If BlobProperty.ContentEncoding contains a string, do not apply compression.
    String contentEncoding = blobProperties.getContentEncoding();
    if (isSkipWithContentEncoding && !Utils.isNullOrEmpty(contentEncoding)) {
      logger.trace("No compression applied because blob is encoded with " + contentEncoding);
      // Emit metrics to count how many compressions skipped due to encoded data.
      compressionMetrics.compressSkipRate.mark();
      compressionMetrics.compressSkipContentEncoding.inc();
      return false;
    }

    // Check the content-type.  If content type is incompressible based on config, skip compression.
    String contentType = blobProperties.getContentType();
    if (!isCompressibleContentType(contentType)) {
      logger.trace("No compression applied because content-type " + contentType + " is incompressible.");
      // Emit metrics to count how many compressions skipped due to incompressible chunks based on content-type.
      compressionMetrics.compressSkipRate.mark();
      compressionMetrics.compressSkipContentTypeFiltering.inc();
      return false;
    }

    // For all other case, compression should be enabled.
    return true;
  }
Check whether the blob is compressible based on the blob properties.

@param blobProperties The blob property that is common to all chunks. It helps to detect whether blob is
                      compressible or not.
@return True if blob is compressible based on the blob properties; FALSE if blob is not compressible.
ambry-router/src/main/java/com/github/ambry/router/CompressionService.java