-
Notifications
You must be signed in to change notification settings - Fork 22
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
Track internode msg bytes #1081
Conversation
|
@@ -28,6 +29,12 @@ | |||
*/ | |||
public final class SensorsCustomParams | |||
{ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit unclean, what about passing the keyspace via the existing executor locals mechanism? I.e. we could add a RequestTracker
method to register/retrieve keyspaces involved in the current request, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. AFAIK RequestTracker
would map 1:1
with the keyspace so will add it to the constructor.
*/ | ||
public Context(String keyspace) | ||
{ | ||
this(keyspace, null, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for not being great at remembering things (one more reason I guess to recap our discussions on github), but can you remind me why don't we also track table information?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Batch writes (one idea to mitigate this is to divide bytes and counts equally between tables)
- The life cycle of
RequestSensors
today (from sensor registration to synchronizing the sensors registry) begins onVerbHandler#doVerb
and ends on the callback. To track per table, two complexities arise:- There will be need to synchronize sensors values outside the verb handler boundary
- We embed sensor value in the response message, that would require somehow injecting the sensor values into the message at the
OutboundSink
level which is not trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I built on the idea you proposed of adding keyspace to RequestTracker
to add all tables too in order to track table info. The caveat is:
- We don't track internode messages per table per request bc the message size is only known after it's been built
- The track per table across requests using
SensorsRegistry
- the very first message belong to an table will not contain internode sensors.
Let me know caa569f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a quick look and I'm not too convinced, it seems internode tracking adds quite a bit of confusion :/ Let me think if we can make it a bit better and more similar to the other sensors...
/** | ||
* Tracks outbound messages size and count in Sensors Regsitry | ||
*/ | ||
private boolean trackOutboundMessages(Message<?> message, InetAddressAndPort ignored) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding internode tracking responsibility to the registry doesn't look right to me: what about moving this code to MessagingService#listen()
and rewrite it slightly to use the "standard" sensors API? It would probably be slightly more verbose, but overall cleaner IMO. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is cleaner but requires a SensorsRegistry#syncAllSensors
if we were to use the standard API. If there is need, we can expose an async variant
or a public api to sync a single sensor directly.
a5a34c1
to
fa835cc
Compare
fa835cc
to
9936c02
Compare
9936c02
to
cc52860
Compare
Fixed PR diff cc52860 |
e59190b
to
442dbff
Compare
442dbff
to
caa569f
Compare
@sbtourist PR is ready for second round of review. PTAL. |
@@ -620,10 +625,32 @@ boolean isConnected(InetAddressAndPort address, Message<?> messageOut) | |||
public void listen() | |||
{ | |||
inboundSockets.open(); | |||
outboundSink.add(this::trackOutboundMessages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a nit, but this would be best invoked first, so as soon as we start listening it's all setup.
*/ | ||
public Context(String keyspace) | ||
{ | ||
this(keyspace, null, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a quick look and I'm not too convinced, it seems internode tracking adds quite a bit of confusion :/ Let me think if we can make it a bit better and more similar to the other sensors...
* Opinionated changes to internode tracking: * Removed message count as bytes should really be the most important/accurate. * Tracked both inbound and outbound bytes, as writes take up inbound bytes, while reads take up outbound bytes. * Added internode sensors to custom params in the same place where we add the other sensors. * Added internode sensors for request. * Added SensorsInternodeTest + bug fixes. * * Use only the payload size as internode bytes. * Cache the payload size where possible.
tables.forEach(tm -> { | ||
Context context = Context.from(tm); | ||
requestSensors.registerSensor(context, Type.INTERNODE_BYTES); | ||
requestSensors.incrementSensor(context, Type.INTERNODE_BYTES, message.serializedSize(MessagingService.current_version) / tables.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message.serializedSize
I realized for inbound messages we use the whole message serialized size, should we use the payload size for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 8543504
* Collect counter mutation WRITE_BYTES from replicas * Rely on replica count to accommodate for mutation replica sensor values * Empty-Commit * Track internode msg bytes and counts * Track internode sensors at the outbound sink level * Fix NPE for ks only sensors * Fix more NPEs in unit tests * Rebase on top of origin/cc-ucu * Remove ks from headers & track internode messages in MessagingService * Add internode sensors per ks and table * Opinionated changes to internode tracking (#1121) * Opinionated changes to internode tracking: * Removed message count as bytes should really be the most important/accurate. * Tracked both inbound and outbound bytes, as writes take up inbound bytes, while reads take up outbound bytes. * Added internode sensors to custom params in the same place where we add the other sensors. * Added internode sensors for request. * Added SensorsInternodeTest + bug fixes. * * Use only the payload size as internode bytes. * Cache the payload size where possible. * Use payload size for inbound messages --------- Co-authored-by: Sergio Bossa <sergio.bossa@gmail.com>
* Collect counter mutation WRITE_BYTES from replicas * Rely on replica count to accommodate for mutation replica sensor values * Empty-Commit * Track internode msg bytes and counts * Track internode sensors at the outbound sink level * Fix NPE for ks only sensors * Fix more NPEs in unit tests * Rebase on top of origin/cc-ucu * Remove ks from headers & track internode messages in MessagingService * Add internode sensors per ks and table * Opinionated changes to internode tracking (#1121) * Opinionated changes to internode tracking: * Removed message count as bytes should really be the most important/accurate. * Tracked both inbound and outbound bytes, as writes take up inbound bytes, while reads take up outbound bytes. * Added internode sensors to custom params in the same place where we add the other sensors. * Added internode sensors for request. * Added SensorsInternodeTest + bug fixes. * * Use only the payload size as internode bytes. * Cache the payload size where possible. * Use payload size for inbound messages --------- Co-authored-by: Sergio Bossa <sergio.bossa@gmail.com>
* Collect counter mutation WRITE_BYTES from replicas * Rely on replica count to accommodate for mutation replica sensor values * Empty-Commit * Track internode msg bytes and counts * Track internode sensors at the outbound sink level * Fix NPE for ks only sensors * Fix more NPEs in unit tests * Rebase on top of origin/cc-ucu * Remove ks from headers & track internode messages in MessagingService * Add internode sensors per ks and table * Opinionated changes to internode tracking (#1121) * Opinionated changes to internode tracking: * Removed message count as bytes should really be the most important/accurate. * Tracked both inbound and outbound bytes, as writes take up inbound bytes, while reads take up outbound bytes. * Added internode sensors to custom params in the same place where we add the other sensors. * Added internode sensors for request. * Added SensorsInternodeTest + bug fixes. * * Use only the payload size as internode bytes. * Cache the payload size where possible. * Use payload size for inbound messages --------- Co-authored-by: Sergio Bossa <sergio.bossa@gmail.com>
* Collect counter mutation WRITE_BYTES from replicas * Rely on replica count to accommodate for mutation replica sensor values * Empty-Commit * Track internode msg bytes and counts * Track internode sensors at the outbound sink level * Fix NPE for ks only sensors * Fix more NPEs in unit tests * Rebase on top of origin/cc-ucu * Remove ks from headers & track internode messages in MessagingService * Add internode sensors per ks and table * Opinionated changes to internode tracking (#1121) * Opinionated changes to internode tracking: * Removed message count as bytes should really be the most important/accurate. * Tracked both inbound and outbound bytes, as writes take up inbound bytes, while reads take up outbound bytes. * Added internode sensors to custom params in the same place where we add the other sensors. * Added internode sensors for request. * Added SensorsInternodeTest + bug fixes. * * Use only the payload size as internode bytes. * Cache the payload size where possible. * Use payload size for inbound messages --------- Co-authored-by: Sergio Bossa <sergio.bossa@gmail.com>
* Collect counter mutation WRITE_BYTES from replicas * Rely on replica count to accommodate for mutation replica sensor values * Empty-Commit * Track internode msg bytes and counts * Track internode sensors at the outbound sink level * Fix NPE for ks only sensors * Fix more NPEs in unit tests * Rebase on top of origin/cc-ucu * Remove ks from headers & track internode messages in MessagingService * Add internode sensors per ks and table * Opinionated changes to internode tracking (#1121) * Opinionated changes to internode tracking: * Removed message count as bytes should really be the most important/accurate. * Tracked both inbound and outbound bytes, as writes take up inbound bytes, while reads take up outbound bytes. * Added internode sensors to custom params in the same place where we add the other sensors. * Added internode sensors for request. * Added SensorsInternodeTest + bug fixes. * * Use only the payload size as internode bytes. * Cache the payload size where possible. * Use payload size for inbound messages --------- Co-authored-by: Sergio Bossa <sergio.bossa@gmail.com>
Addresses: https://github.com/riptano/cndb/issues/9194
Tracking internode message bytes.
More generic implementation (i.e. leveraging
InboundMessageHandlers
like InternodeInboundMetrics have the following complications:RequestSensors
today (from sensor registration to synchronizing the sensors registry) begins onVerbHandler#doVerb
. Trying to register and synchronise outside the verb handler boundaries to increment internode sensors would require major changes (probably where the verbs are dispatched in InboundSink)