Reason for process delay and hibernate configuration (persistence)

1

I'm building a WS server with Java, and I'm seeing some problems, such as login via POSTMAN, it's taking between 6000 and 7500 ms to respond, which it actually does, is around 50 ms. After you can configure log4, most of the delay is in:

org.hibernate.dialect.Dialect to org.hibernate.jpa.internal.util.LogHelper

and also INFO org.hibernate.dialect.Dialect to org.hibernate.jpa.internal.EntityManagerFactoryRegistry . Home | Below is the entire log stack:

018-01-31 14:21:38 INFO  org.hibernate.jpa.internal.util.LogHelper     - HHH000204: Processing PersistenceUnitInfo [
    name: persistence_unit_meudb
    ...]
2018-01-31 14:21:38 WARN  org.hibernate.orm.connections     - HHH10001002: Using Hibernate built-in connection pool (not for production use!)
2018-01-31 14:21:38 INFO  org.hibernate.orm.connections     - HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/meudb]
2018-01-31 14:21:38 INFO  org.hibernate.orm.connections     - HHH10001001: Connection properties: {user=root, password=****}
2018-01-31 14:21:38 INFO  org.hibernate.orm.connections     - HHH10001003: Autocommit mode: false
2018-01-31 14:21:38 INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl     - HHH000115: Hibernate connection pool size: 20 (min=1)
2018-01-31 14:21:38 INFO  org.hibernate.dialect.Dialect     - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2018-01-31 14:21:42 INFO  org.hibernate.jpa.internal.util.LogHelper     - HHH000204: Processing PersistenceUnitInfo [
    name: persistence_unit_meudb
    ...]
2018-01-31 14:21:42 WARN  org.hibernate.orm.connections     - HHH10001002: Using Hibernate built-in connection pool (not for production use!)
2018-01-31 14:21:42 INFO  org.hibernate.orm.connections     - HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/meudb]
2018-01-31 14:21:42 INFO  org.hibernate.orm.connections     - HHH10001001: Connection properties: {user=root, password=****}
2018-01-31 14:21:42 INFO  org.hibernate.orm.connections     - HHH10001003: Autocommit mode: false
2018-01-31 14:21:42 INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl     - HHH000115: Hibernate connection pool size: 20 (min=1)
2018-01-31 14:21:42 INFO  org.hibernate.dialect.Dialect     - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2018-01-31 14:21:45 WARN  org.hibernate.jpa.internal.EntityManagerFactoryRegistry     - HHH000436: Entity manager factory name (persistence_unit_meudb) is already registered.  If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
Antes do Try: 2018-01-31 14:21:45.345
2018-01-31 14:21:45 INFO  org.hibernate.hql.internal.QueryTranslatorFactoryInitiator     - HHH000397: Using ASTQueryTranslatorFactory
Hibernate: 
    select
        [ Campos ]
    from
        tbusuario usuario0_ 
    where
        usuario0_.login=? 
Antes do Return: 2018-01-31 14:21:45.387
2018-01-31 14:21:45 INFO  org.hibernate.orm.connections     - HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/meudb]
2018-01-31 14:21:45 INFO  org.hibernate.orm.connections     - HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/meudb]
Antes do Return: 2018-01-31 14:21:45.389

I would like to know if there are any settings in the persistence or library that will make this process faster.

Follow my persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
                                http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" 
             version="2.0" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xmlns="http://java.sun.com/xml/ns/persistence">

   <persistence-unit name="persistence_unit_meudb" transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
         <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
         <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/meudb"/>
         <property name="javax.persistence.jdbc.user" value="root"/>
         <property name="javax.persistence.jdbc.password" value="root"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.format_sql" value="true"/>

         <property name="hibernate.hbm2ddl.auto" value="update"/>
      </properties>
   </persistence-unit>
</persistence>
    
asked by anonymous 31.01.2018 / 17:34

1 answer

1

In production the recommendation is not to use these lines below, use only for test purposes otherwise every time the service is started, changes in your model will be analyzed, and the scripts will be displayed in the log

 <property name="hibernate.show_sql" value="true"/>
 <property name="hibernate.format_sql" value="true"/>

 <property name="hibernate.hbm2ddl.auto" value="update"/>
    
03.02.2018 / 03:11