GithubHelp home page GithubHelp logo

Comments (3)

TodorokiKohei avatar TodorokiKohei commented on July 21, 2024

キュー内のメッセージについて

キューサイズの変更

受信した未処理のメッセージが挿入されるキューはCommsCallbackクラスのmessageQueueフィールドである。このキューのサイズは10で固定されている。このサイズが小さいままではメッセージ処理を詰まると、メッセージ受信の処理が滞ってしまう(参照)ため、可変にする必要がある。

今回はMqttAsyncClientクライアントにリサイズメソッドを実装して内部のCommsCallbackまで伝搬させる。キューのリサイズはRecieverが実行状態になる前のみ受け付ける。

flowchart TB
  MqttAsyncClient.resizeReceiverQueueSize --> ClientComms.resizeReceiverQueueSize --> CommsCallback.resizeReceiverQueueSize
Loading

キュー内のメッセージ数の取得

PingSenderClientCommsにしかアクセスできないため、ClientComms経由でCommsCallbackのキュー内のメッセージ数を取得する。

flowchart TB
ClientComms.getNumberOfMsgsUnprocessed --> CommsCallback.getNumberOfMsgsInQueue
Loading

from mqttv5-client.

TodorokiKohei avatar TodorokiKohei commented on July 21, 2024

メッセージ処理時間について

メッセージ処理時間の計測方法には以下の2種類がある。

  1. 内部(CommsCallback.run)でキューからメッセージを取り出し、処理完了までの時間を計測
  2. アプリケーション実装者がMqttCallback.messageArrivedでメッセージ処理時間を計測

今回は2つ目で計測を行い、PingSenderに処理時間を渡す。

from mqttv5-client.

TodorokiKohei avatar TodorokiKohei commented on July 21, 2024

上記2つのデータを送信するPingSenderの実装

ExtendedPingSenderを継承したStatusPingSenderを実装した。このクラスは以下の2つのデータをJSON形式にして送信する。

  • CommsCallbackのキュー内のメッセージ
  • バッファした100個のメッセージ処理時間の平均

以下のような実行結果になっている。
image

from mqttv5-client.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.