TairDoc is a document data structure similar to RedisJSON that fully conforms to the JSON standard. This topic describes the test environment, procedure, and results for TairDoc performance benchmarking.
TairDoc supports:
Full JSON standard compliance
JSONPath RFC draft-ietf-jsonpath-base version 04 (JSON.GET command only)
JSON Pointer (RFC 6901)
Binary tree storage for efficient child element retrieval
Conversion from JSON to XML or YAML format
For command details, see Doc.
How it works
TairDoc stores JSON data internally as a binary tree. This structure simplifies the retrieval of child elements, which is why child element queries and updates run significantly faster than full-document reads, as shown in the test results below.
Test environment
Database
| Item | Description |
|---|---|
| Region and zone | Zone A in the China (Zhangjiakou) region |
| Storage type | Redis 6.0-compatible, DRAM-based |
| Instance version | 6.2.4.6 |
| Instance architecture | Standard master-replica architecture (cluster mode disabled). 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
| Item | Description |
|---|---|
| Host | Elastic Compute Service (ECS) instance, ecs.c6e.8xlarge type. 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 | Same virtual private cloud (VPC) as the Tair instance |
| Software | Python 3.7 or later with python-redis installed |
Test data and tool
| Item | Description |
|---|---|
| Test data | update-center.json from GitHub, 521 KB |
| Test tool | redis-benchmark (open source Redis) |
Test procedure
Step 1: Download the test data
Log on to the ECS instance and run:
wget https://raw.githubusercontent.com/chadaustin/sajson/master/testdata/update-center.jsonStep 2: Insert the test data
Save the following script as insert.py in the same directory as the downloaded test data:
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}")Replace the following placeholders:
| Parameter | Description |
|---|---|
host | VPC endpoint of the Tair instance |
port | Port number of the Tair instance. Default: 6379 |
password | Credentials in <username>:<password> format. For example, if the username is testaccount and the password is Rp829dlwa, set this to testaccount:Rp829dlwa. |
Run the script:
python3 insert.pyIf the data is inserted successfully, the output is:
insert json to 127.0.0.1, ret is TrueStep 3: Run the benchmarks
All commands use -c 10 --threads 10 -n 10000 flags with redis-benchmark.
Query the entire JSON document
./src/redis-benchmark -h r-bp1s02ae14mr****.redis.rds.aliyuncs.com -p 6379 -a testaccount:Rp829dlwa -c 10 --threads 10 -n 10000 JSON.GET key| CPU utilization | QPS | Average latency (ms) | 99th percentile latency (ms) |
|---|---|---|---|
| 20% | 569.57 | 16.951 | 29.279 |
Query a child element
./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| CPU utilization | QPS | Average latency (ms) | 99th percentile latency (ms) |
|---|---|---|---|
| 92% | 205,879.94 | 0.477 | 0.943 |
Modify a child element
./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"'| CPU utilization | QPS | Average latency (ms) | 99th percentile latency (ms) |
|---|---|---|---|
| 95% | 79,865.83 | 1.221 | 2.639 |
Query with a filter expression
./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'| CPU utilization | QPS | Average latency (ms) | 99th percentile latency (ms) |
|---|---|---|---|
| 30% | 3,043.68 | 32.649 | 65.311 |
Summary
The results reflect TairDoc's binary tree storage model:
Child element queries and updates are fast (205,879.94 QPS and 79,865.83 QPS respectively) because the binary tree structure simplifies retrieval of individual nodes.
Full-document reads are slower (569.57 QPS) because the entire 521 KB structure must be serialized and returned.
Filter expression queries traverse the tree and evaluate conditions, resulting in intermediate throughput (3,043.68 QPS).
TairDoc performs well for applications that read or update specific fields within large JSON documents.