[keycloak-dev] Reduce number of DB updates

Bill Burke bburke at redhat.com
Fri Oct 11 10:36:09 EDT 2013


I was thinking of removing updateXXXX() entirely as it is really an 
implementation detail of the persistence layer.  For example, a JPA 
model would not need this updateRealm as all the changes would be 
aggregated at commit time.

On 10/11/2013 9:40 AM, Marek Posolda wrote:
> 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
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com


More information about the keycloak-dev mailing list