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

Scott Marlow smarlow at redhat.com
Fri Sep 12 14:15:21 EDT 2014


Have you looked on the JPA spec mailing lists for clarification about 
whether the getPersistenceProviders result can be cached or not?  I'll 
take a look to see if I can find anything.

On 09/12/2014 11:59 AM, Andrew Schmidt wrote:
> 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.

Good point that the JPA.next specification should pick one (allow 
caching or not).

>
> 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.

The Hibernate implementation of these classes also do the same thing:

https://github.com/hibernate/hibernate-jpa-api/blob/master/src/main/java/javax/persistence/spi/PersistenceProviderResolverHolder.java#L173

The Hibernate PersistenceProviderResolverHolder does have a comment that 
caching should be introduced, whatever that means.

>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>



More information about the wildfly-dev mailing list