Skip to content

Ignore JDBC Drivers artifacts - #22443

Merged
vmuzikar merged 1 commit into
keycloak:mainfrom
mabartos:ignoreJdbc
Nov 22, 2023
Merged

Ignore JDBC Drivers artifacts#22443
vmuzikar merged 1 commit into
keycloak:mainfrom
mabartos:ignoreJdbc

Conversation

@mabartos

@mabartos mabartos commented Aug 14, 2023

Copy link
Copy Markdown
Member

Closes #22442

@ghost

ghost commented Sep 5, 2023

Copy link
Copy Markdown

Unreported flaky test detected

If the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.admin.concurrency.ConcurrentLoginTest#concurrentLoginSingleUser

Keycloak CI - New Store IT (hot-rod)

java.lang.RuntimeException: There were failures in threads. Failures count: 1
	at org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest.run(AbstractConcurrencyTest.java:122)
	at org.keycloak.testsuite.admin.concurrency.AbstractConcurrencyTest.run(AbstractConcurrencyTest.java:63)
	at org.keycloak.testsuite.admin.concurrency.ConcurrentLoginTest.concurrentLoginSingleUser(ConcurrentLoginTest.java:145)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...

Report flaky test

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@mabartos
mabartos force-pushed the ignoreJdbc branch 3 times, most recently from 7ded5c3 to eabf44d Compare September 13, 2023 09:38
@ghost

ghost commented Sep 13, 2023

Copy link
Copy Markdown

Unreported flaky test detected

If the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.x509.X509BrowserCRLTest#loginSuccessWithCRLSignedWithIntermediateCA3FromTruststore

Keycloak CI - FIPS IT (strict)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:313)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
...

Report flaky test

org.keycloak.testsuite.x509.X509BrowserCRLTest#loginFailedWithIntermediateRevocationListFromFile

Keycloak CI - FIPS IT (strict)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:313)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
...

Report flaky test

org.keycloak.testsuite.x509.X509BrowserCRLTest#loginFailedWithIntermediateRevocationListFromHttp

Keycloak CI - FIPS IT (strict)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:313)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
...

Report flaky test

org.keycloak.testsuite.x509.X509BrowserCRLTest#loginFailedWithInvalidSignatureCRL

Keycloak CI - FIPS IT (strict)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:313)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
...

Report flaky test

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@mabartos
mabartos marked this pull request as ready for review September 13, 2023 10:59
@mabartos
mabartos requested review from a team as code owners September 13, 2023 10:59
@mabartos

Copy link
Copy Markdown
Member Author

@ahus1 @vmuzikar Could you please check it? Thanks

@ahus1 ahus1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this change. Will this prevent some of the warning messages we've seen earlier when a DB driver is removed? What are the performance benefits of this change - there is always the cost to make it more difficult to maintain.

I could see the need for some users to change from an included DB driver to a self-provided DB driver. Would this change enable this, or is it unrelated?

While the list of drivers looks correct to me, I leave the final call if the added complexity is smaller than the benefits that we would expect here.

For anyone visiting this in the future, I'd like to see a at least a very short summary of the expected benefits.

@mabartos

Copy link
Copy Markdown
Member Author

@ahus1 Thanks for your points. There are performance benefits, indeed. I'll describe it more tomorrow.

@mabartos

mabartos commented Sep 15, 2023

Copy link
Copy Markdown
Member Author

This change brings quite a lot of benefits to us. First of all, the execution of build, static-init, and runtime build steps is done only for the specified DB. By this change, Quarkus is not aware of any other JDBC extension except the one for the chosen DB, so there's no need to execute these build steps, which could produce additional beans, service providers, configuration handling, agroal connection settings, and much more.

To summarize, we can prevent the execution of unused build steps, create additional resources, reduce memory allocations, GC executions, C1/C2 executions...

I've made a brief analysis of the performance (few executions followed by a comparison):

Startup

  • The significant improvement in startup is for AgroalProcessor as we saved ~80ms (cnt of CPU samples decreased by ~66%).
  • The overall improvement is ~100ms.

Heap

  • I've encountered a small peek during the startup
  • I assume objects provided during the build steps are destroyed after a few GC executions.
  • There's no peek anymore

Old

New

GC - GC executions reduced about ~20%.
Compiler - compilations reduced about ~13%

@ahus1

Will this prevent some of the warning messages we've seen earlier when a DB driver is removed?

Yes, and much more as the build steps for different JDBC extensions are not executed at all.

I could see the need for some users to change from an included DB driver to a self-provided DB driver. Would this change enable this, or is it unrelated?

I think it's unrelated to this PR as the logic behind using the custom JDBC drivers has not changed.


EDIT:
Specifying the JDBC Drivers JARs to be excluded has a huge impact on the memory allocations and utilized CPU samples. Should be included.

@ahus1

ahus1 commented Nov 2, 2023

Copy link
Copy Markdown
Member

I abstain from voting here, I leave it to the CND team to decide.

@mabartos

mabartos commented Nov 3, 2023

Copy link
Copy Markdown
Member Author

I just wanted to add my thought to the certain performance/maintainability controversion.

What's the worst that can happen? If some of the transitive dependencies (the JDBC driver JAR) change in the Quarkus extension and it's not reflected here, it'll just not be ignored and will be processed. So, we would end up in the same state as we're now in Keycloak main ;)

But there's a tiny probability it'll happen, as it'd be reflected in the Quarkus release notes, and it will not be changed so often anyway(if almost ever).

It just seems to me weird that if a user wants to use Postgres DB, the stuff related to Oracle, MS-SQL, MariaDB,... is processed. We should avoid such situations.

I'm a little bit surprised it unleashed such a broad conversation about it and took a considerable amount of effort to promote it :)

@vmuzikar @pedroigor I'd be glad for your input.

Closes keycloak#22442

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
@ghost

ghost commented Nov 20, 2023

Copy link
Copy Markdown

Unreported flaky test detected

If the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.account.AccountRestServiceTest#updateConsentForClientWithPut

Keycloak CI - Java Distribution IT (windows-latest - temurin - 19)

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertTrue(Assert.java:53)
	at org.keycloak.testsuite.account.AccountRestServiceTest.updateConsentForClientWithPut(AccountRestServiceTest.java:1377)
...

Report flaky test

org.keycloak.testsuite.account.AccountRestServiceTest#createConsentForClientWithPut

Keycloak CI - Java Distribution IT (windows-latest - temurin - 19)

java.lang.AssertionError: 
type
Expected: is "GRANT_CONSENT"
     but: was "UPDATE_CONSENT"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
...

Report flaky test

org.keycloak.testsuite.account.AccountRestServiceTest#createConsentForClient

Keycloak CI - Java Distribution IT (windows-latest - temurin - 19)

java.lang.AssertionError: 
type
Expected: is "GRANT_CONSENT"
     but: was "UPDATE_CONSENT"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
...

Report flaky test

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@vmuzikar vmuzikar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mabartos Thanks for the elaborate analysis.

While the perf difference not that impressive from my perspective, I see relatively low risk in introducing this optimization with acceptable maintenance costs of it.

Of course it's not ideal as the final goal here is to have some more generic capability to exclude unwanted/unused bits from runtime and even the distribution based on selected features. But that's certnainly not something we can prioritize now.

I'm going to approve but I'd like to get a green tick from @pedroigor as well was involved in the discussion too, IIRC.

@vmuzikar
vmuzikar merged commit d0bfbde into keycloak:main Nov 22, 2023
vmuzikar added a commit that referenced this pull request Nov 22, 2023
This reverts commit d0bfbde.

Signed-off-by: Václav Muzikář <vmuzikar@redhat.com>
vmuzikar added a commit that referenced this pull request Nov 22, 2023
This reverts commit d0bfbde.

Signed-off-by: Václav Muzikář <vmuzikar@redhat.com>
vmuzikar pushed a commit to mabartos/keycloak that referenced this pull request Dec 1, 2023
Closes keycloak#22442

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
vmuzikar pushed a commit that referenced this pull request Dec 1, 2023
* Ignore JDBC Drivers artifacts (#22443)

Closes #22442

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Fix obtaining removed artifacts from the configuration

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

---------

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
ShefeeqPM pushed a commit to ShefeeqPM/keycloak that referenced this pull request Jan 27, 2024
Closes keycloak#22442

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Signed-off-by: ShefeeqPM <86718986+ShefeeqPM@users.noreply.github.com>
ShefeeqPM pushed a commit to ShefeeqPM/keycloak that referenced this pull request Jan 27, 2024
This reverts commit d0bfbde.

Signed-off-by: Václav Muzikář <vmuzikar@redhat.com>
Signed-off-by: ShefeeqPM <86718986+ShefeeqPM@users.noreply.github.com>
ShefeeqPM pushed a commit to ShefeeqPM/keycloak that referenced this pull request Jan 27, 2024
* Ignore JDBC Drivers artifacts (keycloak#22443)

Closes keycloak#22442

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Fix obtaining removed artifacts from the configuration

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

---------

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Signed-off-by: ShefeeqPM <86718986+ShefeeqPM@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore JDBC Drivers artifacts

6 participants