[keycloak-dev] Reduce number of DB updates

Marek Posolda mposolda at redhat.com
Fri Oct 11 09:40:45 EDT 2013


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


More information about the keycloak-dev mailing list