On 17/11/2010 13:05, ma...@apache.org wrote:
> Author: markt
> Date: Wed Nov 17 13:05:20 2010
> New Revision: 1036021
> 
> URL: http://svn.apache.org/viewvc?rev=1036021&view=rev
> Log:
> Increase length of tests to
> a) reduce impact of start-up overhead
> b) make it easier to profile

Looks like the next bottleneck is in StandardSession.expire(boolean) due
to this code:

/*
* Compute how long this session has been alive, and update
* session manager's related properties accordingly
*/
long timeNow = System.currentTimeMillis();
int timeAlive = (int) ((timeNow - creationTime)/1000);
synchronized (manager) {
    if (timeAlive > manager.getSessionMaxAliveTime()) {
        manager.setSessionMaxAliveTime(timeAlive);
    }
    long numExpired = manager.getExpiredSessions();
    numExpired++;
    manager.setExpiredSessions(numExpired);
    int average = manager.getSessionAverageAliveTime();
    average = (int) (((average * (numExpired-1)) +
              timeAlive)/numExpired);
    manager.setSessionAverageAliveTime(average);
}

Having an exact value for that metric (that I doubt most users even know
about let alone use) is very expensive. I'm going to look at creation on
OSX for a little while but I plan to come back to this afterwards. I am
thinking something along the lines of queues for the last 100 or so
values of the following:
- session creation time
- session expiration time
- session alive time
from which metrics such as:
- 'current' average alive time
- 'current' session creation rate
- 'current' session expiration rate
can be calculated when required. The calculation will probably be
expensive but better than than expensive operations on every session
expiration.

Mark

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

Reply via email to