[keycloak-dev] JS policy performance improvements

Jay Anslow jma at corefiling.com
Fri Jun 16 09:46:39 EDT 2017

Hi all,

I'm using the JS Policy to evaluate resource permissions, but we've started to run into some performance problems when using large numbers of resources.

However, I've managed to improve the performance of the JSPolicyProvider, by caching the ScriptEngine (creating new bindings per evaluation) and compiling the code on policy update.

The "Obtaining Entitlements" operation is now ~5x faster than before, for my test setup (100 test runs, ~1100 resources, remote Postgres).

I'd like to merge my changes back to Keycloak, so I just wanted to check if the community would be interested in this change before I prepare a PR and create a JIRA issue.


Jay Anslow, Product Development, CoreFiling Limited
Phone: +44-1865-203192

More information about the keycloak-dev mailing list