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

Investigate potential for concurrency processing #3

Open
yorugac opened this issue Oct 29, 2021 · 2 comments
Open

Investigate potential for concurrency processing #3

yorugac opened this issue Oct 29, 2021 · 2 comments

Comments

@yorugac
Copy link
Collaborator

yorugac commented Oct 29, 2021

There are two main ways to add concurrency to the extension:

  1. concurrency at the level of processing metrics pre-request

Details: Output receives batches of metrics that must be iterated over and converted into remote write TimeSeries. This may seems as a natural point to add concurrency like this:

   samplesContainers := o.GetBufferedSamples()
   step := math.Floor(len(samplesContainers) / concurrencyLimit)

   for i := 0; i < concurrencyLimit; i++ {
      wg.Add(1)
      // get chunk of samplesContainers from i * step to (i+1) * step
      go func(...) {
         ...
         gatherpoint[i] = convertToTimeSeries(chunk)
         ...
      }(...)
   }
   wg.Wait()

   for i := 0; i < concurrencyLimit; i++ {
      allTS = append(allTS, gatherpoint[i]...)
   }

   // encode and send remote write request

But this processing must be done within 1 second of flush period. Basic experiments so far showed next to none improvement in trying to spawn goroutines within that time limit. This result will likely be impacted by changes from Metric Refactoring in k6 and might need more investigation.

  1. concurrency at remote write requests

Details: this is blocked by inability to compile TimeSeries (group samples). Attempt to send disjointed samples concurrently would only result in out of order errors.

@mhaddon
Copy link

mhaddon commented Apr 4, 2022

Does this mean with the k6-operator parallelism has to be 1? Or does it just mean that requests cant take longer than 1 second?

@yorugac
Copy link
Collaborator Author

yorugac commented Apr 7, 2022

Hi @mhaddon, this issue has no relation to k6-operator. It's just an open question on possible ways to optimize performance of this, xk6-output-prometheus-remote, extension.
1 second is a default value of flush period:

defaultFlushPeriod = time.Second

So yes, if flush period is set to default, it's preferable that requests don't take more than 1 second; otherwise, there would be degraded performance and loss of data.

As mentioned in description, concurrency experiments don't seem to bring much of an improvement without solving "metrics refactoring" first, which is to be addressed in #2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants