Make Jmeter able to support nanoseconds for testing and reporting
In my test experience, when the performance of the system under test is much too fast (for example, when testing Redis), the milliseconds is too large to reflect the performance of the system under test, so the following changes are made:
- Change the unit of Jmeter Result from milliseconds to nanoseconds.
- Statistical calculations use BigDecimal/BigInteger to make the statistical results more accurate and no overflow.
- The test report uses ms/ns as the final output unit according to the Properties configuration.
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
- [ ] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly.
I have not checked the way the report works, however, I have a few comments:
- Have you checked
sampleresult.useNanoTimeJMeter property? If so could you describe why the property is not enough for you?- Please refrain from modifying the existing tests. In most cases, if you modify an existing test it means you break backward compatibility which is unwanted.
- Please create new tests for the feature you add
- Please refrain from combining multiple unrelated changes into a single commit. I think the change of
double->BigDecimalshould be discussed and measured separately
- Yes I did tried
sampleresult.useNanoTime, and finally find out that report was still in ms, this property will not help. - My PR do break backwark compatibility, as the former JTL file was stored in ms format, My PR will change it to ns format. So that the former tests wold not pass until updated.
- The same as Q2
- Changes in calculators from Long to BigDecimal is because, firstly every test timestamp is 1 million bigger than before so Long could be easily overflow during accumulation; secondly BigDecimal/BigInteger is more precise than Long in calculation.
My PR do break backwark compatibility, as the former JTL file was stored in ms format, My PR will change it to ns format. So that the former tests wold not pass until updated.
I am afraid we can't merge such PRs then. We can't break everybody's workflows when releasing a new version.
My PR do break backwark compatibility, as the former JTL file was stored in ms format, My PR will change it to ns format. So that the former tests wold not pass until updated.
I am afraid we can't merge such PRs then. We can't break everybody's workflows when releasing a new version.
Understood. Thanks.
It would be great if we could support both formats at the same time, however, keeping the old scripts workable and old files parseable is important
+1 to have the support of both formats
It would be great if we could support both formats at the same time, however, keeping the old scripts workable and old files parseable is important
I will try to make it. Reopen this PR
@vlsi https://github.com/apache/jmeter/commit/fd12dc39aa688011475c7466cb7c1a2e1f43e38f Made following changes:
- Introduced new metadatas in csv, jtl and xml, these metadatas are dedicated to store ns timestamp, old metadatas are untouched. When Jmeter loads csv, jtl or xml, it tries to read and load ns timestamp first if possible, otherwise it goes the old fasioned way.
- Added new setter functions in SampleResult.java, these functions are ns timestamp related only, original constructors and factory funcions are untouched.
Above 2 changes are for backward compability.
- Renamed ns/ms key in reportgenerator.properies.
- Added test to check my changes.
If my PR is not accepted finally some how, I still suggest to update in calculators from Long to BigInteger/Bigdecimal, which brings better precision and will not cause overflow.