Slow first access to newly hosted site

0

Good afternoon!

I'm starting to practice my studies with Web development and when hosting and uploading a website in JSF with Spring and Hibernate, the first access is quite slow. After you access it, the handling is very fast.

This delay also happens after some time has passed and a new access has been made.

I'm thinking that it might be some Tomcat configuration problem in the hosting or some parameter that I need to configure in the environment.

Any tips, please?

  • Context.xml

    <Resource name="jdbc/baseDB" 
        auth="Container" 
        type="javax.sql.DataSource" 
        maxTotal="100" 
        maxIdle="30" 
        maxWaitMillis="10000"  
        validationQuery="SELECT 1" 
        validationInterval="30000" 
        username="root"
        password="root"
        driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/base?autoReconnect=true" />
    

  • Evaluating the Tomcat logging I think the problem is the automatic stop of the Container:

    INFO  org.apache.catalina.core.StandardServer- A valid shutdown command was received via the shutdown port. Stopping the Server instance.
    

    After about 20 minutes without accessing the site, the message above drops in the Log. Hence the next access is slow again.

        
    asked by anonymous 14.07.2016 / 17:06

    1 answer

    0

    At first access your site should be starting Hibernate, when hibernate is started it checks persistence.xml, checks the connection to the database, checks the tables etc, so at first access it is slow.

        
    15.07.2016 / 21:26