You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Performance optimization
Benchmarking TOS performance using COSBench
Copy page
Download PDF
Benchmarking TOS performance using COSBench
COSBench (Cloud Object Storage Benchmark) is a benchmarking tool developed by the Intel team using Java to measure the performance of object storage services. You can use COSBench to conduct stress tests on the read/write performance of TOS. This will enable you to benchmark its performance and ensure business stability.​
Operating environment​
We recommend running COSBench on CentOS 7.6 or a later version. Using other operating environments may result in unexpected issues.​
Using COSBench​
  1. Download the COSBench installation package for TOS and extract it to your local device.​
tip​
COSBench cannot be used directly to test TOS performance. First, you need to modify COSBench‘s source code. Then, you need to build a COSBench adapter for TOS from the modified source code. For instructions, see Appendix: Building a COSBench adapter for TOS.​
  1. Run this command to install COSBench dependencies.​
  • ​
    sudo yum install nmap-ncat java curl java-1.8.0-openjdk-devel -y​
    ​
  1. Configure the s3-config-sample.xml file in the COSBench adapter to create a test workload.​
  • ​
    Code example
    Stages
    Parameters
    ​
    ​
    <workload name="s3-sample" description="sample benchmark for s3">​
    ​
    <storage type="s3" config="accesskey=***;secretkey=***;endpoint=http://tos-s3-cn-beijing.ivolces.com;path_style_access=false;" />​
    ​
    <workflow>​
    ​
    <workstage name="init" closuredelay="90">​
    <work type="init" workers="1" config="cprefix=examplebucket;containers=r(1,2)" />​
    </workstage>​
    ​
    <workstage name="prepare">​
    <work type="prepare" workers="10" config="cprefix=examplebucket;containers=r(1,2);objects=r(1,1000);sizes=c(4)KB" />​
    </workstage>​
    ​
    <workstage name="main">​
    <work name="main" workers="100" runtime="300">​
    <operation type="read" ratio="80" config="cprefix=examplebucket;containers=u(1,2);objects=u(1,1000)" />​
    <operation type="write" ratio="20" config="cprefix=examplebucket;containers=u(1,2);objects=u(1001,2000);sizes=c(4)KB" />​
    </work>​
    </workstage>​
    ​
    <workstage name="cleanup">​
    <work type="cleanup" workers="10" config="cprefix=examplebucket;containers=r(1,2);objects=r(1,2000)" />​
    </workstage>​
    ​
    <workstage name="dispose">​
    <work type="dispose" workers="1" config="cprefix=examplebucket;containers=r(1,2)" />​
    </workstage>​
    ​
    </workflow>​
    ​
    </workload>​
    ​
    • ​
    ​
  • ​
  1. Configure the cosbench-start.sh file and add the following parameters to adjust the buffer size and disable MD5. The buffer size should be at least as large as the size of the test objects. Adjust this value based on your needs.​
  • ​
    -Dcom.amazonaws.sdk.s3.defaultStreamBufferSize=104857600 -Dcom.amazonaws.services.s3.disableGetObjectMD5Validation=true -Dcom.amazonaws.services.s3.disablePutObjectMD5Validation=true​
    ​
  • ​Image​​
  1. Run this command to start the COSBench service.​
  • ​
    sudo bash start-all.sh​
    ​
  • Differences in versions of the Nmap tool on operating systems such as Debian may cause the nc command's detection operation to fail, which prevents COSBench from starting. If you encounter this issue, you can fix it by adding the -q 1 parameter to the nc command in the cosbench-start.sh file.​
  • ​Image​​
  1. Run this command to submit the test workload.​
  • ​
    sudo bash cli.sh submit conf/s3-config-sample.xml​
    ​
  1. To check the test status, open http://ip:19088/controller/index.html in your browser (replace "ip" with the test server's IP address).​
  • ​Image​​
  1. After completing your test, run this command to stop the COSBench service.​
  • ​
    sudo bash stop-all.sh​
    ​
Appendix: Building a COSBench adapter for TOS​
COSBench cannot be used directly to test TOS performance. First, you need to modify COSBench's source code. Then, you need to build a COSBench adapter for TOS from the modified source code.​
Environment​
In this section, we will demonstrate how to build a COSBench adapter for TOS using the following environment.​
  • Operating system: macOS x86_64​
  • IDE version: Eclipse 4.15​
  • JDK version: 1.8​
Steps​
  1. Download the source code package for COSBench from GitHub and extract it to your local device.​
  • ​Image​​
  1. Import COSBench‘s source code into Eclipse.​
  1. In Eclipse, select File > Import... > Existing Projects into Workspace.​
  1. In the Import Projects dialog box, select the dev directory from the source code and click Finish.​
  • ​Image​​
  1. Select Eclipse > Settings... > Plug-in Development > Target Platform.​
  1. In the Target Platform dialog box, click Add...​
  1. In the Target Content dialog box, enter a name for your platform in the Name field.​
  1. Select Add... > Directory. Then, add the main, osgi, and osgi/libs folders from the dist directory of the source code, and click Finish.​
  • ​Image​​
  1. In the Target Platform dialog box, select the platform you just created and click Apply and Close.​
  • ​Image​​
  1. Configure the S3Storage.java file.​
  1. Locate the S3Storage.java file in the cosbench-s3 folder.​
  1. In the S3Storage.java file, modify the value of clientConf.withSignerOverride to AWSS3V4SignerType to use AWS Signature Version 4. Example:​
  • ​
    clientConf.withSignerOverride("AWSS3V4SignerType");​
    ​
  • ​Image​​
  1. In the S3Storage.java file, modify the value of client.setS3ClientOptions by adding disableChunkedEncoding to disable chunked encoding. Example:​
  • ​
    client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(parms.getBoolean(PATH_STYLE_ACCESS_KEY)).disableChunkedEncoding());​
    ​
  • ​Image​​
  1. In the S3Storage.java file, modify the value of client.putObject to enable uploading objects using BufferedInputStream. Example:​
  • ​
    client.putObject(container, object, new BufferedInputStream(data), metadata);​
    ​
  • ​Image​​
  1. Generate the COSBench adapter bundle.​
  1. In Eclipse, select File > Export... > Plug-in Development > Deployable plugins and fragments.​
  1. In the Deployable plug-ins and fragments dialog box, click Select All. Then, set Directory to the dist/osgi folder in the source code.​
  • ​Image​​
  1. Click the Options tab, and select Use class files compiled in the workspace. End the process by clicking Finish.​
  • ​Image​​
  1. Run this command from the source code directory to package the COSBench adapter bundle.​
  • ​
    sh pack.sh cosbench-tos​
    ​
  • ​Image​​
  1. Run this command to zip the COSBench adapter bundle.​
  • ​
    zip -r -X cosbench-tos.zip cosbench-tos​
    ​
​
Last updated: 2026.08.25 10:39:45