すべてのプロダクト
Search
ドキュメントセンター

Tair (Redis® OSS-Compatible):TairSearchパフォーマンスホワイトペーパー

最終更新日:Jan 24, 2025

このトピックでは、TairSearchとRediSearchの書き込みとクエリのパフォーマンスをテストするために使用されるメソッドについて説明し、テスト結果を示します。

TairSearchは、Tairの社内全文検索データ構造です。 TairSearchは、Elasticsearchと同様のクエリ構文を使用して、効果的な全文検索を実装します。 詳細については、「検索」をご参照ください。

テストの説明

クライアントテスト環境

項目

説明

クライアントのホスト

ECS. g7.8xlargeタイプのElastic Compute Service (ecs) インスタンス。 詳細については、「インスタンスファミリーの概要」をご参照ください。

リージョンとゾーン

中国 (杭州) リージョンのゾーンK

オペレーティングシステム

CentOS 7.9 64ビット

データベーステスト環境

TairデータベースとRedisデータベースは、同じECSインスタンスでホストされています。 次の表に、データベースを示します。

表 1. 自己管理型Tairデータベース

項目

説明

Tairバージョン

バージョン5.0.30のRedis 5.0互換DRAMベースのインスタンス

I/Oスレッドの数

4

CPU

6 vCPU。 サンプルコマンド:taskset -c 1-6。/src/redis-サーバーredis.conf.

表 2. 自己管理Redisデータベース

項目

説明

Redisバージョン

7.0.10

RediSearchバージョン

2.6.6. CONCURRENT_WRITE_MODEパラメーターはtrueに設定されています。

RedisJSONバージョン

2.4.6

I/Oスレッドの数

4

CPU

6 vCPU。 サンプルコマンド:taskset -c 1-6。/src/redis-サーバーredis.conf.

テストデータ

テストデータは、ウィキメディアからの中国語の記事のコレクションと英語の記事のコレクションです。 詳細については、「 /zhwiki/latest /のインデックス」および「 /enwiki/latest /のインデックス」をご参照ください。

例:

{
    "id":"History_of_Pakistan",
    "title":"History of Pakistan",
    "url":"https://en.wikipedia.org/wiki/History_of_Pakistan",
    "abstract":"The history of Pakistan for the period preceding the country's independence in 1947Pakistan was created as the Dominion of Pakistan on 14 August 1947 after the end of British rule in, and partition of British India. is shared with that of Afghanistan, India."
}
{
    "id":"Wikipedia:哲学",
    "title":"Wikipedia:哲学",
    "url":"https://zh.wikipedia.org/wiki/%E5%93%B2%E5%AD%A6",
    "abstract":"哲学()是研究普遍的、基本问题的学科,包括存在、知识、价值、理智、心灵、语言等领域。哲学与其他学科不同之处在於哲学有独特之思考方式,例如批判的方式、通常是系统化的方法,并以理性论证为基础。"
}

テストツール

オペレーティングシステムに一致するバイナリ実行可能ファイルをダウンロードします。 ダーウィンのファイルの名前は

TairSearchBench.Darwinでは、Linux用のファイルの名前はTairSearchBench.Linux、Windows用のファイルの名前はTairSearchBench.Windowsです。

この例では、TairSearchBench.Linuxが使用されます。 を実行します。Run the. /TairSearchBench.Linux -- ヘルプコマンドを実行して、ツールの使用方法を確認します。

Usage of ./TairSearchBench.linux:
  -a string
        The address(ip:port) of network to connect 
        # The endpoint of the instance. 
  -c int
        Benchmark concurrency (default 30)
        # The number of tests that can be run concurrently. Default value: 30. 
  -d uint
        Specify the number of seconds for the benchmark (default 30)
        # The duration of the test. When the duration ends, the test is terminated. Default value: 30. Unit: seconds. 
  -e string
        The engine backend to run [tairsearch/redisearch]
        # Specify TairSearch or RediSearch as the engine that the instance runs. 
  -f string
        Input file to ingest data from (wikipedia abstracts)
        # The path of the execution data file. 
  -h string
        Print usage (default "help")
        # Display the usage of the tool. 
  -j string
        Specify the big json file to write
        # Specify the path of the JSON file to be written. 
  -n uint
        Specify the number of times to benchmark (default 100000)
        # The total number of operations to perform for a test. Default value: 100000. 
  -o int
        Overwrite the doc (We will write the document with the same document id)
        # Specify whether to overwrite the original document. Valid values: 1 (true) and 0 (false). Default value: 0. 
  -p string
        The password of redis to connect
        # The password of the instance. 
  -q string
        Search query string to benchmark
        # The query statement that is used to run tests. 
  -s uint
        Specify the compress threshold for tairsearch (default 10000000000)
        # Specify the compression threshold for TairSearch. If the size of a document exceeds the threshold, the document is compressed. Unit: bytes. Default value: 10000000000 (10 KB). 
  -t string
        Specify the type of benchmark [write/search/readwrite]
        # Set the test type to write, search, or readwrite. 
  -z string
        Specify the analyzer to use for query (default "standard")
        # Specify the analyzer for the query. Default value: standard.

テストを実行する前に、ECSインスタンスに20 vCPUを割り当てます。 サンプルコマンド:taskset -c 10-30。/TairSearchBench.linux.

準備

スキーマ (インデックス) を作成します。 例:

  • TairSearch

    {
        "settings": {
            "compress_doc": {
                "size": "user-defined compression threshold",
                "enable": true
            }
        },
        "mappings": {
            "properties": {
                "id":       {"type": "keyword"},
                "url":      {"type": "keyword", "index": false},
                "title":    {"type": "text", "analyzer": "user-defined analyzer"},
                "abstract": {"type": "text", "analyzer": "user-defined analyzer"},
                "url_len":  {"type": "integer"},
                "abstract_len":  {"type": "integer"},
                "title_len":  {"type": "integer"}
            }
        }
    }
  • RediSearch

    \\ SCHEMA
    $.id AS id TEXT
    $.url AS url TEXT NOINDEX
    $.title AS title TEXT
    $.abstract AS abstract TEXT
    $.abstract_len AS abstract_len NUMERIC
    $.url_len AS url_len NUMERIC
    $.title_len AS title_len NUMERIC
    
    \\ If the test data is documents in Chinese, add LANGUAGE CHINESE to the preceding code.

テストコマンドとテスト結果

以下のテストでは、各書き込みテストに対して百万の文書が書き込まれる。 各クエリテストに対して百万のドキュメントに対して百万のクエリが実行される。 書き込み操作とクエリ操作を組み合わせた各テストは、60秒間実行されるように構成されています。

英語でデータを書く

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e tairsearch -f ./enwiki-latest-abstract.xml -c 20 -n 1000000 -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e redisearch -f ./enwiki-latest-abstract.xml -c 20 -n 1000000 -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

使用メモリ (GB)

TairSearch

22615.15

0.874

1.735

1.39

RediSearch

18295.10

1.092

2.352

1.67

中国語でデータを書き込む

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e tairsearch -f ./zhwiki-latest-abstract.xml -c 20 -n 1000000 -a 127.0.0.1:6379 -z jieba
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e redisearch -f ./zhwiki-latest-abstract.xml -c 20 -n 1000000 -a 127.0.0.1:6379 -z chinese

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

使用メモリ (GB)

TairSearch

13980.41

1.427

3.275

1.87

RediSearch

10924.40

1.830

3.857

1.83

説明

jiebaアナライザーが使用され、よりきめの細かいトークンが生成されるため、TairSearchのメモリ使用量はRediSearchよりも高くなります。

英語でのデータの上書き

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e tairsearch -f ./enwiki-latest-abstract.xml -c 20 -n 1000000 -o 1 -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e redisearch -f ./enwiki-latest-abstract.xml -c 20 -n 1000000 -o 1 -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

使用メモリ (GB)

TairSearch

9775.03

2.041

3.974

0.0002

RediSearch

22239.67

0.898

1.38

0.165

説明

上書き操作を実行すると、RediSearchは後で削除するために元のドキュメントをマークします。 これにより、追加のメモリ使用量が発生します。 それに比べて、TairSearchは元のドキュメントをリアルタイムで削除します。

中国語でデータを上書きする

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e tairsearch -f ./zhwiki-latest-abstract.xml -c 20 -n 1000000 -o 1 -a 127.0.0.1:6379 -z jieba
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t write -e redisearch -f ./zhwiki-latest-abstract.xml -c 20 -n 1000000 -o 1 -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

使用メモリ (GB)

TairSearch

6194.15

3.206

6.456

0.025 (jiebaアナライザー辞書で使用するメモリを含む)

RediSearch

25096.18

0.796

1.338

0.671

説明

上書き操作を実行すると、RediSearchは後で削除するために元のドキュメントをマークします。 これにより、追加のメモリ使用量が発生します。 それに比べて、TairSearchは元のドキュメントをリアルタイムで削除します。

用語文を使用して英語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 1000000 -q '{"query":{"term":{"abstract":"hello"}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract:hello" -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

45501.13

0.437

0.563

RediSearch

28513.87

0.700

0.833

用語文を使用して中国語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 1000000 -q '{"query":{"term":{"abstract":"你好"}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract:你好" -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

40670.47

0.489

0.635

RediSearch

24437.48

0.817

1.331

matchステートメントを使用して英語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 1000000 -q '{"query":{"match":{"abstract":{"operator":"and","query":"chinese history"}}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract:chinese history" -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

24548.94

0.812

0.971

RediSearch

2420.66

8.261

8.523

match文を使用して中国語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 100000 -q '{"query":{"match":{"abstract":{"operator":"and","query":"中国的历史"}}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 100000 -q "@abstract:中国的历史" -a 127.0.0.1:6379  -analyzer jieba

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

6601.05

3.027

3.669

RediSearch

889.37

22.486

22.985

boolステートメントを使用して英語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 100000 -q '{"query":{"bool":{"must":[{"term":{"abstract":"war"}},{"term":{"abstract":"japanese"}},{"range":{"abstract_len":{"gt":500}}}],"must_not":{"term":{"abstract":"America"}},"should":[{"term":{"abstract":"chinese"}},{"term":{"abstract":"china"}}]}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 100000 -q "@abstract:(war japanese -America (chinese|china)) @abstract_len:[500 +inf]"  -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

4554.22

4.388

5.702

RediSearch

1124.08

17.791

18.444

boolステートメントを使用して中国語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 100000 -q '{"query":{"bool":{"must":[{"term":{"abstract":"战争"}},{"term":{"abstract":"日本"}},{"range":{"abstract_len":{"gt":500}}}],"must_not":{"term":{"abstract":"美国"}},"should":[{"term":{"abstract":"中国"}},{"term":{"abstract":"亚洲"}}]}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract:(日本 -美国 (中国|亚洲)) @abstract_len:[500 +inf]"  -a 127.0.0.1:6379 -analyzer jieba

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

2619.00

7.623

18.42

RediSearch

1199.76

16.669

17.064

範囲ステートメントを使用して英語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 1000000 -q '{"query":{"range":{"abstract_len":{"lte":420, "gte":400}}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract_len:[400,420]" -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

2840.02

7.038

8.599

RediSearch

1307.02

15.300

16.817

プレフィックスステートメントを使用して英語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 1000000 -q '{"query":{"prefix":{"abstract":"happiness"}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract:happiness*" -a 127.0.0.1:6379

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

36491.10

0.545

0.688

RediSearch

25558.92

0.781

0.930

プレフィックスステートメントを使用して中国語でデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e tairsearch -c 20 -n 1000000 -q '{"query":{"prefix":{"abstract":"开心"}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t search -e redisearch -c 20 -n 1000000 -q "@abstract:开心*" -a 127.0.0.1:6379 -z chinese

テスト結果

エンジン

QPS

平均レイテンシ (ms)

99パーセンタイル遅延 (ms)

TairSearch

41308.71

0.481

0.638

RediSearch

27457.86

0.727

1.234

データを書き込み、用語文を使用してデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t readwrite -e tairsearch -f ./enwiki-latest-abstract.xml -c 20 -d 60 -q '{"query":{"term":{"abstract":"hello"}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t readwrite -e redisearch -f ./enwiki-latest-abstract.xml -c 20 -d 60 -q "@abstract:hello" -a 127.0.0.1:6379

テスト結果

エンジン

平均書き込みQPS

平均書き込みレイテンシ (ms)

平均QPS

平均クエリ待ち時間 (ms)

TairSearch

14699.77

1.359

16224.03

1.232

RediSearch

11386.75

1.755

11386.70

1.755

データを書き込み、boolステートメントを使用してデータを照会する

コマンド

  • TairSearch

    taskset -c 10-30 ./TairSearchBench.linux -t readwrite -e tairsearch -f ./enwiki-latest-abstract.xml -c 20 -d 60 -q '{"query":{"bool":{"must":[{"term":{"abstract":"war"}},{"term":{"abstract":"japanese"}},{"range":{"abstract_len":{"gt":500}}}],"must_not":{"term":{"abstract":"America"}},"should":[{"term":{"abstract":"chinese"}},{"term":{"abstract":"china"}}]}}}' -a 127.0.0.1:6379
  • RediSearch

    taskset -c 10-30 ./TairSearchBench.linux -t readwrite -e redisearch -f ./enwiki-latest-abstract.xml -c 20 -d 60 -q "@abstract:(war japanese -America (chinese|china)) @abstract_len:[500 +inf]" -a 127.0.0.1:6379

テスト結果

エンジン

平均書き込みQPS

平均書き込みレイテンシ (ms)

平均QPS

平均クエリ待ち時間 (ms)

TairSearch

9589.18

2.085

10504.31

1.903

RediSearch

5284.01

3.784

5283.96

3.784

概要

TairSearchは、マルチコア並列コンピューティングテクノロジーと、テキスト検索専用に設計された転置インデックスを使用して、高スループットと低レイテンシを実現します。 さらに、TairSearchはドキュメント圧縮専用のデータ構造を使用して、読み取りと書き込みのパフォーマンスを損なうことなく、メモリ使用量を削減し、コストを節約します。