[ 
https://issues.apache.org/jira/browse/OPENJPA-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469598
 ] 

Kevin Sutter commented on OPENJPA-115:
--------------------------------------

I'm going to go ahead with the proposed changes to remove the explicit 
lock/unlock invocations, and change the _brokers definition to use 
ConcurrentReferenceHashSet with weak references.  The problem at shutdown was 
with the EMF.close processing.  It is attempting to close any outstanding EM's 
that had not been closed.  But, as it was iterating through this list, one of 
the EM instances became null and caused an NPE.  Not sure if this is due to the 
weak references being GC'd or it indicates a possible problem with the 
underlying Collections MapBackedSet or something else, but a simple null check 
gets around this problem.

With these changes, the initial bottleneck with running OpenJPA in a server 
environment has been resolved.  We are still pursuing other performance 
concerns, but we'll open new JIRA reports when we get something more concrete.

Kevin

> Bottleneck(s) with using OpenJPA in a Container-managed environment
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-115
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-115
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Kevin Sutter
>         Assigned To: Kevin Sutter
>            Priority: Critical
>
> Running some benchmarks against OpenJPA using the Sun Java System (SunOne) 
> application server.  Under load, we're not able to push the cpu to 100%.  The 
> culprit seems to be the lock and synchronization processing within 
> AbstractBrokerFactory.newBroker(..).  According to sections 5.9.1 and 5.9.2 
> in the JPA specification, it looks like OpenJPA is attempting to do too much 
> management of the created EntityManagers.  Within a Container-managed 
> environment, the Container takes care of the lifecycle of the EntityManagers. 
>  So, there does not seem to be a need to do the findBroker(..) invocation, 
> nor is there a need to keep track of the created EntityManagers (_brokers) so 
> that they can be closed when the Factory is closed.
> Once we have verified these changes, there may be others that are needed.  
> But, we have to get by this bottleneck first before going to the next layer...
> Kevin

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to