You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Lenny Marks <le...@aps.org> on 2007/01/09 03:17:19 UTC

Connector bufferSize > 8K restriction

I posted a long while ago about not being able to decrease the  
response buffer below 8K.

http://marc.theaimsgroup.com/?l=tomcat-dev&m=109218414305332&w=2

See also:
Re: AJP/Java connector issues  http://marc.theaimsgroup.com/?l=tomcat- 
dev&m=111653712502047&w=2

I realize that I'm not familiar with all the low level reasons why  
this is such a bad thing but IMO, it seems like a reasonable tradeoff  
depending on the situation to increase the the number of packets  
going across the network in favor of faster initial response times.  
At the very least, I think it would be a good thing if it was  
documented with the Tomcat Connector configuration for bufferSize  
that the it cannot be decreased and preferably also why. Even better  
if that documentation could just advise and leave the decision up to  
the deployer.  Actually the documentation for the AJP connector says  
that the default bufferSize = -1(not buffered). From what I can see,  
I don't think the setting has any effect on the actual buffer size.  
I've applied the following patch for us, but I wasn't sure why it(or  
something similar) would be bad for the Tomcat code base in general.  
I did notice that Connector.getBufferSize() is deprecated, however  
this would allow each of the different Connector implementations to  
override with their own default bufferSize values.

-lenny


Index: catalina/src/share/org/apache/catalina/connector/Response.java
===================================================================
--- catalina/src/share/org/apache/catalina/connector/
Response.java      (revision 494201)
+++ catalina/src/share/org/apache/catalina/connector/
Response.java      (working copy)
@@ -129,12 +129,7 @@
        */
       public void setConnector(Connector connector) {
           this.connector = connector;
-        if("AJP/1.3".equals(connector.getProtocol())) {
-            // default size to size of one ajp-packet
-            outputBuffer = new OutputBuffer(8184);
-        } else {
-            outputBuffer = new OutputBuffer();
-        }
+        outputBuffer = new OutputBuffer(connector.getBufferSize());
           outputStream = new CoyoteOutputStream(outputBuffer);
           writer = new CoyoteWriter(outputBuffer);
       }


Lenny Marks
Software Architect
American Physical Society




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


Re: Connector bufferSize > 8K restriction

Posted by Lenny Marks <le...@aps.org>.
Sorry. I forgot to include that this is from the Tomcat-5.5.20 source.

On Jan 8, 2007, at 9:17 PM, Lenny Marks wrote:

> I posted a long while ago about not being able to decrease the  
> response buffer below 8K.
>
> http://marc.theaimsgroup.com/?l=tomcat-dev&m=109218414305332&w=2
>
> See also:
> Re: AJP/Java connector issues  http://marc.theaimsgroup.com/? 
> l=tomcat-dev&m=111653712502047&w=2
>
> I realize that I'm not familiar with all the low level reasons why  
> this is such a bad thing but IMO, it seems like a reasonable  
> tradeoff depending on the situation to increase the the number of  
> packets going across the network in favor of faster initial  
> response times. At the very least, I think it would be a good thing  
> if it was documented with the Tomcat Connector configuration for  
> bufferSize that the it cannot be decreased and preferably also why.  
> Even better if that documentation could just advise and leave the  
> decision up to the deployer.  Actually the documentation for the  
> AJP connector says that the default bufferSize = -1(not buffered).  
> From what I can see, I don't think the setting has any effect on  
> the actual buffer size. I've applied the following patch for us,  
> but I wasn't sure why it(or something similar) would be bad for the  
> Tomcat code base in general. I did notice that  
> Connector.getBufferSize() is deprecated, however this would allow  
> each of the different Connector implementations to override with  
> their own default bufferSize values.
>
> -lenny
>
>
> Index: catalina/src/share/org/apache/catalina/connector/Response.java
> ===================================================================
> --- catalina/src/share/org/apache/catalina/connector/
> Response.java      (revision 494201)
> +++ catalina/src/share/org/apache/catalina/connector/
> Response.java      (working copy)
> @@ -129,12 +129,7 @@
>        */
>       public void setConnector(Connector connector) {
>           this.connector = connector;
> -        if("AJP/1.3".equals(connector.getProtocol())) {
> -            // default size to size of one ajp-packet
> -            outputBuffer = new OutputBuffer(8184);
> -        } else {
> -            outputBuffer = new OutputBuffer();
> -        }
> +        outputBuffer = new OutputBuffer(connector.getBufferSize());
>           outputStream = new CoyoteOutputStream(outputBuffer);
>           writer = new CoyoteWriter(outputBuffer);
>       }
>
>
> Lenny Marks
> Software Architect
> American Physical Society
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

Lenny Marks
lenny@aps.org