3

Trying to investigate an issue regarding a keycloak deployment. From the documentation we're seeing that we should alter this property in the stanealone.xml to allow more

However , after altering the standalone xml to this

                </datasource>
                <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:postgresql://${env.DB_ADDR:postgres}/${env.DB_DATABASE:keycloak}${env.JDBC_PARAMS:}</connection-url>
                    <driver>postgresql</driver>
                    <pool>
                        <max-pool-size>200</max-pool-size>
                    </pool>

When we allow the JMX connection to the management console I notice this max pool size showing 19

Is there anything which could be overriding the max-pool-size setting we're using or how would one go about debugging where is derives the max-pool-size if not from the standalone.xml

  • This is disturbing... I'm thinking the max-pool-size reported by JMX may grow once more connections are open. Could you set the `` parameter to a higher value (200 ?) and check if the max-pool-size you see with JMX is higher ? – otonglet Sep 11 '20 at 09:14
  • Unfortunately adding that doesn't change , when starting up max showing is 20 connections – Shane McGovern Sep 13 '20 at 21:26
  • Can you tell me which Keycloak version you are using ? I think in older version the attribute wasn't nested under . – otonglet Sep 14 '20 at 06:46
  • KC version 11.0.2 – Shane McGovern Sep 14 '20 at 07:48

1 Answers1

2

I don't know why exactly you get this issue but I'll try to help to the best of my abilities.

Keycloak 11 uses Widlfy 20, which offers several options to configure the datasource.

Please try to set

  • pool-use-strict-min to true
  • pool-prefill to true
  • min-pool-size to 200
  • initial-pool-size to 200

Also, monitor the number of opened connection on your Postgres database, and check if they recoup with the JMX report you got.

Finally, if none of these cause a change in your situation I can only suggest to try another ManagedConnectionPool implementation (see mcp attribute)

otonglet
  • 3,130
  • 21
  • 36
  • Sorry I can't be more useful. Other options are to post an issue on the Keycloak issue tracker (https://github.com/keycloak/keycloak-community/issues) or ask a new question with the Wildfly tag and maybe some Widlfly expert on StackOverflow will be able to answer. – otonglet Sep 14 '20 at 08:03
  • Accepting this as the answer because it contains helpful information and resources for further debugging. The issue on our end was actually it was using the standalone-ha.xml rather than the standalone.xml and was never noticed – Shane McGovern Sep 14 '20 at 10:14