Rate This Document
Findability
Accuracy
Completeness
Readability

Testing YCSB

  1. Switch to the installation directory.
    1
    cd YCSB-0.15.0
    

    The main directories are described as follows:

    • bin: contains an executable YCSB file, which is the command line interface for user operations. The main logic of the YCSB is as follows: Parse the command lines, set the Java environment, load Java-libs, encapsulate the commands into executable Java commands, and execute the commands.
    • workloads: contains various workload templates, which can be customized.

    The default six test scenarios are as follows:

    • workloada: read/write balancing, 50%/50%, reads/writes
    • workloadb: read-intensive, 95%/5%, reads/writes
    • workloadc: read-only, 100%, reads
    • workloadd: reads the most recently written records, 95%/5%, reads/insert
    • workloade: inter-cell scanning, 95%/5%, scan/insert
    • workloadf: read/written records balancing, 50%/50%, reads/insert
    • workload_template: parameter list template
  2. Configure the pressure test.

    Select a test scenario and edit the corresponding configuration file. The following uses the read/write test as an example:

    1
    vi workloads/workloada
    

    The parameters in the configuration file are as follows:

    Table 1 Parameters in the configuration file

    Parameter

    Description

    recordcount

    Number of records loaded in the YCSB load phase.

    operationcount

    Total number of operations performed in the YCSB run phase.

    workload

    workload implementation class.

    readallfields

    Indicates whether to read all fields of a record during query.

    readproportion

    Percentage of read operations.

    updateproportion

    Percentage of update operations.

    scanproportion

    Percentage of insert operations.

    requestdistribution

    Request distribution mode, which can be uniform, zipfian, or latest.

    mongodb.url

    Link to the mongo instance to be tested.

    NOTICE:

    This item needs to be added.

    mongodb.database

    Name of the database used in the test. The default value is ycsb.

    NOTICE:

    This item needs to be added.

  3. Load the data.
    1
    bin/ycsb load mongodb -threads 100 -P workloads/workloada
    
    Figure 1 Data loading command output
    Figure 2 Data loading command output

    If "Return=OK" is returned, the data is imported successfully.

    The parameters are described as follows:

    ycsb [command] [database] [options]

    • command can be any of the following:

      load: loads the test data.

      run: starts the test.

      shell: indicates the interaction mode.

    • database specifies the database scenario for the test, such as mongodb, cassandra, or memcached.
    • options can be any of the following:

      -P file: specifies the workload file, which can be a relative or absolute path.

      -cp path: specifies an additional Java classpath.

      -jvm-args args: specifies an additional JVM parameter.

      -p key=value: sets the YCSB configuration item, which will overwrite the configuration item in the workload file.

      -s: displays the intermediate status during the running to stderr.

      -target n: indicates the total number of operations in 1s.

      -threads n: sets the number of concurrent test threads of the YCSB client. The default value is 1, indicating a single thread.

  4. Perform the test.
    1
    bin/ycsb run mongodb -threads 100 -P workloads/workloada
    
    Figure 3 Test command output
    Figure 4 Test command output

    If "Return=OK" is returned, the test is complete. The value of [OVERALL],Throughput is used as the test metric.

    [OVERALL], RunTime(ms), 1123 #Duration of the test (ms)

    [OVERALL], Throughput(ops/sec), 8904.719501335709 #Throughput during the test (ops/sec)

    [READ], Operations, 5020 #Total number of read operations.

    [READ], AverageLatency(us), 4126.0304780876495 #Average latency of each read operation (microsecond)

    [READ], MinLatency(us), 299 #Minimum latency of each read operation (microsecond)

    [READ], MaxLatency(us), 168959 #Maximum latency of each read operation (microsecond)

    [READ], 95thPercentileLatency(us), 6659 #The latency of 95% read operations is within 6659 microseconds.

    [READ], 99thPercentileLatency(us), 157311 #The latency of 99% read operations is within 157311 microseconds.

    [READ], Return=OK, 5020 #Return success. The number of operations is 5020.

    [UPDATE], Operations, 4980 #Total number of update operations.

    [UPDATE], AverageLatency(us), 3846.1317269076303 #Average delay of each update operation (microsecond)

    [UPDATE], MinLatency(us), 321 #Minimum latency of each update operation (microsecond)

    [UPDATE], MaxLatency(us), 168575 #Maximum latency of each update operation (microsecond)

    [UPDATE], 95thPercentileLatency(us), 6555 #The latency of 95% update operations is within 6555 microseconds.

    [UPDATE], 99thPercentileLatency(us), 26351 #The latency of 99% update operations is within 26351 microseconds.

    [UPDATE], Return=OK, 4980 #Return success. The number of operations is 4980.