Performance control for dinamic weaving [message #1793580] |
Fri, 10 August 2018 13:18 |
Carlos Curos Messages: 5 Registered: November 2013 |
Junior Member |
|
|
Hi folks,
we are experiencing many performance issues when our application starts.
we are using eclipselink 2.72.
We're using dinamic weaving and we want to control which entities load at startup.
We're created two persistence units one with a few class and another with the rest ones.
Our persistencefile:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="JULISES">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>jar1.class1</class>
<class>jar1.class2</class>
<class>jar2.class3</class>
...
<validation-mode>NONE</validation-mode>
<properties>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.exceptions" value="true"/>
<property name="eclipselink.logging.session" value="false"/>
<property name="eclipselink.logging.timestamp" value="true"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
<persistence-unit name="JULISESGESTION" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<validation-mode>NONE</validation-mode>
<class>jar1.class1</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.weaving" value="false"/>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.exceptions" value="true"/>
<property name="eclipselink.logging.session" value="false"/>
<property name="eclipselink.logging.timestamp" value="true"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
</persistence>
The problem is, whan applitacion starts , autoamticaly scans all entities for both persistence units.
We've detected before application start .We think could be java virtual machine when we put the agent option in VM(-javaagent:c:/eclipselink/eclipselink.jar ), scan occurs. After that, we create by code a new entitimanagerfactory changing properties at runtime passing the persistence unit we wnat to load, then obviously scan ocurs again because we create an entitymanagerfactory.
public static EntityManagerFactory emf;
public static EntityManager em;
public Map propiedades;
String CADENA_BD;
propiedades = new HashMap();
propiedades.put("eclipselink.logging.file", SYSTEMBASE.ObtenPathLogs() + "LOG_EM_GESTION_" + getNombrePc() + "_" + General.timestamphour2StringSinGuiones(General.Now2()) + ".log");
propiedades.put("eclipselink.logging.level", "FINE");
propiedades.put("eclipselink.weaving", "true");
propiedades.put("javax.persistence.jdbc.driver", driverOracle);
CADENA_BD = "jdbc:oracle:thin:@(DESCRIPTION =" + conexion + "(LOAD_BALANCE = yes) (CONNECT_DATA = (SERVICE_NAME = " + sid + ") (FAILOVER_MODE=(TYPE=SELECT) (METHOD=BASIC) (RETRIES=180) (DELAY=5))))";
propiedades.put("javax.persistence.jdbc.url", SYSTEMBASE.CADENA_BD);
persistenceUnit = "JULISESGESTION";
SYSTEMBASE.emf = Persistence.createEntityManagerFactory(persistenceUnit, propiedades);
SYSTEMBASE.setEm(emf.createEntityManager());
It is possible to avoid first scan? We have more than 300 entities and we don't need all to load the aplication.
Notice that we hace a splashscreen , and a cause of first scannig it takes many seconds to load ( seeing persistence log )
If not possible, can we select with persistenceunit scan and the second one , load it later?
|
|
|
Powered by
FUDForum. Page generated in 0.02901 seconds