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

TargetConnectionManager allows concurrent connections #360

Merged
merged 12 commits into from
Jan 14, 2021

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Dec 16, 2020

Based on top of #359 - requires subprocess to not use its own independent TargetConnectionManager

This modifies the TargetConnectionManager to use a timed cache of JFRConnections, which by default expire (are closed and removed from cache) 90 seconds after their last access.

The advantage is that targeted requests taking place within a short time period of each other - such as a web-client user navigating around to see event templates, then creating a recording, then viewing a report, etc. - can generally use one long-lived connection between the ContainerJFR backend and the target, rather than opening and closing the connection on each user operation. This significantly improves responsiveness by removing a lot of latency from targeted API responses. This also allows for concurrent connections to multiple targets, whereas previously only one open connection to a single target was allowed, and requests would be blocked until the previous connection was closed.


Integration tests should be added to exercise the multi-target scenario in a consistent way, rather than simply by manual smoketesting. This will be much easier to do after #376 .

@andrewazores andrewazores marked this pull request as draft December 16, 2020 19:23
@andrewazores andrewazores force-pushed the tcm-concurrent-cache branch 4 times, most recently from d5cbe46 to a3f89dd Compare December 18, 2020 17:26
@andrewazores andrewazores changed the title Tcm concurrent cache TargetConnectionManager allows concurrent connections Dec 18, 2020
@andrewazores andrewazores marked this pull request as ready for review December 18, 2020 18:26
@andrewazores andrewazores marked this pull request as draft December 18, 2020 18:40
@andrewazores andrewazores force-pushed the tcm-concurrent-cache branch 7 times, most recently from c14b12f to 5f91be4 Compare December 23, 2020 21:13
@andrewazores andrewazores force-pushed the tcm-concurrent-cache branch 4 times, most recently from ed191f8 to d1bf1de Compare January 12, 2021 21:38
@andrewazores andrewazores marked this pull request as ready for review January 12, 2021 21:44
@andrewazores
Copy link
Member Author

I added an integration test that tries to exercise this, although it's tough to write a test that specifically targets the concurrency. At the least it should verify that the new implementation does work as a drop-in replacement, however. The test will output the elapsed time, and in my test runs on my laptop it did become slightly shorter on average. The difference is not huge (~19s down to ~16s), but the requests fired in the test are also ones that should not take much time at all to execute to begin with, so any savings margin here is significant IMO. The test commit is at the beginning of the series, so it's easy to check out that commit and test the pre-PR functionality and test timing, and then to check out the last commit in the series to compare to the PR changes.

Deploy one without SSL or auth, one with just auth, and one with both
@andrewazores
Copy link
Member Author

I added a few more steps to the integration test to verify the results a little more concretely, and as a side effect the total elapsed time on my machine went from ~22s pre-PR to ~16s post-PR, so the gap is widening the more API requests are issued. This points to a positive performance impact from the parallelism/concurrency enabled here.

Copy link
Contributor

@Alexjsenn Alexjsenn left a comment

Choose a reason for hiding this comment

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

I don't fully understand every last line, but I understand most of how the changes you made work. There is a significant time improvement for the Interleaved... test, and it all seems to work!

@andrewazores andrewazores merged commit f727d34 into cryostatio:main Jan 14, 2021
@andrewazores andrewazores deleted the tcm-concurrent-cache branch January 14, 2021 15:58
aali309 pushed a commit to aali309/cryostat-legacy that referenced this pull request Jul 22, 2024
…3.1 to 4.8.4.0 (cryostatio#360)

build(deps): bump com.github.spotbugs:spotbugs-maven-plugin

Bumps [com.github.spotbugs:spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.8.3.1 to 4.8.4.0.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](spotbugs/spotbugs-maven-plugin@spotbugs-maven-plugin-4.8.3.1...spotbugs-maven-plugin-4.8.4.0)

---
updated-dependencies:
- dependency-name: com.github.spotbugs:spotbugs-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
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.

2 participants