-
Notifications
You must be signed in to change notification settings - Fork 4
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
Latency utils #50
base: trunk
Are you sure you want to change the base?
Latency utils #50
Conversation
update the version of jmeter
@@ -266,6 +267,7 @@ public String toString() { | |||
mySB.append("Max: " + this.getMax() + " "); | |||
mySB.append("Error Rate: " + this.getErrorPercentage() + " "); | |||
mySB.append("Sample Rate: " + this.getRate()); | |||
mySB.append("elapse: " + this.getElapsed()); |
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.
Modify 'elapse:' to 'elapsed:'
} | ||
|
||
@Override | ||
public void clear() { |
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.
Shouldn't you be clearing/resetting latencyStats ? and also call stop on object to make threads stop ?
@@ -25,17 +28,14 @@ | |||
* | |||
*/ | |||
public class StatisticsSummaryData { | |||
|
|||
LatencyStats latencyStats = new LatencyStats(1,3600000000000L,2,1024,10000000000L,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.
- Why is PauseDetector null ? We want this feature
- Is the window 1024 big enough ? What is the logic behind ? Make it a configurable property
- intervalEstimatorWindowLength is 10000000000L, What is the logic behind ?
|
||
void addAll(IStatCalculator<T> calc); | ||
|
||
T getMedian(); |
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.
Document all interface methods
@Override | ||
public Map<Number, Number[]> getDistribution() { | ||
Map<Number, Number[]> result = new HashMap<>(); | ||
histogram.percentiles(5).forEach(p -> { |
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.
why 5?
licenses/bin/HdrHistogram-2.1.8.txt
Outdated
@@ -0,0 +1,27 @@ | |||
BSD License | |||
|
|||
Copyright (c) 2000-2015 www.hamcrest.org |
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.
Are you sure HdrHistogram is copyrighted by hamcrest.org?
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.
agreed
licenses/bin/LatencyUtils-2.0.3.txt
Outdated
@@ -0,0 +1,27 @@ | |||
BSD License | |||
|
|||
Copyright (c) 2000-2015 www.hamcrest.org |
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.
Are you sure LatencyUtils is copyrighted by hamcrest?
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.
agreed
|
||
private LatencyStats latencyStats = LatencyStats.Builder.create().build(); | ||
Histogram intervalHistogram = latencyStats.getIntervalHistogram(); | ||
private Histogram histogram = new Histogram(intervalHistogram); |
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.
What's the precision of the resulting histogram?
What's the memory consumption?
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 work in progress. See question asked on dev list also
min = Math.min(val, min); | ||
updateValueCount(val,1); | ||
} | ||
private void updateValueCount(Long actualValue, long sampleCount) { |
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 sad. Is it really required?
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 a method for calculating distribution, so I try to record the value when it is added . Can you give another idea? Thanks
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.
What's the purpose of valuesMap
?
Histogram / LatencyStats should track the distribution.
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.
In fact in the old code, the distribution value comes from this method :
public Map<Number, Number[]> getDistribution() {
Map<Number, Number[]> items = new HashMap<>();
for (Entry<T, MutableLong> entry : valuesMap.entrySet()) {
Number[] dis = new Number[2];
dis[0] = entry.getKey();
dis[1] = entry.getValue();
items.put(entry.getKey(), dis);
}
return items;
}
I don't think the LatencyStats can track this distribution
histogram.recordValue(l*1000000L); | ||
} | ||
// test max/min | ||
assertTrue(10 == statisticsSummaryData.getMax()); |
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.
Please avoid writing tests like that.
It would be hard to analyze especially at Travis/Jenkins CI.
Please use something like assertEquals(Arrays.toString(values) + ".getMax()", 10, statisticsSummaryData.getMax())
General rule: assertTrue
and assertFalse
are almost always bad.
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class TestHisStatCalculator { |
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.
Please avoid use his
/ her
wording
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.
his => Histogram
But better use TestHistogramStatCalculator
calc1.addValue(l); | ||
} | ||
calc.addAll(calc1); | ||
assertTrue(23 == calc.getMax()); |
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.
Please avoid assertTrue
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.
Agreed
@@ -268,6 +268,8 @@ For details, please see the files under: licenses/bin | |||
* asm-7.0.jar (BSD) | |||
* dnsjava-2.1.8.jar (BSD) | |||
* hamcrest-core-1.3.jar (BSD) | |||
* LatencyUtils-2.0.3.jar (BSD) |
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.
BSD is an invalid (too broad) license reference. Please use SPDX license ID when possible: https://spdx.org/licenses/
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.
agreed
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.
https://github.com/LatencyUtils/LatencyUtils/blob/master/LICENSE
https://github.com/HdrHistogram/HdrHistogram/blob/master/LICENSE.txt
These two licenses are both in BSD, what can I do to use SPDX License ? Thanks
build.properties
Outdated
@@ -41,6 +41,7 @@ | |||
# are contained in the JMeter binary release. | |||
|
|||
maven2.repo = https://repo1.maven.org/maven2 | |||
maven.repo = https://repo.maven.apache.org/maven2 |
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.
AFAIK, LatencyUtils is available in Maven Central. Why do you add maven.repo
?
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.
agreed
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 think methods like addSentBytes
, addBytes
, getTotalBytes
, getTotalSentBytes
do not belong to a generic IStatCalculator
interface, and the methods should be removed from the interface.
* | ||
* @param newValue number of newly sent bytes | ||
*/ | ||
void addSentBytes(long newValue); |
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 like a violation of "single responsibility principle".
How getStandardDeviation
is related to addSentBytes
?
I think methods like addSentBytes
, addBytes
, getTotalBytes
, getTotalSentBytes
do not belong to a generic IStatCalculator
interface.
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.
Agreed
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.
Is "getStandardDeviation" related to sentBytes? In my view the standardDeviation is for the response time of Http Request, and "sent bytes" is for the amount of data used for transmission
percentile3 = new PercentileAggregator(percentileIndex3); | ||
mean = new MeanAggregator(); | ||
public final long getPercentile(double percent) { | ||
return histogram.getValueAtPercentile(percent)/1000000; |
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 should not be needed as per https://stackoverflow.com/questions/56986503/time-unit-problem-about-latencyutils-recordlatency-method
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.
The only answer in thie question doesn't give us enough information.
So don't we need to muliple and divide by 1,000,000 each time?
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.
When the number of Thread is a big number like 1000 -10000, the maximum is bigger than percentile 99%. And IntcountHistogram can also give a correct result.
…e assertTrue to assertEquals
Description
use LatencyUtil to calculate the mean and percentile of datas
How Has This Been Tested?
Yes