Client Receiving Rate
- Dominant language
- C#
- Stars
- 5.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hi there , i am try to achieve best performance while receiving messages from server.
i want'to know how many messages received in regular client per/second.
My Setup,
-EMQX Broker Inside Docker
-Net Core 6.0 Console App with 4.3.1.873 MQTTNet Nuget Library
-https://github.com/inovex/mqtt-stresser - MQTT Stress Tester App
-İ7 1265U CPU / 32G memory , MQTTNET Application Running in Release Mode
I'am running Inovex Strees Tester with these parameters ,
`docker run --rm inovex/mqtt-stresser -broker tcp://emqx:1883 -username admin -password public -num-clients 200 -num-messages 250 -rampup-delay 0s -rampup-size 200 -global-timeout 180s -timeout 2s -publisher-qos 2`
And this is my net core Implementation
```
var factory = new MqttFactory();
int cnt = 0;
var mqttClient = factory.CreateMqttClient();
var options = new MqttClientOptionsBuilder()
.WithClientId(Guid.NewGuid().ToString())
.WithTcpServer("localhost", 1883)
.WithCredentials("admin", "public")
.Build();
var list = new List();
list.Add(new MqttTopicFilter { Topic = "#" });
await mqttClient.ConnectAsync(options);
await mqttClient.SubscribeAsync(new MqttClientSubscribeOptions()
{
TopicFilters = list,
});
Stopwatch sw = new Stopwatch();
mqttClient.ApplicationMessageReceivedAsync += async e =>
{
if (!e.ApplicationMessage.Topic.Contains('$'))
{
Interlocked.Increment(ref cnt);
if (cnt == 1) { sw.Start(); }
if (cnt == 50000)
{
sw.Stop();
cnt = 0;
await Console.Out.WriteLineAsync(sw.Elapsed.TotalSeconds.ToString());
sw.Reset();
}
}
};
Console.ReadLine();
```
This is Inovex Output

And MQTTNet Client Says - 50K Messages Received in 1.45 / Sec

### Which project is your question related to?
- Client
- Generic
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.