[wildfly-dev] performance issue with wildfly and hibernate validator

Andrew Schmidt Andrew.Schmidt at impactmobile.com
Fri Sep 12 11:59:46 EDT 2014

I've been investigating performance issues with wildfly and hibernate validator.  
The changes made for this https://issues.jboss.org/browse/AS7-1306  imply the 
follow from the jpa spec:

  The results of calling the  PersistenceProviderResolverHolder.getPersistenceProviderResolver 
  and the PersistenceProviderResolver.getPersistenceProviders methods must not be cached.

however, the spec says later on:

  Note that the PersistenceProviderResolver.getPersistenceProviders() method 
  can potentially be called many times.  It is therefore recommended that the 
  implementation of this method make use of caching.

My interpretation is that wildfly should be caching the providers and it's the 
responsibility of the callers to not cache the results.   So the issue AS7-1306 shouldn't 
have been implemented.

The performance penalty of wildfly not caching the implementation of that method in regards to 
hibernate is that HibernatePersistenceProvider  uses a cache for classes/methods/fields 
and that cache is blown away on every call to getPersistenceProviders and that 
happens on every validation of every member of every class.

More information about the wildfly-dev mailing list