All Products
Search
Document Center

Tair (Redis® OSS-Compatible):TairDoc performance whitepaper

Last Updated:Nov 21, 2024

TairDoc is a document data structure that is similar to RedisJSON and conforms to the JSON standard. This topic describes the method that is used to test TairDoc performance and provides the test results.

TairDoc provides the following features:

  • Fully supports the JSON standard.

  • Compatible with JSONPath RFC draft-ietf-jsonpath-base version 04.

    Note

    Only the JSON.GET command supports this draft version.

  • Fully supports JSON Pointer.

  • Stores data in binary trees to simplify the retrieval of child elements.

  • Supports the conversion from the JSON format to the XML or YAML format.

For more information, see Doc.

Test description

Database test environment

Item

Description

Region and zone

Zone A in the China (Zhangjiakou) region

Storage type

Redis 6.0-compatible DRAM-based instance

Instance version

6.2.4.6

Instance architecture

Standard master-replica architecture for which the cluster mode is disabled. For more information, see Standard architecture.

Instance type

The test results are less susceptible to instance types. In this test, the tair.rdb.4g instance type is used.

Client test environment

Item

Description

Host of the client

Elastic Compute Service (ECS) instance of the ecs.c6e.8xlarge type. For more information, see Overview of instance families.

Region and zone

Zone A in the China (Zhangjiakou) region

Operating system

Alibaba Cloud Linux 3.2104 LTS 64-bit

Network

The ECS instance is deployed in the same virtual private cloud (VPC) as the Tair instance and is connected to the Tair instance over the VPC.

Software

Python 3.7 or later that has python-redis installed

Test data

In this example, data of update-center.json from GitHub is used. The data is 521 KB in size.

Test tool

In this example, the redis-benchmark tool of open source Redis is used.

Test procedure and results

  1. Log on to the ECS instance and run the following command to download the test data to your computer:

    wget https://raw.githubusercontent.com/chadaustin/sajson/master/testdata/update-center.json
  2. Save the following script as a file named insert.py to the directory in which the downloaded test data is located:

    import redis
    import json
    
    host = "r-bp1s02ae14mr****.redis.rds.aliyuncs.com"
    port = 6379
    password = "testaccount:Rp829dlwa"
    
    r = redis.Redis(host=host, port=port, password=password)
    with open("update-center.json", "r") as f:
              content = f.read()
    json = json.loads(content)
    ret = r.json().set("key", ".", json);
    print(f"insert json to {host}, ret is {ret}")
    Note

    Parameters:

    • host: the VPC endpoint of the Tair instance.

    • port: the port number of the Tair instance. The default value is 6379. In this example, this parameter is set to the default value.

    • password: the username and password of the Tair instance. If you use a database account that was created in the console to connect to the Tair instance, you must specify the password in the <user>:<password> format. For example, if the username is testaccount and the password is Rp829dlwa, the password used to connect to the Tair instance is testaccount:Rp829dlwa.

  3. Run the following command to write the data of update-center.json to the Tair instance:

    python3 insert.py

    If the data is written to the Tair instance, the following output is displayed:

    insert json to 127.0.0.1, ret is True
  4. Run commands to start the test.

    • Query the entire JSON file

      Sample command:

      ./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com-p 6379 -a testaccount:Rp829dlwa-c 10 --threads 10 -n 10000 JSON.GET key

      Test results

      Database CPU utilization

      QPS

      Average latency (ms)

      99th percentile latency (ms)

      20%

      569.57

      16.951

      29.279

    • Query the child elements of the JSON file

      Sample command:

      ./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com-p 6379 -a testaccount:Rp829dlwa-c 10 --threads 10 -n 10000 JSON.GET key $.plugins.ant.developers[0].developerId

      Test results

      Database CPU utilization

      QPS

      Average latency (ms)

      99th percentile latency (ms)

      92%

      205879.94

      0.477

      0.943

    • Modify the child elements of the JSON file

      Sample command:

      ./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com-p 6379 -a testaccount:Rp829dlwa-c 10 --threads 10 -n 10000 JSON.SET key .plugins.ant.developers[0].developerId '"developer_foo"'

      Test results

      Database CPU utilization

      QPS

      Average latency (ms)

      99th percentile latency (ms)

      95%

      79865.83

      1.221

      2.639

    • Perform a query that specifies filter conditions

      Sample command:

      ./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com-p 6379 -a testaccount:Rp829dlwa-c 10 --threads 10 -n 10000 JSON.GET key '$.plugins[?(@.scm=="github.com" && @.releaseTimestamp>"2013-01-01")].name'

      Test results

      Database CPU utilization

      QPS

      Average latency (ms)

      99th percentile latency (ms)

      30%

      3043.68

      32.649

      65.311

Summary

TairDoc is provided with the in-house JSON Tree structure and JSONPath framework for parsing and query execution. In this context, TairDoc demonstrates good performance in updates and queries.