Working with COSBench

Last updated: 2020-10-10 10:35:30

    COSBench Overview

    COSBench is an open-source benchmark tool developed by Intel for testing the performance of cloud object storage systems. As a cloud storage system compatible with S3 protocol, COSBench can be used to perform benchmark tests on the read/write performance of Tencent Cloud COS.

    System Environment

    CentOS 7.0 or later.

    Performance Factors

    • CPU cores: a small number of CPU cores coupled with a large number of running workers is very likely to cause high overheads for context switching. Therefore, 32 or 64 cores are recommended for the test.
    • NIC: the outbound traffic from the server is limited. To test the traffic for large files, an NIC above 10 GB is recommended.
    • Network link: public network links vary in quality. Charges will incur for public network downstream traffic for downloads over public network. Therefore, private network is recommended for access within the same region.
    • Test duration: in order to get a reliable value, we recommend a longer test period.
    • Test environment: the version of the JDK running on your program is also a key performance factor. For example, when testing on HTTPS, with an earlier JDK version, GCM bugs may occur for the encryption algorithm, as well as the locking issues for the random number generator.


    1. Download COSBench 0.4.2.c4 from CosBench GitHub, and decompress it in your server.
    2. Install the COSBench dependent library and run the following command.
      yum install nmap-ncat java curl java-1.8.0-openjdk-devel -y
    3. Edit the file s3-config-sample.xml and configure a test job. The test job is divided into the following five stages.
      1. init: creates a bucket.
      2. prepare: uses parallel threads (or workers) to PUT (upload) objects with specified size to read in the main stage.
      3. main: uses parallel workers to read and write objects for a specified period of time.
      4. cleanup: deletes the created objects.
      5. dispose: deletes buckets.

    The sample configuration is as shown below.

    <?xml version="1.0" encoding="UTF-8" ?>
    <workload name="s3-50M-sample" description="sample benchmark for s3">
      <storage type="s3" config="accesskey=AKIDHZRLB9Ibhdp7Y7gyQq6BOk1997xxxxxx;secretkey=YaWIuQmCSZ5ZMniUM6hiaLxHnxxxxxx;endpoint=" />
        <workstage name="init">
          <work type="init" workers="10" config="cprefix=examplebucket;csuffix=-1250000000;containers=r(1,10)" />
        <workstage name="prepare">
          <work type="prepare" workers="100" config="cprefix=examplebucket;csuffix=-1250000000;containers=r(1,10);objects=r(1,1000);sizes=c(50)MB" />
        <workstage name="main">
          <work name="main" workers="100" runtime="300">
            <operation type="read" ratio="50" config="cprefix=examplebucket;csuffix=-1250000000;containers=u(1,10);objects=u(1,1000)" />
            <operation type="write" ratio="50" config="cprefix=examplebucket;csuffix=-1250000000;containers=u(1,10);objects=u(1000,2000);sizes=c(50)MB" />
        <workstage name="cleanup">
          <work type="cleanup" workers="10" config="cprefix=examplebucket;csuffix=-1250000000;containers=r(1,10);objects=r(1,2000)" />
        <workstage name="dispose">
          <work type="dispose" workers="10" config="cprefix=examplebucket;csuffix=-1250000000;containers=r(1,10)" />


    Parameter Description
    accesskey, secretkey Access key information, which you should replace with your own SecretId and SecretKey
    cprefix Name of the bucket, such as examplebucket
    csuffix User account APPID, which should be prefixed with the endash -, e.g. -1250000000
    runtime Specifies how long the test should run
    ratio The ratio of reads to writes
    workers Specifies the number of parallel threads for the test
    1. Edit the file and add the following parameter to the Java startup command line to disable S3 MD5 verification.
    2. Run the following command to submit the job.

      sh submit conf/s3-config-sample.xml

      Check the test status at http://ip:19088/controller/index.html (replace “ip” in this link with the IP of your own testing server).

      You can see the five work stages as shown below.

    3. The following example shows the performance tests of the uploads and downloads of Tencent Cloud CVM with 32 cores and 17 Gbps private network bandwidth in Beijing region. The test includes the following two stages.

      1. prepare: 100 workers threads. 1,000 50 MB.objects are uploaded.
      2. main: 100 workers read and write objects in parallel for 300 seconds.
        The test results after two stages above are as shown below.
    4. Run the following command to stop the test.


    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback