Skip to content

Commit f6b2647

Browse files
authored
Documentation Updates (#188)
1 parent b610d75 commit f6b2647

File tree

2 files changed

+78
-44
lines changed

2 files changed

+78
-44
lines changed

Documentation/docs/benchmarks.md

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ sidebar_position: 90
44

55
# Benchmarks
66

7-
The benchmarks provided in the HiveMQtt GitHub repository are built using BenchmarkDotNet, a .NET library for benchmarking. These benchmarks are designed to measure the performance of various messaging operations against any MQTT broker.
7+
The HiveMQtt GitHub repository provides benchmarks built using BenchmarkDotNet, a .NET library for benchmarking. These benchmarks measure the performance of various messaging operations against any MQTT broker.
8+
9+
810

911
## Running Benchmarks
1012

@@ -17,18 +19,61 @@ dotnet run ClientBenchmarkApp.csproj -c Release
1719

1820
## Results
1921

20-
The benchmarks provide insights into the performance of different messaging methods under various scenarios. Below are the results obtained from running the benchmarks on a local MBP (MacBook Pro) against a HiveMQ v4 broker running in a Docker container over localhost.
22+
The benchmarks provide insights into the performance of different messaging methods under various scenarios. Below are the results obtained from running the benchmarks on a local MacBook Pro against a HiveMQ v4 broker running in a Docker container over localhost.
2123

2224
## Legend
2325

24-
```
25-
Mean : Arithmetic mean of all measurements
26-
Error : Half of 99.9% confidence interval
27-
StdDev : Standard deviation of all measurements
28-
Median : Value separating the higher half of all measurements (50th percentile)
29-
1 us : 1 Microsecond (0.000001 sec)
30-
1 ms : 1,000 Microseconds
31-
```
26+
* **Mean**: Arithmetic mean of all measurements
27+
* **Error**: Half of 99.9% confidence interval
28+
* **StdDev**: Standard deviation of all measurements
29+
* **Median**: Value separating the higher half of all measurements (50th percentile)
30+
* **1 us**: 1 Microsecond (0.000001 sec)
31+
* **1 ms**: 1,000 Microseconds
32+
* <font color="green">Green</font>: Improvement
33+
* <font color="red">Red</font>: Regression
34+
35+
## July 25, 2024
36+
37+
### Summary
38+
39+
The client has had many feature additions and improvements from March 2024 including:
40+
41+
* New Back-pressure support
42+
* Improved QoS reliability
43+
* Improved Async await strategies
44+
* Re-architected internal queues
45+
* Improved event & trigger handling
46+
* All around better error handling
47+
48+
The following table shows the benchmark results compared against previous benchmark runs.
49+
50+
| Method | Alpha | March 2024 | July 2024 |
51+
| ------ | ----- | -------- | -------------- |
52+
| QoS 0 Message | <font color="">4.875 us</font> | <font color="red">9.084 us</font> | <font color="green">5.500 us</font> |
53+
| QoS 1 Message | <font color="">790.645 us</font> | <font color="red">1,357.063 us</font> | <font color="green">982.208 us</font> |
54+
| QoS 2 Message | <font color="">1,653.083 us</font> | <font color="green">1,292.396 us</font> | <font color="green">1,004.854 us</font> |
55+
| 100 QoS 0 @ 256b | No Data | <font color="">79.604 us</font> | <font color="red">100.375 us</font> |
56+
| 100 QoS 1 @ 256b | No Data | <font color="">42,482.520 us</font> | <font color="green">29,661.605 us</font> |
57+
| 100 QoS 2 @ 256b | No Data | <font color="">85,640.167 us</font> | <font color="green">55,474.250 us</font> |
58+
| 100 QoS 0 @ 256k | No Data | <font color="">69.709 us</font> | <font color="red">99.354 us</font> |
59+
| 100 QoS 1 @ 256k | No Data | <font color="">266,506.583 us</font> | <font color="green">215,158.104 us</font> |
60+
| 100 QoS 2 @ 256k | No Data | <font color="">296,254.688 us</font> | <font color="green">227,255.729 us</font> |
61+
62+
### July Benchmark Data
63+
64+
The raw benchmark data from July.
65+
66+
| Method | Mean | Error | StdDev | Median |
67+
|------------------------------------------------- |--------------:|-------------:|--------------:|---------------:|
68+
| 'Publish a QoS 0 message' | 32.59 us | 85.64 us | 252.53 us | 5.500 us |
69+
| 'Publish a QoS 1 message' | 6,323.30 us | 16,671.57 us | 49,156.51 us | 982.208 us |
70+
| 'Publish a QoS 2 message' | 6,554.90 us | 16,998.38 us | 50,120.10 us | 1,004.854 us |
71+
| 'Publish 100 256b length payload QoS 0 messages' | 131.73 us | 92.15 us | 271.71 us | 100.375 us |
72+
| 'Publish 100 256b length payload QoS 1 messages' | 35,405.71 us | 17,183.26 us | 50,665.23 us | 29,661.605 us |
73+
| 'Publish 100 256b length payload QoS 2 messages' | 61,955.04 us | 17,559.19 us | 51,773.66 us | 55,474.250 us |
74+
| 'Publish 100 256k length payload QoS 0 messages' | 129.00 us | 83.24 us | 245.42 us | 99.354 us |
75+
| 'Publish 100 256k length payload QoS 1 messages' | 226,498.28 us | 42,050.59 us | 123,987.13 us | 215,158.104 us |
76+
| 'Publish 100 256k length payload QoS 2 messages' | 244,227.03 us | 47,932.40 us | 141,329.77 us | 227,255.729 us |
3277

3378
## Mar 22, 2024
3479

@@ -50,7 +95,17 @@ See also: [What is MQTT Quality of Service (QoS) 0,1, & 2? – MQTT Essentials:
5095

5196
## Mar 21, 2024
5297

53-
With release [v0.11.0](https://github.com/hivemq/hivemq-mqtt-client-dotnet/releases/tag/v0.11.0) there was a big performance improvement. All messaging performance was improved but particularly publishing a QoS level 2 message went from ~206ms down to ~1.6ms.
98+
With release [v0.11.0](https://github.com/hivemq/hivemq-mqtt-client-dotnet/releases/tag/v0.11.0) there was a big performance improvement. All messaging performance was improved but particularly publishing a **QoS level 2 message went from ~206ms down to ~1.6ms**.
99+
100+
### Summary
101+
102+
From the early version through two refactors, this table summarizes the performance improvements.
103+
104+
| Method | Original | First Pass Refactor | Final Refactor |
105+
| ------ | -------- | ------------------- | -------------- |
106+
| QoS 0 Message | <font color="red">5.646 us</font> | 9.250 us | <font color="green">4.875 us</font> |
107+
| QoS 1 Message | <font color="red">103,536.375 us</font> | 1,324.251 us | <font color="green">790.645 us</font> |
108+
| QoS 2 Message | <font color="red">206,959.834 us</font> | 2,569.166 us | <font color="green">1,653.083 us</font> |
54109

55110
### Previous Performance
56111

Documentation/docs/connecting.md

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var client = new HiveMQClient();
1818
var connectResult = await client.ConnectAsync().ConfigureAwait(false);
1919
```
2020

21-
## With Options
21+
## With Specific Options
2222

2323
The `HiveMQClientOptions` class provides a set of options that can be used to configure various aspects of the `HiveMQClient`.
2424

@@ -35,44 +35,23 @@ var client = new HiveMQClient(options);
3535
var connectResult = await client.ConnectAsync().ConfigureAwait(false);
3636
```
3737

38-
## `HiveMQClientOptionsBuilder` Reference
39-
40-
To illustrate _each and every possible call_ with `HiveMQClientOptionsBuilder`, see the following example:
38+
## With Automatic Reconnect
4139

4240
```csharp
43-
using HiveMQtt.MQTT5.Types; // For QualityOfService enum
44-
45-
var options = new HiveMQClientOptionsBuilder()
46-
.WithBroker("broker.hivemq.com")
47-
.WithPort(1883)
48-
.WithClientId("myClientId")
49-
.WithAllowInvalidBrokerCertificates(true)
50-
.WithUseTls(true)
51-
.WithCleanStart(true)
52-
.WithKeepAlive(60)
53-
.WithAuthenticationMethod("UsernamePassword")
54-
.WithAuthenticationData(Encoding.UTF8.GetBytes("authenticationData"))
55-
.WithUserProperty("property1", "value1")
56-
.WithUserProperties(new Dictionary<string, string> { { "property1", "value1" }, { "property2", "value2" } })
57-
.WithLastWill(new LastWillAndTestament {
58-
Topic = "lwt/topic",
59-
PayloadAsString = "LWT message",
60-
QoS = QualityOfService.AtLeastOnceDelivery,
61-
Retain = true })
62-
.WithMaximumPacketSize(1024)
63-
.WithReceiveMaximum(100)
64-
.WithSessionExpiryInterval(3600)
65-
.WithUserName("myUserName")
66-
.WithPassword("myPassword")
67-
.WithPreferIPv6(true)
68-
.WithTopicAliasMaximum(10)
69-
.WithRequestProblemInformation(true)
70-
.WithRequestResponseInformation(true)
71-
.Build();
41+
var options = new HiveMQClientOptionsBuilder().
42+
WithBroker('candy.x39.eu.hivemq.cloud').
43+
WithAutomaticReconnect(true)
44+
Build();
45+
46+
var client = new HiveMQClient(options);
47+
var connectResult = await client.ConnectAsync().ConfigureAwait(false);
7248
```
7349

50+
7451
## See Also
7552

53+
* [HiveMQClientOptionsBuilder Reference](/docs/reference/client_options_builder)
54+
* [Automatic Reconnect](/docs/reference/automatic_reconnect)
7655
* [How to Set a Last Will & Testament](/docs/how-to/set-lwt)
7756
* [Connect with TLS but allow Invalid TLS Certificates](/docs/how-to/allow-invalid-certs)
7857
* [Securely Connect to a Broker with Basic Authentication Credentials](/docs/how-to/connect-with-auth)

0 commit comments

Comments
 (0)