I have spent plenty of hours trying to figure out what is causing my application to work really slow, maybe someone will help me to check what is the problem.
versions:
spring mvc: 4.2.5.RELEASE
hibernate: 4.3.11.Final
spring-data-jpa: 1.8.2.RELEASE
wildfly: 10
PostgreSQL Server: 9.4
OS: Debian GNU/Linux 7.9 (wheezy)
Server configuration: VPS, 1 proc, 4GB RAM
About my app:
Simple web application with static JSP
landing page, information page and login which redirect to private area. Public pages are static, first query to database is being done during login and then trying to get content for logged user.
What is the problem:
When I navigate through pages which are configured like this:
<http auto-config="true">
<intercept-url pattern="/" access="permitAll"/>
<intercept-url pattern="favicon.ico" access="permitAll"/>
<intercept-url pattern="/login/**" access="permitAll"/>
<intercept-url pattern="/info" access="permitAll"/>
...
</http>
there is no problem, everything is being loaded on he fly, there are no pauses. It works smooth. When I Post on /login (which redirect me to /main) and then when I navigate on each site configured like this:
<intercept-url pattern="/main/**" access="hasRole('ROLE_USER')"/>
<intercept-url pattern="/statistic/**" access="hasRole('ROLE_USER')"/>
<intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')" />
there are some extreme delays sometimes even up to 1 minute.
Hibernate configuration
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<!-- Configure the entity manager factory bean -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="pl.portal.model"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
</property>
<property name="jpaProperties">
<props>
<!-- <prop key="hibernate.dialect">pl.portal.sql.ProjectPsqlDialect</prop> -->
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.enable_lazy_load_no_trans">true</prop>
<prop key="hibernate.jdbc.use_streams_for_binary">false</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.connection.characterSet">UTF-8</prop>
</props>
</property>
</bean>
Can anyone give me a hint how to determine what is causing that delays? Checking on webinspect in my browser -> /admin, size 7,89KB, size : 54secons (where each js or css not exced 100ms)
EDIT2:
removed invalid fragment of thread dump, pasted full dump of thread which start after invoking action /admin
on app. Thread took 61s