sociomantic-tsunami / swarm

Asynchronous client/node framework library
Boost Software License 1.0
14 stars 26 forks source link

Add framework for per-request throughput stats (client) #361

Closed gavin-norman-sociomantic closed 5 years ago

gavin-norman-sociomantic commented 6 years ago

Applications commonly want to monitor the throughput of their stream / batch requests. It would be nice to support this in the client directly.

Update: This feature is only required if we need per-request throughput stats, at some point. We already have per-connection throughput stats: https://github.com/sociomantic-tsunami/swarm/blob/v5.x.x/src/swarm/neo/client/mixins/ClientCore.d#L420

gavin-norman-sociomantic commented 6 years ago

Two ways of implementing this that come to mind:

  1. An extra method in the controller, giving access to stats on demand.
  2. An extra notification type that is called periodically (once a second, say), providing stats to the user.
gavin-norman-sociomantic commented 6 years ago

Another idea:

gavin-norman-sociomantic commented 6 years ago

Allow request handlers to access this, look up the request, and update the stats.

This is the only tricky part of the above suggestion. Currently, request handlers have no access to anything at the level of the request set. The request-on-conn would be a possible way to pass a ref to the stats tracker, but that sounds a little bit on the edge of hacky.

gavin-norman-sociomantic commented 6 years ago

Currently, request handlers have no access to anything at the level of the request set.

My top-of-the-head knowledge of the neo client isn't as fresh as it used to be :( The request context forms this conduit between the request set and the individual handlers.

gavin-norman-sociomantic commented 6 years ago

Actually, we already have stats for connection I/O throughput. This might be enough, in practice.

gavin-norman-sociomantic commented 5 years ago

Closing. No current use case.