You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2008/11/25 18:19:01 UTC

DO NOT REPLY [Bug 46295] New: Slow performance when Java client is connecting

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

           Summary: Slow performance when Java client is connecting
           Product: Apache httpd-2
           Version: 2.2.10
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: business2008@rodneybeede.com


Created an attachment (id=22945)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22945)
Example Java program to test Java socket performance to a web server

When using a program written in Java that uses Java sockets (java.io.Socket or
java.nio.SocketChannel) the performance to Apache 2.2.x on a Windows server is
very slow.

Running the web server on the same machine as the Java client and using
127.0.0.1 for the host connects very quickly, but downloading a large file of
31MB in size takes 5.9 seconds.

Using any web browser or wget (win32) on the same machine takes less than 1
second to download the file.  This would seem to indicate a bug in Java, but
when I run the Java program from a Linux machine to the Windows server the same
performance issue occurs.

If I run Apache 2.2.x on a Linux host then running the Java program from either
Windows or on the same Linux machine takes under one second.

If I connect the Java program on the Windows machine to another non-Apache
server on the same Windows machine it pulls data down in under 1 second.

I believe there is some bug in the Windows code for Apache in regards to how it
uses sockets.  This is not a DNS issue since the connection is established
quickly.  The slowness comes during the actual data transfer.


Steps to reproduce:

1.  Windows XP SP3
2.  Apache 2.2.10 for Win32 (default config from msi installer)
3.  Create a 32MB file called LargeDownload.file in the root of your htdocs
4.  Compile the attached Java program on the Windows machine using either Sun
Java 5, Sun Java 6, or jrockit 1.5 (all 32-bit)
5.  Run the Java program on the same Windows machine as where you have Apache
running
6.  Note that it takes ~5.9 seconds to download the file when it should take
under one second.


-- 
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46295] Slow performance when Java client is connecting

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


Rodney <bu...@rodneybeede.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #22945|0                           |1
        is obsolete|                            |




--- Comment #1 from Rodney <bu...@rodneybeede.com>  2008-11-25 10:03:09 PST ---
Created an attachment (id=22946)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22946)
Modified to not send keep alive in HTTP request

I've narrowed the issue down to the Windows build of Apache 2.2.x not closing
the socket once it has transmitted all the contents.

The attached modified Java program leaves off the Keep-Alive and Connection:
keepalive  request headers.  Apache should close the socket connection once it
has transmitted all of the file, but it is not.

If I modify the request to an HTTP/1.0 request then Apache (win32) does close
the socket once all of the data has been sent.

Hince the ~6 second delay is caused by Apache 2.2.x (win32) not closing the
socket for a non-keepalive request.


-- 
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 46295] Slow performance when Java client is connecting

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


Rodney <bu...@rodneybeede.com> changed:

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




--- Comment #2 from Rodney <bu...@rodneybeede.com>  2008-11-25 10:07:47 PST ---
I found the Connection: close  HTTP/1.1 header.

It runs out the Apache Jarakarta HTTPClient 3.1 library does not send this and
is having performance issues due to how it is handling some headers.

By adding the "Connection: close" header to my example code the issue was fixed
right away.

The one thing to note is that Apache 2.2.x on Linux seems to close the socket
right away whereas on Windows it takes anywhere from 6-16 seconds.


-- 
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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org