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

Configure Keycloak worker thread pool to be aligned with JGroup thread pool size #452

Conversation

ahus1
Copy link
Contributor

@ahus1 ahus1 commented Jul 26, 2023

This prepares the setup for the next upcoming load test where we align the Keycloak workers.

@kami619 - please review the docs and test in a single cluster with 100_000 sessions, 200 ups sustained load 100 pod kills (like the previous run where we saw the spikes).

Thanks!

@ahus1 ahus1 self-assigned this Jul 26, 2023
@ahus1 ahus1 requested a review from kami619 July 26, 2023 16:33
@@ -0,0 +1,2 @@
Due to the bug https://issues.redhat.com/browse/ISPN-14780[ISPN-14780] there is currently no known way to configure the size different from the default JGroups 100 max threads, so assuming a Keycloak cluster with 4 Pods, each Pod shouldn't have more than 25 worker threads.
Copy link
Contributor

@pruivo pruivo Jul 26, 2023

Choose a reason for hiding this comment

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

That is not entirely true since you can still configure the thread pool in the extended stack. As an example

    <jgroups>
        <stack name="kubernetes-with-fdsock" extends="kubernetes">
            <TCP thread_pool.max_threads="${env.JGROUPS_MAX_THREADS:200}" />
            <!-- When using an embedded stack, replacement is done by Infinispan which requires environment variables to be
            prefixed with ".env", while JGroups falls back to environment variables without the prefix.
            The Keycloak Operator passes this information in an enviornment variable `jgroups.dns.query`.
            See https://github.com/keycloak/keycloak/issues/21830 for a discussion.
            -->
            <dns.DNS_PING dns_query="${env.jgroups.dns.query}" />
            <!-- Workaround for problems with FD_SOCK2, which might fail when the other nodes are not ready yet.
            See https://github.com/keycloak/keycloak/issues/21092 -->
            <FD_SOCK stack.combine="REPLACE" stack.position="FD_SOCK2"/>
        </stack>
    </jgroups>

ps. It looks for JGROUPS_MAX_THREADS and if not set, it uses 200 threads

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pruivo - I tried this. I debugged that the value was correctly picked up in StringPropertyReplacer, but it never made it to the TCP instance, where the thread pool was still set up to be 100 threads only.

So I guess I'll wait until ISPN-14780 fixed in an upcoming release.

image

@kami619
Copy link
Contributor

kami619 commented Jul 28, 2023

@ahus1 do you think we need a run based off of the latest changes, if not I think the changes look good from the results we had from yday.

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 28, 2023

Do you think we need a run based off of the latest changes, if not I think the changes look good from the results we had from yday.

@kami619 - I think we're good to merge this one. We should just let everyone know that we now restrict the number of Keycloak worker threads. We might lift that later with the next Infinispan upgrade to 200.

@kami619 kami619 merged commit 1198b98 into keycloak:main Jul 28, 2023
2 checks passed
@ahus1 ahus1 deleted the is-xx-align-kecyloka-workers-with-jgroup-worker-size branch July 31, 2023 06:40
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.

4 participants