Rough patch to avoid TCP/IP IIOP v1.2.1



I've included the rough and ready fix I've done on IIOP/connection.c to
avoid a 200ms delay on each call. In my case its increased the throughput
by 900%. I've posted it in case someone else is using ORBit for
heavy throughput (I'm attaching a database behind it - nothing to do
with gnome at all).

The patch is rough and ready, and needs some work from someone with a
linux box to check if its platform independent. I also havn't changed the
perror calls to something more appropriate. 

The fix is nearly a direct copy from the SCO tech article:
http://www.sco.com/cgi-bin/ssl_reference?107451.shtml which gives some
details and mentiones sunOS also implement that aspect of the TCP/IP
standard. Checking JacORB (java), the other orb I'm using, it sets
TcpNoDelay on all its sockets.

Anyway, the patch is:

--- ORBit-0.5.3-orig/src/IIOP/connection.c	Sat Feb 19 02:18:00 2000
+++ ORBit-0.5.3/src/IIOP/connection.c	Mon Oct 23 21:12:25 2000
@@ -22,6 +22,12 @@
 #endif
 #include <arpa/inet.h>
 #include <netdb.h>
+/* added resolv.h as SCO Openserver 5 doesn't define h_errno
+ * anywhere but there - ianh microskil com au
+ * uname -a
+ */
+#include <resolv.h>
+
 #ifdef WE_DEFINED_XOPEN_SOURCE_EXTENDED
 #   undef _XOPEN_SOURCE_EXTENDED
 #endif
@@ -36,6 +42,12 @@
 #include <tcpd.h>
 #endif
 
+/* included for getprotobyname and setsockopt for TCP_NODELAY
+ * - ianh microskil com au
+ */
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
 #if 0
 #include <malloc.h>
 
@@ -524,6 +536,26 @@
        (struct sockaddr *)&server_cnx->u.ipv4.location,
        sizeof(struct sockaddr_in));
 
+    {
+        /* very quick and dirty patch to speed up tcp/ip
+         * - ianh microskil com au
+         */
+	struct protoent *proto;
+	int on;
+	char	*rs;
+
+        if ((proto = getprotobyname("tcp")) == 0 )
+        {
+            perror("getprotent");
+            exit(1);
+        }
+        on = 1;
+        if (setsockopt( GIOP_CONNECTION_GET_FD(server_cnx),proto->p_proto,TCP_NODELAY,&on,sizeof(on)) == -1)
+        {
+            perror("setsockopt");
+            exit(1);
+	}
+    }
   fcntl(GIOP_CONNECTION_GET_FD(server_cnx), F_SETFD,
 	fcntl(GIOP_CONNECTION_GET_FD(server_cnx), F_GETFD, 0)
 	| FD_CLOEXEC);
@@ -868,6 +900,27 @@
 	      "iiop_connection_new connect [%d] to %s:%d\n",
 	      GIOP_CONNECTION_GET_FD(retval),
 	      host, (guint)port);
+
+    {
+        /* very quick and dirty patch to speed up tcp/ip
+         * - ianh microskil com au
+         */
+	struct protoent *proto;
+	int on;
+	char	*rs;
+
+        if ((proto = getprotobyname("tcp")) == 0 )
+        {
+            perror("getprotent");
+            exit(1);
+        }
+        on = 1;
+        if (setsockopt( GIOP_CONNECTION_GET_FD(retval),proto->p_proto,TCP_NODELAY,&on,sizeof(on)) == -1)
+        {
+            perror("setsockopt");
+            exit(1);
+	}
+    }
 
 
   fcntl(GIOP_CONNECTION_GET_FD(retval), F_SETFD, FD_CLOEXEC);


Regards,
Ian Heggie
________________________________________________________________
ianh microskil com au              [private:Ian Heggie iname com]
Systems Development
Microskil Pty Ltd                          Phone: (03) 9836 9400
461 Whitehorse road BALWYN 3103 Australia  Fax:   (03) 9836 9500





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]