The benchmark-tool is used to run benchmark tests on ditto.
It is implemented using the load-testing tool [k6](https://github.com/grafana/k6) with the [xk6-kafka extension](https://github.com/mostafa/xk6-kafka).
[MMock](https://github.com/jmartin82/mmock) is used to mock http responses, it exposes 2 endpoints that are configurable via mmock/default.yaml and mmock/live_messages.yaml. Default values are /:thingId and /live_messages and they are used to publish [modified twin events](https://eclipse.dev/ditto/protocol-specification-things-create-or-modify.html#event-1) and [device live messages](https://eclipse.dev/ditto/protocol-twinlive.html#live) sent via HTTP POST request.
###### The benchmark test consists of 4 tests available to run, called scenarios:
- **READ_THINGS** - read things via HTTP ( get things by id )
- **SEARCH_THINGS** - search things via HTTP ( get things by applying search filter )
- **MODIFY_THINGS** - Modify things by sending ditto protocol [modify messages](https://eclipse.dev/ditto/protocol-specification-things-create-or-modify.html#create-or-modify-a-thing) to specfic kafka topic. Ditto kafka connection is reading from this topic and creates [modify commands](https://eclipse.dev/ditto/basic-signals-command.html#modify-commands). [Ditto HTTP push connection](https://eclipse.dev/ditto/connectivity-protocol-bindings-http.html) is configured in ditto, which forwards the [modified twin events](https://eclipse.dev/ditto/protocol-specification-things-create-or-modify.html#event-1) from topic **/things/twin/events?filter=eq(topic:action,'modified')** to a monster mock endpoint, which replies with HTTP status code 204.
- **DEVICE_LIVE_MESSAGES** - Send [live messages](https://eclipse.dev/ditto/protocol-twinlive.html#live) to things via HTTP. [Ditto HTTP push connection](https://eclipse.dev/ditto/connectivity-protocol-bindings-http.html) connection is configured in ditto, which sends events from topic **/things/live/messages** to a monster mock endpoint, which replies with predefined ditto protocol message.
Also, there is a special scenario called **WARMUP**, which is used to warmup the system, by executing a single read request for each thing, which will cause them to get cached.
# Getting started:
## K6 is configurable via environment variables and the following must be set, in order to run the test(sample variables in [test-local.env](https://github.com/eclipse-ditto/ditto/blob/master/benchmark-tool/test-local.env) file):
## K6 test related
| Name | Description |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SETUP_TIMEOUT | Specify how long the k6 setup() function is allow to run before it's terminated |
| TEARDOWN_TIMEOUT | Specify how long the k6 teardown() function is allowed to run before it's terminated |
| THINGS_NAMESPACE | Namepsace to use for created ditto things |
| THINGS_ID_TEMPLATE | Things id template, f.e. 'my-thing-{0}' |
| THINGS_START_INDEX | Things start index, used in template, f.e. if start index is 1, created things have name of: 'my-thing-1', 'my-thing-2', etc. |
| CREATE_THINGS_BATCH_SIZE | Creating things is done via implicitThingCreationMapper via kafka connection. The kafka messages are sent in batches and this variable sets the batch size. |
| CREATE_THINGS | If the test should create things, before executing the scenarios (0/1) |
| DELETE_THINGS | If the test should delete the things, after executing the scenarios (0/1) |
| KAFKA_PRODUCER_LOGGER_ENABLED | K6 kafka producer logger enabled (0/1) |
| KAFKA_CONSUMER_LOGGER_ENABLED | K6 kafka consumer logger enabled (0/1) |
| CREATE_DITTO_CONNECTIONS | If the test should create the needed for scenarios ditto connections, before executing the scenarios |
| DELETE_DITTO_CONNECTIONS | If the test should delete the needed for scenarios ditto connections, after executing the scenarios |
| CONNECTION_OPEN_MAX_RETRIES | Maximum times connection status is fetched to check if its opened. If connection is still not opened after, the test gets aborted.|
| SCENARIOS_TO_RUN | Array of scenarios names that should run, available options is: WARMUP, DEVICE_LIVE_MESSAGES, SERACH_THINGS, READ_THINGS, MODIFY_THINGS |
| CREATE_THINGS_LOG_REMAINING | Log the remaining things that need to be created. Useful for debugging purposes |
| THINGS_WARMUP_BATCH_SIZE | Max number of simultaneous connections of a k6 http.batch() call, which is used for warming up things |
## Ditto related
| Name | Description |
| ------------------------------- | ---------------------------------- |
| DITO_API_URI | Ditto api url |
| DITTO_DEVOPS_AUTH_HEADER | Devops user authorization header name |
| DITTO_DEVOPS_AUTH_HEADER_VALUE | Devops user authorization header value |
| DITTO_PRE_AUTHENTICATED_HEADER_VALUE | Ditto x-ditto-pre-authenticated header value. https://eclipse.dev/ditto/installation-operating.html#pre-authentication |
## Kafka related
| Name | Description |
| ----------------------- | -------------------------------- |
| KAFKA_BOOTSTRAP_SERVERS | Array of kafka bootstrap servers |
## Scenarios related
###### WARMUP
| Name | Description |
| ------------------- | -------------------------------------------------------------------------------------------- |
| WARMUP_MAX_DURATION | The maximum duration of warmup scenario. After, the scenario will be forcefully stopped |
| WARMUP_START_TIME | Time offset since the start of the test, at which point this scenario should begin execution |
###### Every other scenario has the same config variables, created by suffixing the variable name with the name of the scenario, f.e. SEARCH_THINGS_DURATION
| Name | Description |
| ------------------ | -------------------------------------------------------------------------------------------------- |
| _DURATION | Total scenario duration. |
| _PER_SECOND | Number of requests to execute per second. For kafka scenarios number of kafka messages per second. |
| _PRE_ALLOCATED_VUS | Number of VUs to pre-allocate before scenario start to preserve runtime reso
没有合适的资源?快使用搜索试试~ 我知道了~
Eclipse Ditto:Eclipse IoT 的数字孪生框架 - 主存储库
共2000个文件
java:1186个
md:687个
html:55个
需积分: 5 0 下载量 116 浏览量
2024-09-14
11:14:28
上传
评论
收藏 19.11MB ZIP 举报
温馨提示
为了通过Docker Compose启动 Ditto ,你需要: 正在运行的 Docker 守护进程 已安装 Docker Compose 对于本地机器上的“单实例”设置: 至少有 2 个 CPU 核心可供 Docker 使用 至少 4 GB 的 RAM 可供 Docker 使用 为了从 Docker Hub 启动最新构建的 Docker 镜像,只需执行: cd deployment/docker/ docker-compose up -d 启动后查看日志: docker-compose logs -f
资源推荐
资源详情
资源评论
收起资源包目录
Eclipse Ditto:Eclipse IoT 的数字孪生框架 - 主存储库 (2000个子文件)
customstyles.css 24KB
docson.css 9KB
theme-ditto.css 4KB
syntax.css 4KB
printstyles.css 3KB
theme-blue.css 3KB
theme-green.css 2KB
modern-business.css 1KB
swagger.css 1KB
boxshadowproperties.css 475B
index.html 33KB
index.html 31KB
index.html 30KB
index.html 28KB
index.html 25KB
index.html 23KB
index.html 21KB
index.html 20KB
index.html 16KB
index.html 16KB
index.html 15KB
index.html 15KB
index.html 15KB
index.html 14KB
index.html 14KB
index.html 6KB
index.html 6KB
box.html 6KB
topnav.html 5KB
sidebar.html 4KB
ditto-extension.html 4KB
signature.html 3KB
head.html 3KB
page.html 2KB
post.html 2KB
footer.html 2KB
blog.html 2KB
head_print.html 2KB
links.html 1KB
taglogic.html 1KB
default.html 1KB
http-api-doc.html 1KB
swagger_layout.html 1KB
blog_archive.html 938B
toc.html 684B
start.html 671B
feedback.html 608B
google_analytics.html 516B
image.html 486B
default_print.html 439B
external_image.html 385B
page_print.html 320B
youtube.html 252B
archive.html 177B
important.html 171B
warning.html 143B
tip.html 136B
note.html 132B
callout.html 94B
file.html 87B
protocolexample.html 77B
docson.html 77B
inline_image.html 75B
google459c4cca88b3ce46.html 54B
none.html 19B
BaseClientActor.java 115KB
ThingEventAdapterTest.java 81KB
JavaScriptMessageMapperRhinoTest.java 74KB
ThingModifyCommandResponseAdapterTest.java 70KB
ConnectionPersistenceActorTest.java 68KB
ConnectionPersistenceActor.java 62KB
HttpPublisherActorTest.java 60KB
OutboundMappingProcessorActor.java 53KB
TestConstants.java 53KB
ThingModifyCommandAdapterTest.java 52KB
AmqpClientActorTest.java 50KB
InboundDispatchingSink.java 48KB
MessageMappingProcessorActorTest.java 44KB
AmqpClientActor.java 44KB
MappingContextTest.java 43KB
ConnectivityModelFactory.java 43KB
BaseClientActorTest.java 41KB
DittoProtocolAdapterTest.java 36KB
HttpPublisherActor.java 35KB
MqttClientActorTest.java 34KB
BasePublisherActor.java 33KB
ConnectionValidatorTest.java 33KB
AmqpConsumerActorTest.java 32KB
ThingQueryCommandAdapterTest.java 32KB
ConnectionTesterActor.java 32KB
ConnectionLoggerRegistry.java 31KB
GenericMqttPublishTest.java 29KB
MappingContext.java 29KB
ThingQueryCommandResponseAdapterTest.java 28KB
AmqpPublisherActorTest.java 28KB
RabbitMQClientActor.java 28KB
MqttConsumerActorTest.java 27KB
AmqpPublisherActor.java 27KB
MqttClientActor.java 26KB
ConnectionTesterActorTest.java 26KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
余十步
- 粉丝: 1675
- 资源: 172
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功