Mladen Turk wrote:
Hi,

Just noticed a strange behavior in the Java part of the
JK dealing with large (over 8184 bytes) data transfers.

Since with 8192 bytes AJP packet size, the maximum
transferred size per each packet is 8184 bytes one
would expect that for 20000 bytes file the packets
would be in a form of:
1:8184,2:8184,3:3632 thus total of 20000 bytes.

But in fact the behavior is rely weird:
1:8184,2:8,3:8184,4:8,5:3616.

Instead only three, the five! packets are transferred.

Seems that algorithm is breaking 8192 bytes of data to
two packets (8184 and 8 bytes).

I have an ugly patch for that. Find it attached (that just for gettting comments).

Cheers

Jean-Frederic


Bill, Any idea how to solve this, because it's way too inefficient. What's makes the things even worse is that for each packet Apache2 creates a transient bucket thus rising the memory usage.


Regards, Mladen.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Index: Response.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Response.java,v
retrieving revision 1.12
diff -u -r1.12 Response.java
--- Response.java       25 Apr 2005 22:06:30 -0000      1.12
+++ Response.java       20 May 2005 15:56:25 -0000
@@ -68,6 +68,16 @@
 
 
     public Response() {
+        outputBuffer = new OutputBuffer();
+        outputStream = new CoyoteOutputStream(outputBuffer);
+        writer = new CoyoteWriter(outputBuffer);
+        urlEncoder.addSafeCharacter('/');
+    }
+
+    public Response(int size) {
+        outputBuffer = new OutputBuffer(size);
+        outputStream = new CoyoteOutputStream(outputBuffer);
+        writer = new CoyoteWriter(outputBuffer);
         urlEncoder.addSafeCharacter('/');
     }
 
@@ -174,20 +184,19 @@
     /**
      * The associated output buffer.
      */
-    protected OutputBuffer outputBuffer = new OutputBuffer();
+    protected OutputBuffer outputBuffer;
 
 
     /**
      * The associated output stream.
      */
-    protected CoyoteOutputStream outputStream = 
-        new CoyoteOutputStream(outputBuffer);
+    protected CoyoteOutputStream outputStream;
 
 
     /**
      * The associated writer.
      */
-    protected CoyoteWriter writer = new CoyoteWriter(outputBuffer);
+    protected CoyoteWriter writer;
 
 
     /**
Index: Connector.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java,v
retrieving revision 1.18
diff -u -r1.18 Connector.java
--- Connector.java      30 Apr 2005 03:32:43 -0000      1.18
+++ Connector.java      20 May 2005 15:56:42 -0000
@@ -897,7 +897,12 @@
      */
     public Response createResponse() {
 
-        Response response = new Response();
+        System.out.println("Connector: createResponse: getProtocol: " + 
getProtocol());
+        Response response = null;
+        if ("AJP/1.3".equals(getProtocol()))
+            response = new Response(8184);
+        else
+            response = new Response();
         response.setConnector(this);
         return (response);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to