home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / isis / 309 < prev    next >
Encoding:
Text File  |  1992-11-18  |  3.5 KB  |  92 lines

  1. Newsgroups: comp.sys.isis
  2. Path: sparky!uunet!caen!batcomputer!cornell!ken
  3. From: ken@cs.cornell.edu (Ken Birman)
  4. Subject: A TCP bug in most SVR4 compatible UNIX systems; a work-around
  5. Message-ID: <1992Nov18.160945.12589@cs.cornell.edu>
  6. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  7. Date: Wed, 18 Nov 1992 16:09:45 GMT
  8. Lines: 82
  9.  
  10. We have recently run into a whole slew of performance problems with
  11. vendor releases of TCP protocols that 
  12.     1) Support a setsocketopt option TCP_NODELAY
  13.     2) Default to have TCP_NODELAY 0 ("delay")
  14. These TCP implementations have the annoying property that under
  15. many conditions, TCP sends are delayed to attempt to buffer 
  16. multiple sends into one packet.  Worse, on some machines (SWBTL
  17. ran into this on a TANDEM under their version of UNIX), the sender
  18. gets delayed too, which seems really strange.
  19.  
  20. Either way, performance is severely affected.  For example, the
  21. TANDEM RPC time to protos was measured at 250ms whenever a packet
  22. had to be transmitted in two or more fragments (depends on how Isis
  23. represents the data), while it was in the 6ms range normally!  For
  24. SUN OS you would see something similar in the same situation.
  25.  
  26. There is a very simple fix for this problem.  When opening a TCP
  27. connection (after the connect or accept call) you do:
  28.  
  29. #ifdef IPPROTO_TCP
  30. #    ifdef TCP_NODELAY
  31.      {
  32.        int enable = 1;
  33.        setsocketopt(fdes, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable));
  34.      }
  35. #    endif
  36. #endif
  37.  
  38. The ifdef's are to make your code more portable: on a UNIX that doesn't
  39. define IPPROTO_TCP or support option TCP_NODELAY, nothing is compiled.
  40. (If the options are defined and not working, all bets are off -- but
  41. I doubt that this is a problem on the major vendor platforms).
  42.  
  43. In ISIS itself, we are adding this to the standard release as of the
  44. patch-11 tape for V3.0.7, which is being made up today (you get it
  45. if you ask for it and have support, or if you purchase the system after
  46. today).  Same for V2.2.7.  We will set this option:
  47.  
  48.     - In TCP connections made using isis_connect
  49.     - When using TCP to connect from protos to a remote client.
  50.  
  51. If you need to edit this into the obscured source yourself, you can
  52. do so as follows:
  53.  
  54. 1) in cl_isis.c, after a label "Ba004c8:" around line 497; e.g.:
  55.  
  56. Ba004c8:
  57. #ifdef IPPROTO_TCP
  58. #    ifdef TCP_NODELAY
  59.      {
  60.            int enable = 1;
  61.            setsocketopt(He08aa6e, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable));
  62.      }
  63. #    endif
  64. #endif
  65.  
  66. 2) in pr_client.c, after the following line (218 in my code):
  67. L60509d26 = D60b66334(R3c9965b2, (D315a3970 P3497e080 *)&B1481a1d2, (int*)&J934091e);
  68. #ifdef IPPROTO_TCP
  69. #    ifdef TCP_NODELAY
  70.      {
  71.            int enable = 1;
  72.            setsocketopt(L60509d26, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable));
  73.      }
  74. #    endif
  75. #endif
  76.  
  77. In the case of isis_connect, you can just do this in your own code
  78. after getting the file descriptor back.
  79.  
  80. Again, I have no idea how common this problem is.  We have seen it on
  81. TANDEM systems and on SUN OS systems -- but not always on the latter.
  82. Indeed, we are unclear just what needs to be true to trigger it on SUN
  83. platforms.  Perhaps the option isn't initialized in a consistent way
  84. within one of the SUN releases of TCP.  Anyhow, explicitly enabling
  85. NODELAY mode is the right thing to do when latency might matter on a 
  86. TCP connection.
  87.  
  88. -- 
  89. Kenneth P. Birman                              E-mail:  ken@cs.cornell.edu
  90. 4105 Upson Hall, Dept. of Computer Science     TEL:     607 255-9199 (office)
  91. Cornell University Ithaca, NY 14853 (USA)      FAX:     607 255-4428
  92.