You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2006/11/05 01:33:03 UTC

svn commit: r471306 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/session/StandardSession.java webapps/docs/changelog.xml

Author: markt
Date: Sat Nov  4 16:33:02 2006
New Revision: 471306

URL: http://svn.apache.org/viewvc?view=rev&rev=471306
Log:
Fix bug 37356. I know concern has been expressed about using syncs here.
I have tested the impact of using syncs with both an artificial test case that just calls access() followed by endAccess() on the StandardSession object and with JMeter using different numbers of threads to make a request in the same session.
For the single thread case:
- JMeter impact was negligible.
- With the wrapper, it was about 150 nanoseconds per request which explains why the JMeter test didn't shown anything.
For two threads:
- JMeter impact was about 9 microseconds (0.4%) per request
- The wrapper was much higher at 50 milliseconds but this is expected given the nature of the test is such that far more contention than normal will be seen
For five threads
- JMeter impact was about 75 microseconds (4%) per request

My conclusion is that the uncontended impact is negligible and the contended impact is sufficiently low for syncs to be acceptable.

Obviously, these figures are for my hardware but it is fairly standard so the figures should be typical.

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java?view=diff&rev=471306&r1=471305&r2=471306
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/session/StandardSession.java Sat Nov  4 16:33:02 2006
@@ -275,6 +275,7 @@
      */
     protected transient int accessCount = 0;
 
+    private Object lock = new Object();
 
     // ----------------------------------------------------- Session Properties
 
@@ -611,7 +612,9 @@
 
         evaluateIfValid();
 
-        accessCount++;
+        synchronized (lock) {
+            accessCount++;
+        }
 
     }
 
@@ -622,7 +625,9 @@
     public void endAccess() {
 
         isNew = false;
-        accessCount--;
+        synchronized (lock) {
+            accessCount--;
+        }
 
     }
 

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=471306&r1=471305&r2=471306
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Sat Nov  4 16:33:02 2006
@@ -62,6 +62,9 @@
         StandardWrapper. (markt)
       </fix>
       <fix>
+        <bug>37356</bug>: Ensure sessions time out correctly. (markt)
+      </fix>
+      <fix>
         <bug>40528</bug>: Add missing message localisations as provided by
         Ben Clifford. (markt)
       </fix>



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


Re: svn commit: r471306 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/session/StandardSession.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
Remy Maucherat wrote:
> markt@apache.org wrote:
>> Author: markt
>> Date: Sat Nov  4 16:33:02 2006
>> New Revision: 471306
> 
> I think you should use the strict compliance flag, as only 2 people need
> activity checking.

Good idea. One commit coming up.

Mark


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


Re: svn commit: r471306 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/session/StandardSession.java webapps/docs/changelog.xml

Posted by Remy Maucherat <re...@apache.org>.
markt@apache.org wrote:
> Author: markt
> Date: Sat Nov  4 16:33:02 2006
> New Revision: 471306
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=471306
> Log:
> Fix bug 37356. I know concern has been expressed about using syncs here.
> I have tested the impact of using syncs with both an artificial test case that just calls access() followed by endAccess() on the StandardSession object and with JMeter using different numbers of threads to make a request in the same session.
> For the single thread case:
> - JMeter impact was negligible.
> - With the wrapper, it was about 150 nanoseconds per request which explains why the JMeter test didn't shown anything.
> For two threads:
> - JMeter impact was about 9 microseconds (0.4%) per request
> - The wrapper was much higher at 50 milliseconds but this is expected given the nature of the test is such that far more contention than normal will be seen
> For five threads
> - JMeter impact was about 75 microseconds (4%) per request
> 
> My conclusion is that the uncontended impact is negligible and the contended impact is sufficiently low for syncs to be acceptable.
> 
> Obviously, these figures are for my hardware but it is fairly standard so the figures should be typical.

I think you should use the strict compliance flag, as only 2 people need 
activity checking.

Rémy

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