[keycloak-dev] Reduce number of DB updates

Stian Thorgersen stian at redhat.com
Fri Oct 11 12:04:36 EDT 2013


Unless there's a query it won't flush to the db in any case so calling update*** for every change shouldn't have any performance issues. If we did the same with Mongo that would obviously be a lot worse

----- Original Message -----
> From: "Marek Posolda" <mposolda at redhat.com>
> To: keycloak-dev at lists.jboss.org
> Sent: Friday, 11 October, 2013 2:40:45 PM
> Subject: [keycloak-dev] Reduce number of DB updates
> 
> Hi,
> 
> I think that one of easiest way to improve performance could be to
> remove anti-pattern of calling model update after invoke of each setter
> operation. Basically some objects like RealmAdapter, UserAdapter,
> RoleAdapter are always updating model after each setter due to code like
> this:
> 
>      @Override
>      public void setSocial(boolean social) {
>          realm.setSocial(social);
>          updateRealm();
>      }
> 
> On the other hand some others like ApplicationAdapter doesn't use this
> and instead it has public method available on model like: public void
> updateApplication() .
> 
> Can't we use same pattern like ApplicationAdapter also for all other
> model objects? Only downgrade is that code would need to be updated and
> calls to updateXXX need to be added, but I think that's better approach
> than DB update per setter.
> 
> If you agree, I can create JIRA and contribute PR?
> 
> Marek
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
> 


More information about the keycloak-dev mailing list