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

feat(performance): improve Log Processing performance #5647

Merged

Conversation

rangoo94
Copy link
Member

@rangoo94 rangoo94 commented Jul 9, 2024

Pull request description

  • Batch the log messages, so we don't send a JSON message for every single line
  • Batch the results, so we don't save data in MongoDB/Cloud/Kubernetes every time there is a result update

The batching works as follows:

  • Wait 50ms after receiving update/log to flush it to User
  • Reset the timer on consecutive message, but wait no longer than 100ms to send any update to User
  • Logs only: it flushes immediately if there is already 64KiB of logs buffered

In the result, the Test Workflows with significant amount of logs are working much better - both the real-time stream is faster, as well as the result computation (so the Test Workflow is marked done almost immediately after it's finished, even when there is a lot of logs).

Checklist (choose whats happened)

  • breaking change! (describe)
  • tested locally
  • tested on cluster
  • added new dependencies
  • updated the docs
  • added a test

@rangoo94 rangoo94 requested a review from a team as a code owner July 9, 2024 10:41
Copy link

netlify bot commented Jul 9, 2024

Deploy Preview for testkube-docs-preview canceled.

Name Link
🔨 Latest commit 5ff180f
🔍 Latest deploy log https://app.netlify.com/sites/testkube-docs-preview/deploys/668e882d8d6f1b0008379e9d

@rangoo94 rangoo94 force-pushed the dawid/feat/performance-improvements-for-log-processing branch from adb693f to fdc56a0 Compare July 9, 2024 10:48
@rangoo94 rangoo94 merged commit 1443737 into develop Jul 10, 2024
11 checks passed
@rangoo94 rangoo94 deleted the dawid/feat/performance-improvements-for-log-processing branch July 10, 2024 13:24
dejanzele added a commit that referenced this pull request Jul 10, 2024
* feat: [TKC-2194] improve workflow execution telemetry (#5648)

* TKC-2161: skip tls verification when saving logs if STORAGE_SKIP_VERIFY is true (#5627)

* build(deps): bump anchore/sbom-action from 0.16.0 to 0.16.1 (#5649)

Bumps [anchore/sbom-action](https://github.com/anchore/sbom-action) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Commits](anchore/sbom-action@v0.16.0...v0.16.1)

---
updated-dependencies:
- dependency-name: anchore/sbom-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(performance): improve Log Processing performance (#5647)

* feat(performance): buffer the logs sent from the container, to avoid sending message for each line
* feat(performance): batch Test Workflow's result updates
* fix(testworkflows): handle getting long container logs after the log rotation happens
   @see {@link https://stackoverflow.com/a/68673451}
* feat(testworkflows): optimize reading timestamp from Kubernetes logs
* feat(testworkflows): optimize buffering logs
* feat(testworkflows): use native channel instead of heavier Channels for WatchInstrumentedPod
* feat(testworkflows): increase buffer size for logs buffering

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Povilas Versockas <[email protected]>
Co-authored-by: Dejan Zele Pejchev <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

3 participants