Redis基准规范描述了跨语言/工具的要求和期望,旨在促进围绕Redis相关技术的性能和可观察性标准。鼓励来自工业和学术界,包括组织和个人的成员贡献。
项目描述
基准规范目标
Redis基准规范描述了跨语言/工具的要求和期望,旨在促进围绕Redis相关技术的性能和可观察性标准。
来自工业和学术界,包括组织和个人的成员被鼓励贡献力量。
目前,以下成员积极支持此项目
- Redis Ltd. 通过Redis性能组:提供稳定的平台来运行基准套件。在公司内支持此项目的积极开发。
- Intel.:英特尔正在托管一个本地服务器集群,专门用于始终开启的自动性能测试。
范围
此仓库旨在提供Redis相关基准标准和方法的
-
跨不同配置管理基准数据规格
-
运行基准测试并记录结果
-
以多种格式(CSV、RedisTimeSeries、JSON)导出性能结果
-
通过附加分析工具/探测器(perf(即perf_events)、bpf工具、vtune)查找CPU、非CPU、I/O和线程性能问题
-
通过附加遥测探测器查找性能问题
当前支持的基准工具
安装和执行
Redis基准规格和实现是为Unix开发的,并在其上积极测试。要访问最新的SPEC和工具实现,您只需安装一个Python包即可。
在安装包之前,请安装其依赖项。
安装包要求
# install pip installer for python3
sudo apt install python3-pip -y
sudo pip3 install --upgrade pip
sudo pip3 install pyopenssl --upgrade
# install docker
sudo apt install docker.io -y
# install supervisord
sudo apt install supervisor -y
安装Redis基准规范
使用pip(Python的包安装程序)以以下方式执行安装
python3 -m pip install redis-benchmarks-specification --ignore-installed PyYAML
要运行特定版本,请使用其数字,例如0.1.57
pip3 install redis-benchmarks-specification==0.1.57
测试redis-benchmarks-spec-client-runner
有一种选项可以通过独立运行器方法运行“redis-benchmarks-spec”测试。为此,redis-benchmarks-specificaiton应与redis-server同时运行。
# Run redis server
[taskset -c cpu] /src/redis-server --port 6379 --dir logs --logfile server.log --save "" [--daemonize yes]
# Run benchmark
redis-benchmarks-spec-client-runner --db_server_host localhost --db_server_port 6379 --client_aggregated_results_folder ./test
使用taskset启动redis-server将其固定到特定CPU并获取更一致的结果。将“--daemonize yes”选项提供给服务器运行命令允许在后台运行redis-server。
将“--test X.yml”选项提供给基准执行命令允许运行特定测试,其中X为测试名称
使用“-h”选项可以获取完整的选项列表
$ redis-benchmarks-spec-client-runner -h
usage: redis-benchmarks-spec-client-runner [-h]
[--platform-name PLATFORM_NAME]
[--triggering_env TRIGGERING_ENV]
[--setup_type SETUP_TYPE]
[--github_repo GITHUB_REPO]
[--github_org GITHUB_ORG]
[--github_version GITHUB_VERSION]
[--logname LOGNAME]
[--test-suites-folder TEST_SUITES_FOLDER]
[--test TEST]
[--db_server_host DB_SERVER_HOST]
[--db_server_port DB_SERVER_PORT]
[--cpuset_start_pos CPUSET_START_POS]
[--datasink_redistimeseries_host DATASINK_REDISTIMESERIES_HOST]
[--datasink_redistimeseries_port DATASINK_REDISTIMESERIES_PORT]
[--datasink_redistimeseries_pass DATASINK_REDISTIMESERIES_PASS]
[--datasink_redistimeseries_user DATASINK_REDISTIMESERIES_USER]
[--datasink_push_results_redistimeseries] [--profilers PROFILERS]
[--enable-profilers] [--flushall_on_every_test_start]
[--flushall_on_every_test_end]
[--preserve_temporary_client_dirs]
[--client_aggregated_results_folder CLIENT_AGGREGATED_RESULTS_FOLDER]
[--tls]
[--tls-skip-verify]
[--cert CERT]
[--key KEY]
[--cacert CACERT]
redis-benchmarks-spec-client-runner (solely client) 0.1.61
...
测试redis-benchmarks-spec-sc-coordinator
运行redis-server的另一种方法是通过redis-benchmarks协调器运行
现在您应该能够打印以下已安装的基准运行器帮助
$ redis-benchmarks-spec-sc-coordinator -h
usage: redis-benchmarks-spec-sc-coordinator [-h] --event_stream_host
EVENT_STREAM_HOST
--event_stream_port
EVENT_STREAM_PORT
--event_stream_pass
EVENT_STREAM_PASS
--event_stream_user
EVENT_STREAM_USER
[--cpu-count CPU_COUNT]
[--platform-name PLATFORM_NAME]
[--logname LOGNAME]
[--consumer-start-id CONSUMER_START_ID]
[--setups-folder SETUPS_FOLDER]
[--test-suites-folder TEST_SUITES_FOLDER]
[--datasink_redistimeseries_host DATASINK_REDISTIMESERIES_HOST]
[--datasink_redistimeseries_port DATASINK_REDISTIMESERIES_PORT]
[--datasink_redistimeseries_pass DATASINK_REDISTIMESERIES_PASS]
[--datasink_redistimeseries_user DATASINK_REDISTIMESERIES_USER]
[--datasink_push_results_redistimeseries]
redis-benchmarks-spec runner(self-contained) 0.1.13
optional arguments:
-h, --help show this help message and exit
--event_stream_host EVENT_STREAM_HOST
--event_stream_port EVENT_STREAM_PORT
--event_stream_pass EVENT_STREAM_PASS
--event_stream_user EVENT_STREAM_USER
--cpu-count CPU_COUNT
Specify how much of the available CPU resources the
coordinator can use. (default: 8)
--platform-name PLATFORM_NAME
Specify the running platform name. By default it will
use the machine name. (default: fco-ThinkPad-T490)
--logname LOGNAME logname to write the logs to (default: None)
--consumer-start-id CONSUMER_START_ID
--setups-folder SETUPS_FOLDER
Setups folder, containing the build environment
variations sub-folder that we use to trigger different
build artifacts (default: /home/fco/redislabs/redis-
benchmarks-
specification/redis_benchmarks_specification/setups)
--test-suites-folder TEST_SUITES_FOLDER
Test suites folder, containing the different test
variations (default: /home/fco/redislabs/redis-
benchmarks-
specification/redis_benchmarks_specification/test-
suites)
--datasink_redistimeseries_host DATASINK_REDISTIMESERIES_HOST
--datasink_redistimeseries_port DATASINK_REDISTIMESERIES_PORT
--datasink_redistimeseries_pass DATASINK_REDISTIMESERIES_PASS
--datasink_redistimeseries_user DATASINK_REDISTIMESERIES_USER
--datasink_push_results_redistimeseries
uploads the results to RedisTimeSeries. Proper
credentials are required (default: False)
请注意,运行基准协调器的最小参数是:--event_stream_host
、--event_stream_port
、--event_stream_pass
、--event_stream_user
。您应使用提供的凭据来访问事件流。除此之外,您还需要与性能组讨论将用于展示结果、协调工作等唯一平台名称。
如果一切按预期进行,则在运行具有凭据的工具时应看到以下示例日志
$ poetry run redis-benchmarks-spec-sc-coordinator --platform-name example-platform \
--event_stream_host <...> \
--event_stream_port <...> \
--event_stream_pass <...> \
--event_stream_user <...>
2021-09-22 10:47:12 INFO redis-benchmarks-spec runner(self-contained) 0.1.13
2021-09-22 10:47:12 INFO Using topologies folder dir /home/fco/redislabs/redis-benchmarks-specification/redis_benchmarks_specification/setups/topologies
2021-09-22 10:47:12 INFO Reading topologies specifications from: /home/fco/redislabs/redis-benchmarks-specification/redis_benchmarks_specification/setups/topologies/topologies.yml
2021-09-22 10:47:12 INFO Using test-suites folder dir /home/fco/redislabs/redis-benchmarks-specification/redis_benchmarks_specification/test-suites
2021-09-22 10:47:12 INFO Running all specified benchmarks: /home/fco/redislabs/redis-benchmarks-specification/redis_benchmarks_specification/test-suites/redis-benchmark-full-suite-1Mkeys-100B.yml
2021-09-22 10:47:12 INFO There are a total of 1 test-suites in folder /home/fco/redislabs/redis-benchmarks-specification/redis_benchmarks_specification/test-suites
2021-09-22 10:47:12 INFO Reading event streams from: <...>:<...> with user <...>
2021-09-22 10:47:12 INFO checking build spec requirements
2021-09-22 10:47:12 INFO Will use consumer group named runners-cg:redis/redis/commits-example-platform.
2021-09-22 10:47:12 INFO Created consumer group named runners-cg:redis/redis/commits-example-platform to distribute work.
2021-09-22 10:47:12 INFO Entering blocking read waiting for work.
您现在正在积极监听对Redis的基准测试请求!
架构图
简要描述,github.com/redis/redis上游更改触发包含相关git信息的HTTP API调用。
然后,HTTP请求被转换为事件(在redis中跟踪),这将根据在platforms
中描述的不同平台触发多个构建变体请求。
一旦收到新的构建变体请求,构建代理(redis-benchmarks-spec-builder
)准备工件,然后添加工件基准事件,以便基准测试协调器(redis-benchmarks-spec-sc-coordinator
)可以部署/管理所需的架构和数据库拓扑,运行基准测试,并导出性能结果。
目录布局
规范
以下是当前可用规格的高级状态报告。
-
redis_benchmarks_specification
test-suites
:包含基准套件定义,指定目标redis拓扑、测试命令、要使用的基准工具(客户端)以及需要时预加载数据集步骤。
-
redis_benchmarks_specification/setups
platforms
:包含被认为是提供稳定稳定结果的标准平台,以及代表常见的部署目标。topologies
:包含与拓扑定义相关的标准部署拓扑定义以及最小规格。builders
:包含构建环境变体,允许使用不同的编译器、编译器标志、库等构建Redis。
规范工具实现
以下是目前可用的规范实现的高级状态报告。
-
状态:实验性
redis-benchmarks-spec-api
:包含将github.com/redis/redis上游更改触发的POST HTTP请求转换为API的代码,并获取相关的git/source信息并将其转换为事件(在redis中跟踪)。 -
状态:实验性
redis-benchmarks-spec-builder
:包含基准构建代理实用工具,该工具接收指示新构建变体的事件,生成所需的redis二进制文件以进行测试,并在侦听代理上触发基准运行。 -
状态:实验性
redis-benchmarks-spec-sc-coordinator
:包含协调器实用工具,该工具侦听基准套件运行请求,设置所需的步骤来旋转实际的基准拓扑并触发实际的基准测试。 -
状态:实验性
redis-benchmarks-spec-client-runner
:包含客户端实用工具,该工具触发针对提供的端点的实际基准测试。此工具不依赖于设置,并期望在之前正确启动数据库。
贡献指南
添加新的测试套件
待定
添加新的拓扑
待定
加入性能倡议并添加持续基准平台
加入性能倡议
为了加入性能倡议,唯一的要求是您提供一个稳定的基础设施平台来运行基准套件,并且您通过performance <at> redis <dot> com
联系Redis性能倡议的一位成员,以便我们可以为您提供所需的机密信息以积极监听基准事件。
如果您查看上述“架构图”,这意味着您只需运行架构的最后一个移动部分,即您将有一个或多个基准协调器机器积极运行基准测试并将结果推送到我们的数据池。
添加持续基准平台
为了能够在平台上运行基准测试,您需要python3的pip安装程序和docker。除此之外,我们建议您通过进程监控工具(如supervisorctl、lauchd、daemon tools或其他)管理redis-benchmarks-spec-sc-coordinator
进程的状态。
对于本示例,我们依赖于supervisorctl
进行进程管理。
将redis-benchmarks-spec-sc-coordinator添加到supervisord
让我们添加如下supervisord条目
vi /etc/supervisor/conf.d/redis-benchmarks-spec-sc-coordinator-1.conf
您可以使用以下模板并根据您的凭据进行更新
[supervisord]
loglevel = debug
[program:redis-benchmarks-spec-sc-coordinator]
command = redis-benchmarks-spec-sc-coordinator --platform-name bicx02 \
--event_stream_host <...> \
--event_stream_port <...> \
--event_stream_pass <...> \
--event_stream_user <...> \
--datasink_push_results_redistimeseries \
--datasink_redistimeseries_host <...> \
--datasink_redistimeseries_port <...> \
--datasink_redistimeseries_pass <...> \
--logname /var/opt/redis-benchmarks-spec-sc-coordinator-1.log
startsecs = 0
autorestart = true
startretries = 1
在编辑配置文件后,只需重新加载并确认基准运行程序是活跃的
:~# supervisorctl reload
Restarted supervisord
:~# supervisorctl status
redis-benchmarks-spec-sc-coordinator RUNNING pid 27842, uptime 0:00:00
开发
- 安装pypoetry来管理您的依赖关系并触发工具。
pip install poetry
- 从锁定文件中安装依赖项
poetry install
运行格式化器
poetry run black .
运行linters
poetry run flake8
运行测试
提供了一个测试套件,可以使用以下方式运行
$ pip3 install -r ./dev_requirements.txt
$ tox
运行特定测试
$ tox -- utils/tests/test_runner.py
以详细日志记录运行特定测试
$ tox -- -vv --log-cli-level=INFO utils/tests/test_runner.py
许可证
redis-benchmarks-specification遵循BSD3许可协议 - 请参阅LICENSE
项目详情
redis_benchmarks_specification-0.1.246.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2f9171ad840b8eac71471a571d482f3bb6c1ddedf025e1648f1749ed03ec821f |
|
MD5 | 6c8f054563176838863a6d6cb51231b0 |
|
BLAKE2b-256 | 1cefa853ae72c5a2b9840ed2e93faf25202cd810f771f58ec842a1a08bcc4479 |
redis_benchmarks_specification-0.1.246-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5d1c124348dfeed9dfd405aedda9dee3949fc9987eec594ccf1312e52fcaa9d1 |
|
MD5 | ae613ca8cdf4fac0519fb3ccbc29708e |
|
BLAKE2b-256 | 84be60aff8eb3a9ca7a5ac8cf003c8ecbd455fa41bd6435f6a53b984ab756412 |