home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / e / perf.doc < prev    next >
Text File  |  2020-01-01  |  22KB  |  386 lines

  1. THE TRUTH ABOUT KERMIT FILE TRANSFER PERFORMANCE
  2.  
  3.   Frank da Cruz
  4.  
  5. In the early 1980s, the first generation of Kermit software used the basic
  6. Kermit protocol: stop-and-wait exchange of short packets.  The basic protocol
  7. is easily implemented and highly robust, and led to its rapid proliferation to
  8. hundreds of hardware and software platforms where it proved a success in
  9. transferring files under even the most difficult conditions.
  10.  
  11. The new generation of Kermit software improves on the original robust
  12. qualities and dramatically boosts performance without sacrificing
  13. compatibility with the earlier generation.  Protocol capabilities are
  14. negotiated automatically so the newest, most advanced versions can still
  15. exchange files with the earliest or most minimal versions.
  16.  
  17. Kermit's performance features include long packets, sliding windows,
  18. control-prefixing selection, locking shifts, and compression.  The first three
  19. have the potential for causing problems, and are not used unless you ask for
  20. them.  This article describes Kermit's performance features and tests them
  21. against other popular protocols.  The results might surprise you.
  22.  
  23. Long Packets and Sliding Windows
  24.  
  25. The maximum packet length in the basic Kermit protocol is 94, chosen to
  26. prevent data loss when the receiver has small input buffers or lacks an
  27. adequate method of flow control, and also to reduce vulnerability to noise.
  28. But since 1985, Kermit's long-packet extension has allowed packets up to 9024
  29. bytes in length to be used when conditions permit.
  30.  
  31. Longer packets reduce the ratio of protocol overhead to actual data,
  32. increasing the potential file transfer efficiency (the ratio of file
  33. characters transferred per second to the actual connection speed) from 86%
  34. (for 94-byte packets) to 95% (with 2500-byte packets).  When conditions
  35. deteriorate on the connection, the packet length is automatically adjusted.
  36.  
  37. Original, basic Kermit was a stop-and-wait protocol because it had to work on
  38. half-duplex as well as full-duplex connections.  But connections through
  39. satellites or packet-switched networks can have delays that seriously impede
  40. the efficiency of a stop-and-wait packet protocol.  For example, suppose
  41. packets are 90 bytes = 900 bits long, and there is a one-second transmission
  42. delay.  For one packet and its response, the round-trip delay is 2 seconds.
  43. At 300 bits per second (bps), the 3 seconds required to transmit the packet
  44. plus the 2-second delay make 5 seconds, so throughput is 180 bps, 60%
  45. efficiency.  At 9600 bps, it takes only 1/10 second to transmit the same
  46. packet, but the delay is still 2 seconds.  Throughput is only 428 bps, 4.5%
  47. efficiency.  When connections have delays, efficiency can be improved by
  48. lengthening the packets, but only if the connection is clean.  On a noisy
  49. connection, longer packets are more likely to be damaged in transmission and
  50. take longer to retransmit.
  51.  
  52. On full-duplex connections, the new generation of Kermit software (IBM
  53. mainframe Kermit excluded, which always has a half-duplex connection) can
  54. transmit packets in a steady stream, processing the acknowledgements later as
  55. they arrive, thus eliminating the effects of transmission delays, and also
  56. eliminating the overhead of the acknowledgements themselves, since they are
  57. "on the wire" at the same time as the data packets and therefore don't take up
  58. any extra transmission time.  This technique is called sliding windows,
  59. because multiple packets are kept in a buffer (window) that "slides" forward
  60. whenever the oldest packet in the window is acknowledged.
  61.  
  62. Using 94-byte packets without sliding windows on a connection that has a
  63. 1-second delay results (according to actual measurements) in an efficiency of
  64. about 8%.  Raising the packet length to 1500 on the same connection increases
  65. the efficiency to 63%.  Using sliding windows on the same connection raises
  66. the efficiency to 82-90%, depending on the packet length.
  67.  
  68.    ------------------------------------------------------------------------
  69.    Optimum performance can be achieved on any given connection by choosing
  70.    the right combination of packet length and window size.
  71.    ------------------------------------------------------------------------
  72.  
  73. To see a dramatic speed improvement using MS-DOS Kermit 3.13 and/or C-Kermit
  74. 5A, simply give these commands to each Kermit before file transfer:
  75.  
  76.   SET WINDOW 3
  77.   SET RECEIVE PACKET-LENGTH 1000
  78.  
  79. Adjust as necessary.  Longer delays require larger windows; noisier
  80. connections (or devices with small input buffers) need shorter packets.
  81. MS-DOS Kermit 3.13 and most versions of C-Kermit 5A allow the theoretical
  82. maximum sizes, 31 and 9024 respectively, sufficient to overcome any reasonable
  83. delay (for example, between the earth and the moon).
  84.  
  85. Compression
  86.  
  87. To reduce transmission overhead, the Kermit protocol uses a simple, but often
  88. surprisingly effective, compression technique: repeated byte values are
  89. represented by a count+byte combination.  This technique is easy to program
  90. and inexpensive in memory and CPU cycles, and is therefore implemented in most
  91. Kermit software, including MS-DOS Kermit, C-Kermit, and IBM mainframe Kermit,
  92. and is used automatically when available.
  93.  
  94. Analysis of large volumes of both textual and binary data shows an average
  95. compression of 15-20%.  Dramatic savings are achieved in certain types of
  96. files, including tabular text (or any other type of text with lots of repeated
  97. characters) and executable programs containing large amounts of pre-zeroed
  98. data.
  99.  
  100. Prefixing
  101.  
  102. To achieve its ability to push data through even the most restrictive types of
  103. connections--for example, to mainframes that are sensitive to certain control
  104. characters, or on 7-bit connections, or on very noisy ones (one user said
  105. recently, "Kermit will send data over a communication channel that is only
  106. slightly better than a pair of tin cans connected with a wet string")--Kermit
  107. formats its packets as lines of printable text.  This is done by encoding each
  108. control character as a sequence of two printable characters and, on 7-bit
  109. connections only, encoding 8-bit characters as a sequence of two printable
  110. 7-bit bytes.
  111.  
  112. On some connections it is safe to transmit certain control characters "bare,"
  113. without prefixing or encoding.  "Unprefixing" of control characters can speed
  114. up the transfer of binary files, particularly precompressed files, which tend
  115. to contain a lot of bytes in the control range.  MS-DOS Kermit 3.13 and
  116. C-Kermit 5A(189) give you the ability to specify which control characters are
  117. to be prefixed and which are not.  In the benchmarks on pages 7 and -SPEEDY,
  118. only three control characters are prefixed:
  119.  
  120.   SET CONTROL UNPREFIXED ALL
  121.   SET CONTROL PREFIXED 0 1 129
  122.  
  123. This technique can be used even if the Kermit program on the other end doesn't
  124. know anything about it, since well-designed Kermit software will, indeed,
  125. accept bare control characters literally.  The three exceptions above are NUL
  126. (0), which is used internally by C-Kermit for string termination, and SOH (1)
  127. and SOH+parity (129), Kermit's normal packet-start indicator.  It takes some
  128. experimentation to find the maximum safe set.  That's why Kermit prefixes all
  129. control characters by default: first make it work, then make it fast.
  130.  
  131. On 8-bit connections, Kermit transfers 8-bit data with no additional overhead.
  132. On 7-bit connections, which are quite common--these are the connections that
  133. use even, odd, mark, or space parity, often without the user's
  134. knowledge--8-bit data is encoded using a single-shift technique, a prefix
  135. character for each byte whose 8th bit is 1, similar to holding down the
  136.  
  137.    ------------------------------------------------------------------------
  138.    The Kermit protocol implementations found in many of the popular
  139.    commercial and shareware PC communication software packages are minimal
  140.    and perfunctory, usually lacking some or all of the performance
  141.    features...
  142.    ------------------------------------------------------------------------
  143.  
  144. Shift key on your keyboard for each 8-bit character.  This allows Kermit to
  145. work where most other protocols fail. The amount of prefixing ranges from 0%
  146. up to 100%, depending on the type of file.
  147.  
  148. Locking Shifts
  149.  
  150. To avoid the high overhead of transferring 8-bit text, particulary Cyrillic,
  151. Hebrew, or Kanji, on 7-bit connections, a new "locking-shift" feature works
  152. like the Caps Lock key on your PC:  a special shift prefix applies to a entire
  153. run of 8-bit characters, no matter how long, rather than to a single
  154. character.  Locking shifts are used in combination with single shifts to
  155. achieve the most compact encoding.
  156.  
  157. Locking shifts are supported by MS-DOS Kermit 3.13, C-Kermit 5A, and IBM
  158. Mainframe Kermit 4.2.4, and are negotiated automatically when parity is in use
  159. (including when parity is detected automatically).  They reduce the 8th-bit
  160. prefixing penalty anywhere from 0% to 100%, depending on the groupings of the
  161. 8-bit characters within the file.
  162.  
  163. So Why the Bad Reputation?
  164.  
  165. The Kermit protocol implementations found in many of the popular commercial
  166. and shareware PC communication software packages are minimal and perfunctory,
  167. usually lacking some or all of the performance features just described.  Many
  168. of these same packages also include XMODEM, YMODEM, or ZMODEM protocol, which
  169. (when they work at all) usually perform better than the basic short-packet,
  170. stop-and-wait, prefix-everything Kermit protocol.  Using a limited Kermit
  171. implementation is like filling your bathtup from a dripping faucet instead of
  172. turning the water on full blast.  It is easy to see why users of such packages
  173. might conclude that Kermit file transfers are slow.  Nothing could be further
  174. from truth; turn the page and see for yourself.
  175.  
  176. TRUE-LIFE BENCHMARKS
  177.  
  178. Table 1 illustrates the performance of the Kermit protocol implementations
  179. found in different PC software packages.  These measurements were made on a
  180. direct 19200-bps serial connection, downloading a typical ASCII text file (the
  181. VM/CMS Kermit-370 manual), 135087 bytes in length, from a Sun SPARCserver-10
  182. with C-Kermit 5A(189) to the hard disk of an IBM PS/2 Model 70.
  183.  
  184. Table 1:  Kermit Implementations Compared
  185. ------------------------------------------------------------------------------
  186.               Window Packet Time Speed
  187. PC Software    Size  Length secs  cps  Effic. Remarks
  188. ------------------------------------------------------------------------------
  189.  Telix           1     94   131   1052   55%  Long packets and s/w not avail
  190.  MTEZ            1     94   119   1158   60%  Long packets and s/w not avail
  191.  Smartcom III    1     94   113   1220   64%  Long packets and s/w not avail
  192.  PROCOMM PLUS   14   1000    77   1790   93%  Window size not selectable
  193.  Zstem 340       2   1000    74   1863   97%  Maximum window size 2
  194.  MS-DOS Kermit   3   1000    72   1915   99%  Full control-character prefixing
  195.  MS-DOS Kermit   3   1000    69   1999  104%  Only 0, 1, and 129 prefixed
  196. ------------------------------------------------------------------------------
  197.  
  198. The results speak for themselves.
  199.  
  200.     If you thought Kermit file transfer was slow, you were probably not
  201.     using real Kermit software!
  202.  
  203. The UNIX-resident copy of the file, like all UNIX text files, uses only
  204. linefeed (LF) for line termination.  During text-mode transfer, each LF
  205. becomes carriage return and linefeed (CRLF).  There are 2814 lines in the
  206. file, so the actual data size during (and after) transfer is 137901.  Since
  207. the connection runs at 1920 characters per second (10 bits per character), a
  208. 100%-efficiency transfer should take 137901 / 1920 = 71.8 seconds.  The
  209. following PC communications software was used:
  210.  
  211.   MS-DOS Kermit 3.13     Columbia University, New York, NY, USA
  212.   MTEZ 1.16              MagicSoft, Inc., Lombard, IL, USA
  213.   PROCOMM PLUS 2.0       Datastorm Technologies, Inc., Columbia, MO, USA
  214.   Smartcom III 1.0A      Hayes Microcomputer Products, Inc, Norcross, GA, US
  215.   Telix 3.21             deltaComm Development, Cary, NC, USA
  216.   Zstem 340 1.0.4        KEA Systems Ltd., Burnaby, BC, Canada
  217.  
  218. Kermit and X-Y-ZMODEM
  219.  
  220. XMODEM, YMODEM, and ZMODEM are the file tranfer protocols most commonly
  221. compared with Kermit, and which are found in numerous shareware and commercial
  222. communication software packages.  XMODEM and YMODEM are stop-and-wait
  223. protocols; XMODEM uses short blocks (128 data bytes), YMODEM uses longer ones
  224. (1024 data bytes).  ZMODEM is a streaming protocol.
  225.  
  226. The tables on page 8 compare XMODEM, YMODEM, ZMODEM, and Kermit transfers
  227. between the PC and UNIX.  The file transfer software on the UNIX system is sx
  228. (XMODEM) / sb (YMODEM) / sz (ZMODEM) 3.24 (June 1993) and C-Kermit 5A(189).
  229. On the PC, X-, Y- and ZMODEM transfers were done with Telix and PROCOMM PLUS
  230. (which gave exactly the same results).  For fairness, four types of files are
  231. transferred:
  232.  
  233.   ASCII Text:    IKCKER.DOC 137901 bytes  Our original ASCII text file
  234.   UNIX Binary:   uuencode    24576 bytes  A Sun SPARC binary executable program
  235.   PC Binary:     KERMIT.EXE 197928 bytes  An MS-DOS binary executable program
  236.   Precompressed: KERMIT.ZIP 238584 bytes  A compressed ZIP archive
  237.  
  238. Tests were performed on four types of connections and in each trial, Kermit
  239. transfers used a window size of 5 and a packet length of 5000, and control
  240. prefixing was disabled except for NUL (0), Ctrl-A (1), and 129.  As the tables
  241. show, Kermit outperforms the competition every time.
  242.  
  243. Table 2 shows the figures for transferring all four files with each of the
  244. four protocols on same direct connection used for Table 1.  In this and the
  245. following tables, the secs column shows the elapsed time of transfer in
  246. seconds, the cps column shows actual file characters transferred per second,
  247. and the eff column shows the percent efficiency (file characters per second
  248. divided by the connection speed).
  249.  
  250. Table 2:  X- Y- and ZMODEM vs Kermit on a 19200-bps Direct Connection
  251. ------------------------------------------------------------------------------
  252.               XMODEM          YMODEM          ZMODEM           KERMIT
  253. File Type     secs  cps  eff  secs  cps  eff  secs  cps  eff   secs  cps  eff 
  254. ------------------------------------------------------------------------------
  255. ASCII Text      89 1549  81%    76 1814  95%    73 1889  98%     69 1999 104%
  256. UNIX Binary     15 1638  85%    13 1890  98%    13 1890  98%      9 2648 138%
  257. PC Binary      127 1558  81%   109 1816  95%   107 1850  96%    100 1979 103%
  258. Precompressed  153 1559  81%   133 1794  93%   130 1835  96%    129 1849  96%
  259. -------------------------------------------------------------------------------
  260.  
  261. Table 3 shows the results for a local-call dialup connection using Telebit
  262. T3000 modems, V.32bis modulation (14400 bps), V.42 error correction, V.42bis
  263. compression, RTS/CTS hardware flow control, and an interface speed of 57600
  264. bps.  The efficiencies in this table are based on the modem's 14400-bps
  265. connection speed, and therefore also reflect the modem's compression methods.
  266.  
  267. Table 3:  X- Y- and ZMODEM vs Kermit with High-Speed Modems
  268. ------------------------------------------------------------------------------
  269.               XMODEM          YMODEM          ZMODEM           KERMIT
  270. File Type     secs  cps  eff  secs  cps  eff  secs  cps  eff   secs  cps  eff 
  271. ------------------------------------------------------------------------------
  272. ASCII Text     221  624 43%     79 1746 121%    42 3283 228%     39 3535 246%
  273. UNIX Binary     32  768 53%     13 1890 131%    15 1638 114%      3 8192 569%
  274. PC Binary      346  572 40%    129 1534 106%    83 2385 166%     80 2474 172%
  275. Precompressed  500  477 33%    208 1147  79%   149 1601 111%    148 1612 112%
  276. ------------------------------------------------------------------------------
  277.  
  278. So far we've looked only at connections with no delays.  Table 4 (also see
  279. cover, left group) shows the results for a V.32 9600-bps cross-country dialup
  280. connection from the same PC to a PC/486-50 running UNIX System V R4, with the
  281. same C-Kermit, sx, sb, and sz software as on the Sun.  The round-trip delay is
  282. a fraction of a second.  No error correction or compression is done by the
  283. modems, but the connection is clean and no errors occurred.
  284.  
  285. Table 4:  X- Y- and ZMODEM vs Kermit with Delays at 9600 bps
  286. ------------------------------------------------------------------------------
  287.               XMODEM          YMODEM          ZMODEM           KERMIT
  288. File Type     secs  cps  eff  secs  cps  eff  secs  cps  eff   secs  cps  eff 
  289. ------------------------------------------------------------------------------
  290. ASCII Text     422  327  33%   253  545  57%   217  635  66%    151  913  95%
  291. UNIX Binary     73  337  35%    41  599  62%    32  768  80%      8 3072 320%
  292. PC Binary      536  369  38%   319  620  65%   271  730  76%    207  956  99%
  293. Precompressed  710  336  37%   363  657  68%   314  759  79%    284  840  87%
  294. ------------------------------------------------------------------------------
  295.  
  296. But if we always had clean connections, why would we need error-correcting
  297. file-transfer protocols?  Table 5 (and middle group, cover) shows the results
  298. for the same cross-country connection, same settings, but with short bursts of
  299. noise injected every two seconds, which cause errors and retransmissions in
  300. all four protocols.
  301.  
  302. Table 5:  X- Y- and ZMODEM vs Kermit with Delays and Noise at 9600 bps
  303. ------------------------------------------------------------------------------
  304.               XMODEM          YMODEM          ZMODEM           KERMIT
  305. File Type     secs  cps  eff  secs  cps  eff  secs  cps  eff   secs  cps  eff 
  306. ------------------------------------------------------------------------------
  307. ASCII Text    3346   41   4%  fail    0   0%   438  315  33%    206  669  70%
  308. UNIX Binary    573   43   4%    58  424  44%   144  171  18%      9 2736 284%
  309. PC Binary     5154   42   4%  fail    0   0%   566  350  36%    281  706  74%
  310. Precompressed 5917   40   4%  fail    0   0%   694  344  36%    385  621  65%
  311. ------------------------------------------------------------------------------
  312.  
  313. What about 7-Bit Connections?  No Contest!
  314.  
  315. The foregoing benchmarks were conducted in environments where XMODEM, YMODEM,
  316. and ZMODEM can work, namely 8-bit transparent connections that are not
  317. sensitive to any control characters.  Now let's look a different, but very
  318. common, situation.  Table 6 (and right group, cover) shows the results of
  319. downloading the same files from an IBM Mainframe running VM/CMS and Kermit-370
  320. 4.2.5 to the PS/2 over a 19200-bps serial connection through an IBM 7171
  321. protocol converter, which uses even parity and Xon/Xoff flow control.
  322. Kermit's window size is 1 because the mainframe can operate only in half
  323. duplex, and the packet length is 1920, the largest allowed by the 7171.  All
  324. control characters are prefixed.
  325.  
  326. Table 6:  File Transfer on a 7-Bit Connection
  327. ------------------------------------------------------------------------------
  328.               XMODEM          YMODEM          ZMODEM           KERMIT
  329. File Type     secs  cps  eff  secs  cps  eff  secs  cps  eff   secs  cps  eff 
  330. ------------------------------------------------------------------------------
  331. ASCII Text      -     0   0%    -     0   0%    -     0   0%     81 1702  88%
  332. UNIX Binary     -     0   0%    -     0   0%    -     0   0%      9 2730 142%
  333. PC Binary       -     0   0%    -     0   0%    -     0   0%    162 1221  63%
  334. Precompressed   -     0   0%    -     0   0%    -     0   0%    243  981  51%
  335. ------------------------------------------------------------------------------
  336.  
  337. The table shows Kermit file transfer to be infinitely more efficient than
  338. X-Y-Z-MODEM transfer with IBM mainframes, because X-Y-Z-MODEM implementations
  339. do not work with IBM mainframe operating systems such as VM/CMS, MVS/TSO, or
  340. CICS, whereas Kermit works with all of them.  Of course, 7-bit connections are
  341. not peculiar to IBM mainframes.  They are also used by other types of
  342. mainframes and front ends as well as many types of networks and devices,
  343. including some X.25-based public data networks and certain terminal servers.
  344. You can use Kermit to transfer files on these connections, but not X-Y-Z-MODEM
  345. protocols.
  346.  
  347. Locking Shifts
  348.  
  349. Although Kermit, unlike X-Y-Z-MODEM, can transfer 8-bit data over 7-bit
  350. connections, there is often a performance penalty.  This penalty is
  351. particularly unfair to people whose written languages are encoded primarily in
  352. 8-bit characters, as are Russian, Hebrew, and Japanese.  Russian text encoded
  353. in any of the commonly used 8-bit Cyrillic character sets typically consists
  354. of about 80%  8-bit characters and Japanese Kanji text often consists of
  355. nearly 100% 8-bit characters.
  356.  
  357. Table 7 shows the results of attempting to upload typical Russian and Japanese
  358. 8-bit text files over a 19200-bps 7-bit serial connection to an IBM mainframe
  359. using X-Y-Z-MODEM (it can't be done), Kermit with only single shifts (SS), and
  360. Kermit with locking shifts (LS).  The Kermit window size is 1 and the packet
  361. length is 1920.  In these cases, locking shifts improve the speed of transfer
  362. 30-40%.
  363.  
  364. Table 7:  Effect of Locking Shifts
  365. -------------------------------------------------------------------------------
  366.                          X-Y-Z-MODEM       KERMIT (SS)       KERMIT (LS)
  367. File Type      Size      secs  cps  eff    secs  cps  eff    secs  cps  eff
  368. -------------------------------------------------------------------------------
  369. Russian Text   52046       -     0   0%      55  946  49%      39 1334  69%
  370. Japanese Text  29706       -     0   0%      34  873  45%      20 1485  77%
  371. -------------------------------------------------------------------------------
  372.  
  373. Conclusion
  374.  
  375. Kermit protocol works in practically every communication and computing
  376. environment.  You don't have to be a data communications expert to transfer a
  377. file with Kermit software.  Its first priority is getting your data through
  378. safe and sound, and its second is efficiency.  Kermit's conservative protocol
  379. defaults reflect these priorities:   First make it work, then make it fast.
  380.  
  381. But as the tests show, today's Kermit software, when given several simple
  382. commands to enable its efficiency features, outperforms X-, Y-, and ZMODEM
  383. protocol transfers every time.  And real Kermit software also outperforms the
  384. Kermit protocol implementations found in commercial and shareware
  385. communications programs.  Skeptical?  Run your own tests!
  386.