Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bench. #878

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
endppoint constructor 4th parameter `async_operation` is used.
set_async_operation() can overwrite the async_operation.
It should be called before sending any packets.
* Implemented clean shutdown (WS TLS TCP) (#849, 860, #863, #864)
* Implemented clean shutdown (WS TLS TCP) (#849, #860, #863, #864)
* Improved build system (#859)
* Added DISCONNECT with session taken over reason code (#847)
* Improved tests (#845, #846, #852)
Expand Down
2 changes: 2 additions & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ LIST (APPEND exec_PROGRAMS
long_lived_client.cpp
redirect.cpp
broker.cpp
bench.cpp
)

FIND_PACKAGE (Boost 1.67.0 REQUIRED COMPONENTS program_options)
Expand Down Expand Up @@ -69,6 +70,7 @@ FOREACH (source_file ${exec_PROGRAMS})
ENDFOREACH ()

FILE(COPY broker.conf DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
FILE(COPY bench.conf DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
FILE(COPY ../test/certs/mosquitto.org.crt DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
FILE(COPY ../test/certs/server.crt.pem DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
FILE(COPY ../test/certs/server.key.pem DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" )
Expand Down
107 changes: 107 additions & 0 deletions example/bench.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
## connection settings

# hostname or IP address of the target broker
host=localhost

# MQTT typical port is 1883. MQTTS typical port is 8883
port=1883

# mqtt, mqtts, ws, or wss
protocol=mqtt

# v3.1.1 or v5
mqtt_version=v5

# MQTT username for all clients
#usermane=user1

# MQTT password for all clients
#password=mypassword

# MQTT Client Identifier prefix. actual Client Identifier is cid_prefix00000000 cid_prefix00000001 ...
#cid_prefix=cid

# MQTT topic (name and filter) prefix. actual topic is topic_prefix00000000 topic_prefix00000001 ...
#topic_prefix=cid

# CA certificate file. it is used only protocol mqtts and wss
#cacert=cacert.pem

# Web-Scoket path. it is used only protocol ws and wss
#ws_path=/



## bench performance settings
# 0 means automatic

# Num of vCPU
iocs=0

# min(4 or Num of vCPU)
threads_per_ioc=0



## publish load settings
# number of publishes for each client. after all published, the benci will finish
times=1

# number of clients for connection
clients=1

# MQTT QoS 0,1, or 2
qos=0

# size of payload.
payload_size=1024

# publish interval for each client
pub_interval_ms=10

# MQTT retain true or false
retain=false

# MQTT CleanStart(v5) CleanSession(v3.1.1). true or false
clean_start=true

# MQTT v5 Session Expiry Interval (seconds)
sei=0

# number of idling publish for each client. some of broker cache publish permission.
# so only the first publish could take a long time.
# idling publish is out of report
pub_idle_count=1

## connect and subscribe delay and interval setting

# interval for each connect
con_interval_ms=10

# interval for each subscribe
sub_interval_ms=10

# after all connections are established, wait the delay milliseconds before start subscribe
sub_delay_ms=1000

# after all subscriptions are finished, wait the delay milliseconds before start publish
pub_delay_ms=1000

# note pub_delay_ms is written is publish load settings



## report settings

# true or false. if true, individual connections min mid max are reported
detail_report=false

# true or false. if true, published payload and received payload are compared and report if it doesn't match
compare=false

# time limit between published packet sent and received. if it is greater than the limit then reported
limit_ms=1000

# log level. 0 to 5. fatal, error, warning, info, debug, and trace
# 0 1 2 3 4 5
verbose=2
Loading