Rate This Document
Findability
Accuracy
Completeness
Readability

Verifying the Effect of Object Storage Compression

  1. Install s3cmd.
    1
    yum -y install s3cmd
    
  2. Configure the ~/.s3cfg file.
    1. Open the ~/.s3cfg file.
      vi ~/.s3cfg
    2. Press i to enter the insert mode and configure the file as follows:
      1
      2
      3
      4
      5
      6
      [default]
      access_key = access_key
      secret_key = secret_key
      host_base = rgw_host_ip:rgw_host_port
      host_bucket = compress_ratio_bucket
      use_https = False
      
      Table 1 Parameter description

      Parameter

      Description

      access_key

      Set this parameter to the actual access key of the S3 user.

      secret_key

      Set this parameter to the actual secret key of the S3 user.

      host_base

      Set this parameter to the actual IP address and port number of the RGW gateway.

    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  3. Create a bucket.
    1
    s3cmd mb s3://compress_ratio_bucket
    
  4. Keep a 100 MB test file ready for the test.
    1
    dd if=/dev/zero of=/home/compress_test bs=1M count=100
    

    You can also use a real dataset file.

  5. Write the data.
    1
    s3cmd put /home/compress_test s3://compress_ratio_bucket/test
    
  6. Verify the compression effect.
    1
    radosgw-admin bucket stats --bucket=compress_ratio_bucket
    

    size_kb_actual indicates that the size of the raw data is 100 MB. size_kb_utilized indicates that the size of the data is 4 KB after compression. Therefore, the compression ratio is 102,400/4 = 25,600. In the example, all-zero data is used, so the compression ratio is high. The compression ratio of actual datasets typically ranges from 2 to 10.