Skip to main content

Slow response for select/commit of JPA in EJB.

1 reply [Last post]
sf019jp
Offline
Joined: 2010-03-16
Points: 0

Slow response for select/commit of JPA in EJB.

If there is a record of 5,000 for the Database in "Table A" (column 88 count),
It takes about 5 seconds select and commit to "Table B"(column 18 count).

In the case of about 100 records in "Table A" will be completed in 50 milliseconds.

This is the case of GlassFish 4.0.
If change to GlassFish 3.1.2.2, can be completed in 1.2 seconds.

[Environment]
Windows XP 32bit
GlassFish 4.0
EclipseLink 2.5.1
MySQL 5.6

[Detail]

1)
Is the case of 5000 record count of Table A,
[Java]: Query.getResultList(); // for Table B
and,
[Java]: EntityTransaction.commit(); // to Table B

To completion, it takes 2.5 seconds, respectively.

Survey with NetBeans profiler, both devotes a lot of time
in the part of ConcurrentHashMap.get ().

This method seems to be called many times.

----------
org.eclipse.persistence.internal.jpa.QueryImpl.getResultList()
+ org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery()
+ org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush()
+ org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush()
+ org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges()
+ org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(
+ org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChangesForExistingObject(
+ org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(
+ org.eclipse.persistence.descriptors.DescriptorEventManager.executeEvent(
+ org.eclipse.persistence.descriptors.DescriptorEventManager.notifyEJB30Listeners(
+ org.eclipse.persistence.descriptors.DescriptorEventManager.notifyListener(
+ org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.preUpdate(
+ org.eclipse.persistence.internal.jpa.metadata.listeners.BeanValidationListener.validateOnCallbackEvent(
+ org.hibernate.validator.internal.engine.ValidatorImpl.validate(Object, Class[])
+ org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(
+ org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(
+ org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(
+ org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(
+ org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(
+ org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(
+ org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(
+ org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.getInitializedValidator(
+ java.util.concurrent.ConcurrentHashMap.get(
-----------

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sf019jp
Offline
Joined: 2010-03-16
Points: 0

I have fixed the problem.

There was a many of (sql)select call in JPA/JTA access, without persist.
Added "Query.setLockMode(LockModeType.READ)", has been improved response speed.