-
Notifications
You must be signed in to change notification settings - Fork 68
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
#1537: Sanity checking on client side load should be included into core metrics and async warnings #1601
Conversation
None of the parsers or the checker are currently living in the correct place. Please suggest a better place for me to move those classes to. |
* limitations under the License. | ||
*/ | ||
|
||
package io.nosqlbench.engine.api.activityimpl.uniform; |
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.
We should probably have all of these classes under some "clientload" package in the engine-core module.
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 is going to be really cool to have! Given the similarities in the various Reader classes you could probably collapse them into a class that provides the correct logic based on input but that's more of a stylistic choice than anything else. Nice work!
private static final Logger logger = LogManager.getLogger(ClientSystemMetricChecker.class); | ||
private final int pollIntervalSeconds; | ||
private final ScheduledExecutorService scheduler; | ||
private final Map<String,Gauge<Double>> nameToNumerator; |
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 seems to me that, as these values are all accessed together, it might be more efficient to create a nested class like
private class ClientMetrics {
Gauge numerator,
Gauge denominator,
...
} ,
Store that by name in a Map and store/retrieve everything with a single call
int sectorSizeBytes = 512; | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
String[] parts = line.trim().split("\\s+"); |
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 would recommend putting a try/catch inside the while loop as well, so that if a single line in the file is corrupted and e.g. parseDouble runs into something weird and throws and exception, the whole file reading process doesn't have to bail
metricsMap.put("loadAvg15min", loadAvgFifteenMinute); | ||
|
||
} catch (FileNotFoundException e) { | ||
return; |
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 then results in the null value bubbling up to the original caller silently. If that's what's intended, that's fine. Just mentioning it.
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.
Some notes on approach:
It would be best to reduce the usage of Map here where possible. Many small maps will have an out-sized impact on memory usage. In some cases here, you could easily use arrays or Lists, since the consumer side of this data simply wants to iterate over the established data sources.
I would also advocate for bundling the basic (find, extract, check) style patterns into a type which can be applied to each, rather than keep things in tabular form. Happy to go into more details if you like.
ec9e848
to
19769fc
Compare
19769fc
to
cd1ab9c
Compare
Thanks for the feedback, this is now ready for another round of reviews. A few changes, so the highlights:
Local Testing
For the client metric checking, I run cpuburn locally to artificially max out CPU usage, and it triggers the threshold check for CPU percentage spent in user space, then no more after CPU burn is killed (the sleep 30s):
|
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.
Looks really good. The only thing I would change is to move the creation/registration logic from NBCLI to NBSession. In the new component based model these metrics should be part of the hierarchy and NBCLI stands outside of the hierarchy.
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 generally looks good to me.
Thanks for the reviews, guys. @MarkWolters I agree that it makes sense to move the registration to NBSession, but that class currently is not available in |
PR for #1537