INFINI Easysearch
INFINI Easysearch 是一個分散式的近實時搜尋與分析引擎,核心引擎基於開源的 Apache Lucene。Easysearch 衍生自基於開源協議 Apache 2.0 的 Elasticsearch 7.10 版本,完善和支援更多的企業級功能,最佳化搜尋業務場景,以保證更佳的資料探索與分析體驗。
Easysearch 的主要特點:
- 相容 Elasticsearch,業務程式碼無需改動;可平滑遷移
- 企業級安全;更穩定可靠
- 企業級管理後臺(多叢集統一管理,實現運營標準化、自動化)
- 信創適配(全面適配國產 CPU/OS/伺服器,支援國密演算法)
- Easysearch 快速體驗,請參閱:
Easysearch,地表最強,沒有之一!
Loadgen
Loadgen 是 Elasticsearch 專屬壓測工具,用來對 Easysearch 或者閘道器進行壓力測試。
Loadgen 的特點:
- 效能強勁
- 輕量級無依賴
- 支援模板化引數隨機
- 支援高併發
- 支援壓測端均衡流量控制
- 支援服務端返回值校驗
當前最新版本為 1.26.1-598,下載連結如下:
https://release.infinilabs.com/loadgen/stable/
下載並解壓安裝包後,得到二進位制檔案。
檢視版本資訊。
$ ./loadgen-linux-amd64 -v
__ ___ _ ___ ___ __ __
/ / /___\/_\ / \/ _ \ /__\/\ \ \
/ / // ///_\\ / /\ / /_\//_\ / \/ /
/ /__/ \_// _ \/ /_// /_\\//__/ /\ /
\____|___/\_/ \_/___,'\____/\__/\_\ \/
[LOADGEN] A http load generator and testing suite.
[LOADGEN] 1.26.1#598, 2024-08-14 04:50:03, 2024-12-31 10:10:10, 00f15fd86834d7ea539f6d66ee608e3915eef0e3
loadgen 1.26.1 598 2024-08-14 04:50:03 +0000 UTC 2024-12-31 10:10:10 +0000 UTC 00f15fd86834d7ea539f6d66ee608e3915eef0e3
Loadgen 測試
Loadgen 使用非常簡單,下面演示如何進行查詢壓測。
- 建立索引,根據節點數調節分片數。
curl -X PUT -H "Content-Type: application/json" \
-ku admin:xxx "https://localhost:9200/loadtest" -d'
{
"settings":{
"number_of_shards":"3",
"number_of_replicas":1,
"translog":{
"durability":"async"
}
}
}'
{"acknowledged":true,"shards_acknowledged":true,"index":"loadtest"}
- 建立
loadgen.dsl.shawnyan
配置檔案,定義查詢
GET loadtest/_search
{"query": {"term": {"id.keyword": {"value": $[[id]]}}}}
- 執行壓測,
-d
表示秒數,-c
表示併發數。
$ ES_ENDPOINT=https://localhost:9200 ES_USERNAME=admin ES_PASSWORD=xxx ./loadgen-linux-amd64 -run loadgen.dsl.shawnyan -d 10 -c 2
__ ___ _ ___ ___ __ __
/ / /___\/_\ / \/ _ \ /__\/\ \ \
/ / // ///_\\ / /\ / /_\//_\ / \/ /
/ /__/ \_// _ \/ /_// /_\\//__/ /\ /
\____|___/\_/ \_/___,'\____/\__/\_\ \/
[LOADGEN] A http load generator and testing suite.
[LOADGEN] 1.26.1#598, 2024-08-14 04:50:03, 2024-12-31 10:10:10, 00f15fd86834d7ea539f6d66ee608e3915eef0e3
[08-19 16:43:27] [INF] [env.go:179] configuration auto reload enabled
[08-19 16:43:27] [INF] [app.go:285] initializing loadgen, pid: 30792
[08-19 16:43:27] [INF] [app.go:286] using config: /data/es/loadgen.yml
[08-19 16:43:27] [INF] [module.go:155] started plugin: statsd
[08-19 16:43:27] [INF] [module.go:161] all modules are started
[08-19 16:43:27] [INF] [instance.go:78] workspace: /data/es/data/loadgen/nodes/cr1gabqr90cng685o2s0
[08-19 16:43:27] [INF] [app.go:511] loadgen is up and running now.
[08-19 16:43:27] [INF] [main.go:403] loading config: /data/es/loadgen.dsl.shawnyan
21108 requests finished in 9.79061677s, 1.08MB sent, 3.22MB received
[Loadgen Client Metrics]
Requests/sec: 2110.63
Request Traffic/sec: 110.22KB
Total Transfer/sec: 440.00KB
Fastest Request: 680.198µs
Slowest Request: 12.409574ms
Status 200: 21108
[Latency Metrics]
10000 samples of 21108 events
Cumulative: 8.732205871s
HMean: 851.869µs
Avg.: 873.22µs
p50: 839.498µs
p75: 914.298µs
p95: 1.059197ms
p99: 1.327098ms
p999: 4.83579ms
Long 5%: 1.394411ms
Short 5%: 724.226µs
Max: 11.618475ms
Min: 680.198µs
Range: 10.938277ms
StdDev: 289.216µs
Rate/sec.: 2110.63
[Latency Distribution]
680µs - 1.774ms ------------------------------
1.774ms - 2.867ms -
2.867ms - 3.961ms -
3.961ms - 5.055ms -
5.055ms - 6.149ms -
6.149ms - 7.243ms -
7.243ms - 8.336ms -
8.336ms - 9.43ms -
9.43ms - 10.524ms -
10.524ms - 11.618ms -
[Estimated Server Metrics]
Requests/sec: 2155.94
Avg Req Time: 927.668µs
Transfer/sec: 449.45KB
更多內容請參閱文件:
https://infinilabs.cn/docs/latest/gateway/getting-started/benchmark/
Rally
如果對 Elasticsearch 熟悉的同學,也可嘗試使用 Rally 對 Easysearch 進行測試。
Rally 是 Elasticsearch 的基準測試框架。它可以幫助您完成以下任務:
- 安裝 Elasticsearch 叢集以進行基準測試
- 跨 Elasticsearch 版本管理基準資料和規範
- 執行基準測試並記錄結果
- 透過連線遙測裝置來查詢效能問題
- 比較效能結果
安裝 Rally。
[root@easysearch /]# pip3 install esrally
Requirement already satisfied: esrally in /usr/local/lib/python3.9/site-packages (2.11.0)
Requirement already satisfied: py-cpuinfo==7.0.0 in /usr/local/lib/python3.9/site-packages (from esrally) (7.0.0)
Requirement already satisfied: elastic-transport==8.4.1 in /usr/local/lib/python3.9/site-packages (from esrally) (8.4.1)
Requirement already satisfied: google-resumable-media[requests]==1.1.0 in /usr/local/lib/python3.9/site-packages (from esrally) (1.1.0)
Requirement already satisfied: urllib3==1.26.18 in /usr/local/lib/python3.9/site-packages (from esrally) (1.26.18)
Requirement already satisfied: google-auth==1.22.1 in /usr/local/lib/python3.9/site-packages (from esrally) (1.22.1)
Requirement already satisfied: thespian==3.10.1 in /usr/local/lib/python3.9/site-packages (from esrally) (3.10.1)
Requirement already satisfied: jsonschema==3.1.1 in /usr/local/lib/python3.9/site-packages (from esrally) (3.1.1)
Requirement already satisfied: markupsafe==2.0.1 in /usr/local/lib64/python3.9/site-packages (from esrally) (2.0.1)
Requirement already satisfied: yappi==1.5.1 in /usr/local/lib64/python3.9/site-packages (from esrally) (1.5.1)
Requirement already satisfied: psutil==5.9.4 in /usr/local/lib64/python3.9/site-packages (from esrally) (5.9.4)
Requirement already satisfied: certifi in /usr/local/lib/python3.9/site-packages (from esrally) (2024.7.4)
Requirement already satisfied: elasticsearch[async]==8.6.1 in /usr/local/lib/python3.9/site-packages (from esrally) (8.6.1)
Requirement already satisfied: ijson==2.6.1 in /usr/local/lib/python3.9/site-packages (from esrally) (2.6.1)
Requirement already satisfied: jinja2==3.1.4 in /usr/local/lib/python3.9/site-packages (from esrally) (3.1.4)
Requirement already satisfied: requests<2.32.0 in /usr/local/lib/python3.9/site-packages (from esrally) (2.31.0)
Requirement already satisfied: tabulate==0.8.9 in /usr/local/lib/python3.9/site-packages (from esrally) (0.8.9)
Requirement already satisfied: zstandard==0.21.0 in /usr/local/lib64/python3.9/site-packages (from esrally) (0.21.0)
Requirement already satisfied: docker==6.0.0 in /usr/local/lib/python3.9/site-packages (from esrally) (6.0.0)
Requirement already satisfied: websocket-client>=0.32.0 in /usr/local/lib/python3.9/site-packages (from docker==6.0.0->esrally) (1.8.0)
Requirement already satisfied: packaging>=14.0 in /usr/lib/python3.9/site-packages (from docker==6.0.0->esrally) (20.9)
Requirement already satisfied: aiohttp<4,>=3 in /usr/local/lib64/python3.9/site-packages (from elasticsearch[async]==8.6.1->esrally) (3.10.4)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.9/site-packages (from google-auth==1.22.1->esrally) (0.4.0)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3.9/site-packages (from google-auth==1.22.1->esrally) (1.15.0)
Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.9/site-packages (from google-auth==1.22.1->esrally) (4.9)
Requirement already satisfied: setuptools>=40.3.0 in /usr/lib/python3.9/site-packages (from google-auth==1.22.1->esrally) (53.0.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.9/site-packages (from google-auth==1.22.1->esrally) (4.2.4)
Requirement already satisfied: google-crc32c<2.0dev,>=1.0 in /usr/local/lib64/python3.9/site-packages (from google-resumable-media[requests]==1.1.0->esrally) (1.5.0)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.9/site-packages (from jsonschema==3.1.1->esrally) (24.2.0)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.9/site-packages (from jsonschema==3.1.1->esrally) (8.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/local/lib64/python3.9/site-packages (from jsonschema==3.1.1->esrally) (0.20.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib64/python3.9/site-packages (from aiohttp<4,>=3->elasticsearch[async]==8.6.1->esrally) (1.9.4)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib64/python3.9/site-packages (from aiohttp<4,>=3->elasticsearch[async]==8.6.1->esrally) (1.4.1)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.9/site-packages (from aiohttp<4,>=3->elasticsearch[async]==8.6.1->esrally) (1.3.1)
Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.9/site-packages (from aiohttp<4,>=3->elasticsearch[async]==8.6.1->esrally) (4.0.3)
Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.9/site-packages (from aiohttp<4,>=3->elasticsearch[async]==8.6.1->esrally) (2.3.7)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib64/python3.9/site-packages (from aiohttp<4,>=3->elasticsearch[async]==8.6.1->esrally) (6.0.5)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/lib/python3.9/site-packages (from packaging>=14.0->docker==6.0.0->esrally) (2.4.7)
Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /usr/local/lib/python3.9/site-packages (from pyasn1-modules>=0.2.1->google-auth==1.22.1->esrally) (0.6.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/site-packages (from requests<2.32.0->esrally) (3.7)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib64/python3.9/site-packages (from requests<2.32.0->esrally) (3.3.2)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/site-packages (from importlib-metadata->jsonschema==3.1.1->esrally) (3.20.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[root@easysearch /]# esrally --version
esrally 2.11.0
[root@easysearch /]#
關於 Rally 的更多內容,請參閱官方文件:
https://esrally.readthedocs.io/en/stable/
作者:少安事務所
原文:https://mp.weixin.qq.com/s/9eEH38kgsw4i150CJqyxvQ