You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/07/19 12:23:12 UTC

DO NOT REPLY [Bug 49613] New: Request.getAttributeNames()

https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

           Summary: Request.getAttributeNames()
           Product: Tomcat 6
           Version: 6.0.28
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: v2@iki.fi




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #7 from Mark Thomas <ma...@apache.org> 2010-07-22 10:38:43 EDT ---
Thanks for the patch.

It has been applied to 7.0.x and will be in 7.0.1 onwards.

It has been proposed for 6.0.x.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #6 from Remy Maucherat <re...@apache.org> 2010-07-20 10:20:44 EDT ---
Actually, the patch is appropriate for TC 6. I thought it should be in
getAttribute, but this would interfere with the SSLAuthenticator.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #1 from Sampo Savolainen <v2...@iki.fi> 2010-07-19 06:28:59 EDT ---
Created an attachment (id=25782)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25782)
Profiler screenshot

This is a screenshot from a profiler. It shows how a JSF application calls
getAttributeNames() 1222 times for a single page render.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from Mark Thomas <ma...@apache.org> 2010-09-07 11:56:25 EDT ---
The patch has been applied to 6.0.x and will be included in 6.0.30 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

Sampo Savolainen <v2...@iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Request.getAttributeNames() |Request.getAttributeNames()
                   |                            |slows down some
                   |                            |applications

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #2 from Sampo Savolainen <v2...@iki.fi> 2010-07-19 06:41:28 EDT ---
Application frameworks like MyFaces use attributes while rendering a page.
Tomcat reads all SSL connector attributes for every call to
getAttributeNames(). This creates a large number of calls to
getAttributeNames(). The current 6.0.x implementation is very slow as it does
not recognize it has already read the SSL specific attributes. 

I will attach a patch which uses an object boolean field to determine whether
the SSL attributes have already been read or not. The speedup to the profiled
application is 10x.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #5 from Sampo Savolainen <v2...@iki.fi> 2010-07-19 08:18:52 EDT ---
Can you abbreviate on how I did not understand the code correctly? 

This is how I understood it:

'getAttributes(Globals.CERTIFICATES_ATTR)' is called when a secure connection
is made. This call is made to make sure the 'if( isSSLAttribute(name) )' branch
is activated. This branch then fills out the attributes Map with the SSL
attributes.

The only change I did was to use an object variable (sslAttributesRead) to make
sure the 'if( isSSLAttribute(name) )' branch is executed only once per request.

So this fixes the assumption the current code has, which is that once the SSL
attributes are read, the 'getAttributes(Globals.CERTIFICATES_ATTR)' call
terminates as it finds a value for the attribute.

I don't see a problem with my logic. Can you explain what I got wrong?


Re: disturbing...

You are very correct that this is a bit disturbing. But given the complexity
and generic nature of web application frameworks, such use is inevitable. And,
the performance hit the application takes is unacceptable (response time of 40
seconds instead of 4 in one case) especially since this is easily solvable.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #3 from Sampo Savolainen <v2...@iki.fi> 2010-07-19 06:44:20 EDT ---
Created an attachment (id=25783)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25783)
Proposed patch to specified issue

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49613] Request.getAttributeNames() slows down some applications

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49613

--- Comment #4 from Remy Maucherat <re...@apache.org> 2010-07-19 07:51:06 EDT ---
Looking at your patch, you apparently did not understand the code. But I can
see you might incur a performance problem if SSL is enabled and there's no
certificate chain (at least if it is null). Maybe. However, using
getAttributesNames repeatedly (if at all) is ... disturbing.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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