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 2016/02/12 11:53:00 UTC

svn commit: r1729980 - /tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java

Author: markt
Date: Fri Feb 12 10:53:00 2016
New Revision: 1729980

URL: http://svn.apache.org/viewvc?rev=1729980&view=rev
Log:
Performance optimisation. For a very simple servlet this reduces processing time by ~2%.

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1729980&r1=1729979&r2=1729980&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Fri Feb 12 10:53:00 2016
@@ -858,6 +858,11 @@ public class CoyoteAdapter implements Ad
 
         ByteChunk uriBC = req.decodedURI().getByteChunk();
         int semicolon = uriBC.indexOf(';', 0);
+        // Performance optimisation. Return as soon as it is known there are no
+        // path parameters;
+        if (semicolon == -1) {
+            return;
+        }
 
         // What encoding to use? Some platforms, eg z/os, use a default
         // encoding that doesn't give the expected result so be explicit



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


Re: svn commit: r1729980 - /tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java

Posted by Mark Thomas <ma...@apache.org>.
On 12/02/2016 11:58, Rémy Maucherat wrote:
> 2016-02-12 12:07 GMT+01:00 Mark Thomas <ma...@apache.org>:
> 
>> On 12/02/2016 10:53, markt@apache.org wrote:
>>> Author: markt
>>> Date: Fri Feb 12 10:53:00 2016
>>> New Revision: 1729980
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1729980&view=rev
>>> Log:
>>> Performance optimisation. For a very simple servlet this reduces
>> processing time by ~2%.
>>
>> For the curious, I am measuring performance as follows:
>> - latest Java 8
>> - build from clean checkout
>> - comment out access log valve
>> - set maxKeepAliveRequests to -1
>> - deploy a simple test WAR that includes a Servlet that simply returns
>>   "Hello, World!" in plain text
>> - run ab using:
>>   ab -k -c 4 -n 2000000 http://localhost:8080/perfTest/SimpleServlet
> 
> 
> Yes, that's what I used to optimize from 4.1 to 6.0 :)
> 
>>
>> Tests running on a fully patched 8-core Windows Server 2008R2 machine
>> with nothing else running at the time.
>>
> 
> But I didn't use that then !
> 
>>
>> After warm-up, the tests is run 11 times and I am tracking mean and
>> standard deviation for each tested configuration.
>>
> 
> Hum, well, less is fine as well IMO. This sort of ab test is also very easy
> to profile (-k is critical for that).

Generally I agree with you. In this case I just want to be sure when I
see a difference that the difference is genuine.

So far this is the only place I've managed to find somewhere to squeeze
more performance out of the standard processing chain. I've still got a
few areas to check but I suspect that there isn't much more to find
unless we start doing stuff like moving lesser used features to optional
Valves or similar (and I'm not advocating that).

Mark


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


Re: svn commit: r1729980 - /tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java

Posted by Rémy Maucherat <re...@apache.org>.
2016-02-12 12:07 GMT+01:00 Mark Thomas <ma...@apache.org>:

> On 12/02/2016 10:53, markt@apache.org wrote:
> > Author: markt
> > Date: Fri Feb 12 10:53:00 2016
> > New Revision: 1729980
> >
> > URL: http://svn.apache.org/viewvc?rev=1729980&view=rev
> > Log:
> > Performance optimisation. For a very simple servlet this reduces
> processing time by ~2%.
>
> For the curious, I am measuring performance as follows:
> - latest Java 8
> - build from clean checkout
> - comment out access log valve
> - set maxKeepAliveRequests to -1
> - deploy a simple test WAR that includes a Servlet that simply returns
>   "Hello, World!" in plain text
> - run ab using:
>   ab -k -c 4 -n 2000000 http://localhost:8080/perfTest/SimpleServlet


Yes, that's what I used to optimize from 4.1 to 6.0 :)

>
> Tests running on a fully patched 8-core Windows Server 2008R2 machine
> with nothing else running at the time.
>

But I didn't use that then !

>
> After warm-up, the tests is run 11 times and I am tracking mean and
> standard deviation for each tested configuration.
>

Hum, well, less is fine as well IMO. This sort of ab test is also very easy
to profile (-k is critical for that).

Rémy

Re: svn commit: r1729980 - /tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java

Posted by Mark Thomas <ma...@apache.org>.
On 12/02/2016 10:53, markt@apache.org wrote:
> Author: markt
> Date: Fri Feb 12 10:53:00 2016
> New Revision: 1729980
> 
> URL: http://svn.apache.org/viewvc?rev=1729980&view=rev
> Log:
> Performance optimisation. For a very simple servlet this reduces processing time by ~2%.

For the curious, I am measuring performance as follows:
- latest Java 8
- build from clean checkout
- comment out access log valve
- set maxKeepAliveRequests to -1
- deploy a simple test WAR that includes a Servlet that simply returns
  "Hello, World!" in plain text
- run ab using:
  ab -k -c 4 -n 2000000 http://localhost:8080/perfTest/SimpleServlet

Tests running on a fully patched 8-core Windows Server 2008R2 machine
with nothing else running at the time.

After warm-up, the tests is run 11 times and I am tracking mean and
standard deviation for each tested configuration.

The JASPIC changes currently increase processing time by ~5%. I am
working on reducing that as well as looking for opportunities for
improvements elsewhere.

To put all of this in context, we are looking at a single request taking
between 176 and 186 microseconds to complete. In most real-world
applications, the application processing time will be orders of
magnitude more than this. While most applications won't notice these
improvements (or the impact of adding JASPIC) some will so I do think
this exercise is worthwhile.

Mark

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