Estou montando um servidor WS com Java, e estou vendo algumas problemas, como o login via POSTMAN, está demorando entre 6000 a 7500 ms para responder, sendo o que ele realmente faz, é de em torno 50 ms. Após conseguir configurar o log4, a maior parte da demora está em:
org.hibernate.dialect.Dialect
até org.hibernate.jpa.internal.util.LogHelper
Segue abaixo todo o stack do log:
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
Gostaria de saber se há alguma configuração a se fazer no persistence ou biblioteca que deixe esse processo mais rápido.
Segue o meu 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>