Skip to content
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

Add BackendListener that sends "raw" results to InfluxDB #544

Merged
merged 10 commits into from
Nov 14, 2020

Conversation

ham1
Copy link
Contributor

@ham1 ham1 commented Nov 9, 2019

Description

Add BackendListener that sends "raw" results to InfluxDB.
Instead of summarised statistics this listener sends the raw results for each sample to InfluxDB.

In its current form it sends connect time, ttfb (latency) and duration.
Are there other metrics that would be essential to send?

Added extra method to InfluxdbMetricsSender: public void addMetric(String measurement, String tag, String field, long timestamp).

This is a draft PR to start a discussion about what more needs to be done or could be done before including.

Motivation and Context

As can be seen from the below graphs, in a low TPS situation the current InfluxDB listener has a misleading max value and you lose a lot of detail with avg etc.

Grafana-JMeter-InfluxDB-Listeners-low-tps

In a slightly higher TPS test you can see that the time is slightly off (due to the listener using System.currentTimeMillis() instead of the sample end (or start) time) and also interesting details are lost due to the summary nature of the listener.

Grafana-JMeter-InfluxDB-Listeners

How Has This Been Tested?

Tested with a few simple test plans against a local InxlufDB and Grafana, and also the Influx cloud 2.0.0.

Screenshots (if appropriate):

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
@codecov-io
Copy link

codecov-io commented Nov 9, 2019

Codecov Report

Merging #544 into master will increase coverage by 0.04%.
The diff coverage is 79.12%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #544      +/-   ##
============================================
+ Coverage     55.33%   55.37%   +0.04%     
- Complexity     9960     9976      +16     
============================================
  Files          1033     1035       +2     
  Lines         63345    63399      +54     
  Branches       7157     7159       +2     
============================================
+ Hits          35052    35109      +57     
+ Misses        25818    25815       -3     
  Partials       2475     2475
Impacted Files Coverage Δ Complexity Δ
...lizers/backend/influxdb/InfluxdbMetricsSender.java 100% <ø> (ø) 0 <0> (ø) ⬇️
...alizers/backend/AbstractBackendListenerClient.java 23.07% <ø> (+1.64%) 3 <0> (ø) ⬇️
...ackend/influxdb/InfluxdbBackendListenerClient.java 39.91% <0%> (+0.35%) 12 <0> (ø) ⬇️
...visualizers/backend/influxdb/UdpMetricsSender.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...ter/visualizers/backend/BackendListenerClient.java 0% <0%> (ø) 0 <0> (?)
...end/influxdb/InfluxDBRawBackendListenerClient.java 100% <100%> (ø) 14 <14> (?)
...isualizers/backend/influxdb/HttpMetricsSender.java 76.84% <70%> (-0.34%) 11 <1> (+1)
...er/visualizers/backend/BackendListenerContext.java 23.68% <0%> (ø) 7% <0%> (ø) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2314361...2a4737a. Read the comment docs.

@ham1 ham1 marked this pull request as ready for review November 11, 2019 17:29
@ham1 ham1 force-pushed the raw-influx-listener branch 2 times, most recently from e3ba370 to f477c5e Compare November 11, 2019 17:49
@ham1 ham1 force-pushed the raw-influx-listener branch 2 times, most recently from 6c3e04d to af53f31 Compare November 21, 2019 17:30
@ham1 ham1 force-pushed the raw-influx-listener branch 2 times, most recently from 4711d5a to f07e070 Compare February 27, 2020 13:11
@ham1
Copy link
Contributor Author

ham1 commented Mar 21, 2020

Any thoughts on this one - is there more that needs doing or is this ok to mergE?

Copy link
Contributor

@pmouawad pmouawad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ham1 ,
It looks good to me.

@vlsi , @FSchumacher any thoughts ?
Thanks

def koSample = new SampleResult()
koSample.setSampleLabel("myLabel")
expect:
sut.createTags(koSample) == "status=ko,transaction=myLabel"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this look like a call to a private method?

Frankly speaking, I don't think we should encourage that type of tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, I'd be interested in any ideas you have to test this, would it be better to make the method public marked with @PublicForTesting?

def defaultContext = new BackendListenerContext(sut.getDefaultParameters())

def createOkSample() {
def now = System.currentTimeMillis()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is currentTimeMillis needed here?
Can a constant be used instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be, what would be the advantage of using say 1 or 1585413149344, vs. this call?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a fixed value in test helps to keep the test reproducible, and it helps to avoid unexpected timezone issues.

If you want to exercise timezone issues, please create a separate test for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@vlsi
Copy link
Collaborator

vlsi commented Mar 24, 2020

I'm not sure it is worth adding yet another Listerer implementation.

It looks like the users would have to copy-paste the configuration if they want to switch between raw and grouped data.

@vlsi
Copy link
Collaborator

vlsi commented Mar 24, 2020

In a parallel universe, there's https://gitlab.com/testload/jmeter-listener (MIT)

@pmouawad
Copy link
Contributor

I'm not sure it is worth adding yet another Listerer implementation.

IMO this one complements the other one and will be more precise

It looks like the users would have to copy-paste the configuration if they want to switch between raw and grouped data.

Is this a big deal ?
Will this really happen ?

@pmouawad
Copy link
Contributor

In a parallel universe, there's https://gitlab.com/testload/jmeter-listener (MIT)

Have you tried it ?
I think it's better to have things in CORE for what seems to be a "core" feature, making live metrics available.
Not all users of JMeter are aware of 3rd party plugins.

@vlsi
Copy link
Collaborator

vlsi commented Mar 24, 2020

Is this a big deal ?

I think it is.
From my perspective, the use case is: "user wants to send the data to InfluxDB".
The way to send the data looks more like a configuration option rather than selecting a different listener.

For instance, what if we add BackendListener that sends percentiles and BackendListener that sends errors?
It does look not user-friendly, especially, taking into account that JMeter does not allow copy-pasting multiple fields.

IMO this one complements the other one and will be more precise

Having 3-4 "similar in-core listeners that send data to InfluxDB" would be confusing.

@vlsi
Copy link
Collaborator

vlsi commented Mar 24, 2020

I think it's better to have things in CORE for what seems to be a "core" feature, making live metrics available.

One of the options is to bundle the plugin into the final distribution (like we bundle lots of third-party dependencies).

I have not tried that myself, however, their wiki says there are reasons to group data before sending:

Activation of GROUP_BY function (only couple parameters in settings) could be very useful on highload (thousands of transaction per second) because on such intensity InfluxDB/ElasticSearch/Clickhouse can be bottleneck (IOPS). In this mode all Samplers grouping by name and only aggregates

@ham1 ham1 force-pushed the raw-influx-listener branch 2 times, most recently from fea4cb4 to 8585791 Compare March 28, 2020 00:02
@pmouawad
Copy link
Contributor

I think it's better to have things in CORE for what seems to be a "core" feature, making live metrics available.

One of the options is to bundle the plugin into the final distribution (like we bundle lots of third-party dependencies).

I have not tried that myself, however, their wiki says there are reasons to group data before sending:

Activation of GROUP_BY function (only couple parameters in settings) could be very useful on highload (thousands of transaction per second) because on such intensity InfluxDB/ElasticSearch/Clickhouse can be bottleneck (IOPS). In this mode all Samplers grouping by name and only aggregates

This plugin has indeed good ideas, but implementation should be improved if embedded in JMeter (https://gitlab.com/testload/jmeter-listener/-/issues).

@ham1
Copy link
Contributor Author

ham1 commented Mar 28, 2020

If we don't like the idea of another listener for this use case how might we allow the current implementation to be customised?

@ham1 ham1 force-pushed the raw-influx-listener branch 2 times, most recently from 53c6a8b to 3686ad7 Compare March 29, 2020 20:50
@ham1 ham1 force-pushed the raw-influx-listener branch 2 times, most recently from bd7b3bc to 2a4737a Compare April 5, 2020 16:07
@pmouawad
Copy link
Contributor

Hello @ham1 ,

Regarding this PR, did you have the opportunity to test it on a "real life" performance test ?

What were the use cases ? and related volumes ?

Thanks

@ham1
Copy link
Contributor Author

ham1 commented Sep 13, 2020

Hello. Yes I did. But I seem to have messed up rebasing so I'll have a look at it again towards the end of the month.

I can try to compare the performance of this vs. the existing one, but I'd expect it to be slightly worse but that's a choice for the user based on their use case and need for higher resolution of results in Influx.

@pmouawad pmouawad merged commit 166800a into apache:master Nov 14, 2020
@ham1 ham1 deleted the raw-influx-listener branch November 14, 2020 16:48
@eostermueller
Copy link

Is there a way to submit the raw requests in batches?
If performance is decent, we'll try this.

@ham1
Copy link
Contributor Author

ham1 commented Nov 24, 2020

Is there a way to submit the raw requests in batches?
If performance is decent, we'll try this.

Afraid not.

How many req/s are you currently testing with? Would be interested to know what you discover if you try it out.

This PR was to allow more accurate results, especially with low RPS tests, so I didn't add the extra complexity of batching.

asfgit pushed a commit that referenced this pull request Nov 26, 2020
Sorry for missing this earlier, Graham Russell.

Relates to #544
kkalinin pushed a commit to kkalinin/jmeter that referenced this pull request Mar 11, 2021
* Implemented InfluxDBRawBackendListenerClient and tests

Added default impl of BackendListenerClient#createSampleResult
Added overloaded UdpMetricsSender and HttpMetricsSender#addMetric to include custom timestamp
Improved JavaDocs

* Added documentation for InfluxDBRawBackendListenerClient

* Add whitespace and improved InfluxdbBackendListenerClientSpec

* Add default implementation to BackendListenerClient.

Also, removing these defaults from AbstractBackendListenerClient.

* Improve BackendListenerClient JavaDoc

* http -> https in docs plus some formatting.

* Influxdb -> InfluxDB and whitespace

* Update InfluxDB Raw Listener docs

* Used fixed timestamp for test and remove unused import

* Fix error prone error
kkalinin pushed a commit to kkalinin/jmeter that referenced this pull request Mar 11, 2021
Sorry for missing this earlier, Graham Russell.

Relates to apache#544
@sergiodegrazia
Copy link

Hi everyone!
At this time, this new Backend Listener only reports on response time data. It would be great if this could also include some of the details the 'old' Listener sent to Influx.
For example:

  • The status of each request (ok or ko)
  • The response code of each request
  • Information about the active threads (e.g. meanAT), sent every second
  • Event information such as test start and end
  • An 'Application' tag similar to the one used in the previous Backend Listener, so it is possible to filter each test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants