Am 31.08.2012 04:01, schrieb David A. Rush:
We've got two different machines (both Windows Server something)
running Tomcat 7.0.22, and each running a webapp that uses user
authentication.  We're using a couple of different schemes (LDAP and
database using JDBCRealm with hashed pwords, just database with hashed
pwords).

When no one has logged in for a while (90 minutes seems to do the
trick), the next login takes almost exactly 40 seconds on one host and
almost exactly 20 seconds on the other one.
You might want to check for a firewall between tomcat and your database. It could drop packets of a database session after a certain period of inactivity. JDBCRealm keeps its (one and only) connection open and closes it only in case of
an exception (which might be a timeout).

You should really consider using DataSourceRealm
(http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#DataSourceRealm) instead. It will close connections (give it back to a pool) after usage and can be configured to check the connection before it is used for authentication/authorization.


Hitting a page in one of the webapps that hits the database for
application data, without requiring login, works fast even if it's
been idle for hours.  But then try to login and I get a 40 second
delay after whacking the "Log in" button on the login form.  Looking
at it in more detail, the host and app with a 40-second delay has two
JDBCRealms configured, both inside of a combined realm.
You haven't told us, how you configured your application database connections,
so we can only guess.

If you are using standard tomcat connection pooling, you can transfer that configuration to a pool, that can be used by the mentioned DataSourceRealm.

Regards
 Felix

Are we seeing a 20-second delay in getting authentication via JDBCRealm?

Suggestions on troubleshooting this?

David



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to