You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rpc-dev@xml.apache.org by dl...@apache.org on 2002/12/03 18:22:27 UTC
cvs commit: xml-rpc/src/java/org/apache/xmlrpc WebServer.java
dlr 2002/12/03 09:22:27
Modified: src/java/org/apache/xmlrpc WebServer.java
Log:
Applied patch by Ed Tellman <EC...@dolby.com>. Here's what Ed has to
say about the change:
"I am using Windows 2000, jdk 1.4.1.
I wrote a simple performance test which repeatedly makes an XML-RPC
call, to see how many calls I could make each second.
I was surprised to find that in my system enabling HTTP keep alive
dramatically reduced the performance, instead of improving it as I
expected. I did a bit of experimenting, and found that setting the
TCP no-delay option on the socket helped quite a bit. After I did
this, the performance with keep alive was about twice as good as the
performance without it."
Ed suggests that we provide a global flag to gate the toggling of the
TCP_NODELAY socket option, but we'll hold off on that until someone
actually voices a need for such a flag. Apache httpd 2.0 also sets
this socket option, relying on APR to determine whether the underlying
platform's TCP stack supports it. XML-RPC will go out on a limb and
rely on Java to do the Right Thing (cross your fingers, folks!).
In case you're curious, here's a reasonably good description of
TCP_NODELAY from CVS revision 1.102 of httpd-2.0/server/mpm_common.c:
"The Nagle algorithm says that we should delay sending partial
packets in hopes of getting more data. We don't want to do
this; we are not telnet. There are bad interactions between
persistent connections and Nagle's algorithm that have very severe
performance penalties. (Failing to disable Nagle is not much of a
problem with simple HTTP.)
In spite of these problems, failure here is not a shooting offense."
A comment in /usr/include/netinet/tcp.h on my RedHat 7.3 box speaks
similarly of TCP_NODELAY:
"Don't delay send to coalesce packets."
Considering that things still work okay with Nagle's algorithm active,
I've added handling of SocketException around setting of the
TCP_NODELAY flag which reports the error and keeps on chuggin'.
Revision Changes Path
1.22 +10 -0 xml-rpc/src/java/org/apache/xmlrpc/WebServer.java
Index: WebServer.java
===================================================================
RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/WebServer.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -u -r1.21 -r1.22
--- WebServer.java 10 Oct 2002 00:24:12 -0000 1.21
+++ WebServer.java 3 Dec 2002 17:22:26 -0000 1.22
@@ -64,6 +64,7 @@
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
+import java.net.SocketException;
import java.util.EmptyStackException;
import java.util.Stack;
import java.util.StringTokenizer;
@@ -482,6 +483,15 @@
try
{
Socket socket = serverSocket.accept();
+ try
+ {
+ socket.setTcpNoDelay(true);
+ }
+ catch (SocketException socketOptEx)
+ {
+ System.err.println(socketOptEx);
+ }
+
if (allowConnection(socket))
{
Runner runner = getRunner();
Re: Internal logging API
Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Daniel Rall wrote:
>Ryan, I've been wanting more elegant handling logging since I started
>working with the package. Rather than make a little tweak here and a
>little tweak there, I think it's time for a more whole-sale approach.
>What's the minimum number of class we'd have to include to make use of
>Jakarta Commons Logging?
>
>
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/package-summary.html
Ryan's Summary:
Looks like we need to import org.apache.commons.logging.Log and
org.apache.commons.logging.LogFactory. With no further configuration,
log messages now go to:
- Log4J if it is found in the classpath
- a java.util.logging.Logger if running on a JDK >= 1.4
- oblivion otherwise
This can be further configured with a system property, a
META-INF/services/org.apache.commons.logging.LogFactory file, or a
commons-logging.properties file.
Since we don't have multiple inheritance, should we stick this stuff in
a utility class or on the XmlRpc base class?
--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net
Re: Internal logging API
Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Daniel Rall wrote:
>Ryan, I've been wanting more elegant handling logging since I started
>working with the package. Rather than make a little tweak here and a
>little tweak there, I think it's time for a more whole-sale approach.
>What's the minimum number of class we'd have to include to make use of
>Jakarta Commons Logging?
>
>
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/package-summary.html
Ryan's Summary:
Looks like we need to import org.apache.commons.logging.Log and
org.apache.commons.logging.LogFactory. With no further configuration,
log messages now go to:
- Log4J if it is found in the classpath
- a java.util.logging.Logger if running on a JDK >= 1.4
- oblivion otherwise
This can be further configured with a system property, a
META-INF/services/org.apache.commons.logging.LogFactory file, or a
commons-logging.properties file.
Since we don't have multiple inheritance, should we stick this stuff in
a utility class or on the XmlRpc base class?
--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net
Internal logging API
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Ryan Hoegg <rh...@isisnetworks.net> writes:
> Hi Daniel,
>
> Mind if I modify this to use a private log() method that behaves
> identically? This is just looking forward to standardization of the
> library on a logging platform.
>
> dlr@apache.org wrote:
>
> > try
> > {
> > Socket socket = serverSocket.accept();
> > + try
> > + {
> > + socket.setTcpNoDelay(true);
> > + }
> > + catch (SocketException socketOptEx)
> > + {
> > + System.err.println(socketOptEx);
> > + }
> > +
> > if (allowConnection(socket))
> > {
> > Runner runner = getRunner();
Ryan, I've been wanting more elegant handling logging since I started
working with the package. Rather than make a little tweak here and a
little tweak there, I think it's time for a more whole-sale approach.
What's the minimum number of class we'd have to include to make use of
Jakarta Commons Logging?
--
Daniel Rall <dl...@finemaltcoding.com>
Internal logging API
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Ryan Hoegg <rh...@isisnetworks.net> writes:
> Hi Daniel,
>
> Mind if I modify this to use a private log() method that behaves
> identically? This is just looking forward to standardization of the
> library on a logging platform.
>
> dlr@apache.org wrote:
>
> > try
> > {
> > Socket socket = serverSocket.accept();
> > + try
> > + {
> > + socket.setTcpNoDelay(true);
> > + }
> > + catch (SocketException socketOptEx)
> > + {
> > + System.err.println(socketOptEx);
> > + }
> > +
> > if (allowConnection(socket))
> > {
> > Runner runner = getRunner();
Ryan, I've been wanting more elegant handling logging since I started
working with the package. Rather than make a little tweak here and a
little tweak there, I think it's time for a more whole-sale approach.
What's the minimum number of class we'd have to include to make use of
Jakarta Commons Logging?
--
Daniel Rall <dl...@finemaltcoding.com>
Re: cvs commit: xml-rpc/src/java/org/apache/xmlrpc WebServer.java
Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Hi Daniel,
Mind if I modify this to use a private log() method that behaves
identically? This is just looking forward to standardization of the
library on a logging platform.
--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net
dlr@apache.org wrote:
> try
> {
> Socket socket = serverSocket.accept();
> + try
> + {
> + socket.setTcpNoDelay(true);
> + }
> + catch (SocketException socketOptEx)
> + {
> + System.err.println(socketOptEx);
> + }
> +
> if (allowConnection(socket))
> {
> Runner runner = getRunner();
>
Re: cvs commit: xml-rpc/src/java/org/apache/xmlrpc WebServer.java
Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Hi Daniel,
Mind if I modify this to use a private log() method that behaves
identically? This is just looking forward to standardization of the
library on a logging platform.
--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net
dlr@apache.org wrote:
> try
> {
> Socket socket = serverSocket.accept();
> + try
> + {
> + socket.setTcpNoDelay(true);
> + }
> + catch (SocketException socketOptEx)
> + {
> + System.err.println(socketOptEx);
> + }
> +
> if (allowConnection(socket))
> {
> Runner runner = getRunner();
>