<div dir="ltr">We had a JPA user session provider at some point, but dropped it mainly for performance reasons and the fact it was not very well implemented. Having to write to the database for every request (including token refresh) would not be very good for performance, especially not with db replication enabled. There might be the possibility of creating a hybrid or to reduce the amount of writes to the session, but that would probably be quite a bit of work to do.<div><br></div><div>For authorization code flow we do have plans to figure out sticky sessions for that where both the requests from the browser and server-side applications ends up going to the same node. See <a href="https://issues.jboss.org/browse/KEYCLOAK-2352">https://issues.jboss.org/browse/KEYCLOAK-2352</a>.<br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 24 August 2016 at 23:16, Jared Blashka <span dir="ltr"><<a href="mailto:jblashka@redhat.com" target="_blank">jblashka@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm not sure why I never noticed this before, but I was doing some investigation today and couldn't find any session information actually populated in the DB tables. Both USER_SESSION and CLIENT_SESSION were empty. <div><br></div><div>After some digging in the code I saw that the only UserSesssionProvider implementation is the Infinispan-based one and it looks like the only type of user sessions that get persisted in the DB are offline sessions (via the JpaUserSessionPersisterProvide<wbr>r). </div><div><br></div><div>Was there a particular reason a JpaUserSessionProvider doesn't exist?</div><div><br></div><div>Background: We're aiming to have a highly available+resilient active-active multi-data center deployment of Keycloak. Ultimately, there should be no customer impact if a particular data center fails; there should be no IDP outage and they shouldn't have to log in again. We ran into issues with asynchronous user data replication earlier, which is why we're currently working on migrating our existing MariaDB cluster to use Galera (which has been looking pretty good so far) but it looks like we mistakenly assumed that this synchronous replication would also handle user session data.</div><div><br></div><div>Not replicating user session data across data centers is also going to cause us problems (its already caused us problems actually) when it comes to the OAuth authorization code flow as well. Since that flow involves back-channel server communication we can't guarantee that the client server will communicate with the same data center the client authenticated at. If a client calls out to the "wrong" data center, the flow will fail.</div><div><br></div><div>I can spend some time tomorrow investigating the performance when clustering infinispan across data centers, but I'm not particularly optimistic about the results.</div><div><br></div><div>Any thoughts/comments on our problem?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>Jared</div></font></span></div>
<br>______________________________<wbr>_________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>