home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3279 < prev    next >
Internet Message Format  |  1991-05-02  |  11KB

  1. From: golding@terra.ucsc.edu (Richard Golding)
  2. Newsgroups: comp.parallel,alt.sources,sci.research
  3. Subject: Experiment to measure wide-area communication performance
  4. Message-ID: <1991May2.140829.9858@hubcap.clemson.edu>
  5. Date: 29 Apr 91 22:38:34 GMT
  6. Approved: parallel@hubcap.clemson.edu
  7.  
  8.  
  9. At UC Santa Cruz we are conducting a series of measurements of the
  10. Internet, as part of a project to understand how to build efficient
  11. wide-area applications (and not incidentally as part of my MS thesis
  12. work).  As a part of these measurements, we need to obtain traces of
  13. communication failure rates and latency.
  14.  
  15. If you are at a site on the Internet which can send and receive UDP
  16. packets to and from UCSC, we need your assistance.(1)
  17.  
  18. We are asking that people at several sites throughout the Internet run
  19. a simple daemon for two weeks, from Thursday, 2 May 1991 through
  20. Thursday, 16 May 1991.  We will be sending this daemon a UDP packet a
  21. few times each day.  The daemon simply echoes this packet back to the
  22. sender, so we can time how long it takes.
  23.  
  24. The source for this daemon is enclosed in this message, and should
  25. take less than five minutes to install.  We're providing the source
  26. code so you can look it over and convince yourself it doesn't pose a
  27. significant load or security risk for your machine.  (More on this in
  28. the installation instructions.)
  29.  
  30. The daemon runs on Sun3 and Sun4 systems under SunOS 4.x, and on
  31. HP9000 systems under HPUX 7.0.
  32.  
  33. The attached shar file contains a C program, makefile, wand
  34. installation instructions.  The installation involves compiling the
  35. program, adding the program to crontab (or some other mechanism to
  36. ensure it runs regularly), and sending mail to us informing us of your
  37. host, port, and organization.
  38.  
  39. If you have concerns or questions, please feel free to contact us.
  40.  
  41. Thank you.
  42.  
  43. Richard Golding
  44. Graduate Student, Computer & Info Sciences
  45. Baskin Center for CE&IS
  46. University of California
  47. Santa Cruz, CA 95064
  48. (408) 458-3613
  49. Internet:  golding@cis.ucsc.edu, or
  50.            golding@cello.hpl.hp.com, or 
  51.            golding@slice.ooc.uva.nl
  52.  
  53. (1)  This rules out sites inside several companies, such as HP, Sun,
  54. and Apple, which do not pass certain classes of traffic from the
  55. outside. 
  56.  
  57. ---- Cut Here and unpack ----
  58. #!/bin/sh
  59. # shar:    Shell Archiver  (v1.22)
  60. #    Packed Mon Apr 29 15:27:15 PDT 1991 by midgard!golding
  61. #    from directory /terra/a/grads/golding/evrep/validate/distrib
  62. #
  63. #    Run the following text with /bin/sh to create:
  64. #      INSTRUCTIONS
  65. #      Makefile
  66. #      udptestd.c
  67. #      validate.h
  68. #
  69. if test -f INSTRUCTIONS; then echo "File INSTRUCTIONS exists"; else
  70. echo "x - extracting INSTRUCTIONS (Text)"
  71. sed 's/^X//' << 'SHAR_EOF' > INSTRUCTIONS &&
  72. XInstallation instructions
  73. X-------------------------
  74. X
  75. XThese instructions have been verified for Sun3 and Sun4 systems
  76. Xrunning SunOS 4.x, and for HP9000/800 systems running HPUX 7.0.  They
  77. Xmay work on other systems; however, I don't guarantee anything.  If
  78. Xyou have problems please mail golding@cis.ucsc.edu and we'll try to
  79. Xwork it out.  They are known _not_ to work for Ultrix and BSD 4.3
  80. Xsystems, because these systems do not allow individual crontab files.
  81. X
  82. X1.  Unpack the shar file into an otherwise empty directory.  
  83. X
  84. X2.  Configure the test daemon to use the proper UDP port.  By default
  85. Xthe daemon uses port 4296, an unprivileged, unreserved port.  If this
  86. Xconflicts with some other daemon on your system, change the port by
  87. Xediting the third line in the Makefile:
  88. X
  89. X    CFLAGS = -DUDPPORT=<new UDP port number>
  90. X
  91. X3.  Compile the daemon by typing
  92. X
  93. X    make
  94. X
  95. X4.  Add an entry to your crontab to ensure that the daemon continues
  96. Xto run by editing your current crontab.  If you are on a SunOS system,
  97. Xyou can edit your crontab entry using the command:
  98. X
  99. X    crontab -e
  100. X
  101. XOn HPUX and similar systems you will need to save your current crontab
  102. Xinto a file, edit that file, and reset your crontab from that file:
  103. X
  104. X    crontab -l >file
  105. X    (edit) file
  106. X    crontab file
  107. X
  108. XYou should add an entry of the form:
  109. X
  110. X    5,20,35,50 * * 4,5 * $DIR/udptestd > /dev/null 2>&1
  111. X
  112. Xreplacing `$DIR' with the path for the directory in which you
  113. Xinstalled the daemon.
  114. X
  115. X5.  Send mail to golding@cis.ucsc.edu with the following information:
  116. X
  117. X    - The (full) name of the host on which the daemon is being run
  118. X      (e.g. sequoia.ucsc.edu)
  119. X    - The UDP port number the daemon will use (default is 4296)
  120. X    - The host type (e.g. Sun 4/20 using SunOS 4.1.1, or VAX 11/780
  121. X      using BSD4.3 Unix)
  122. X    - A name and organization to be credited in the thesis (or an 
  123. X          indication you prefer to remain anonymous)
  124. X
  125. X    I'd also appreciate comments on how long it took you to install
  126. X    this software, and if it posed any particular problems.
  127. X
  128. XThat's all there is.  
  129. X
  130. X
  131. XCleaning up after the experiment
  132. X--------------------------------
  133. X
  134. XThe measurement experiment is scheduled to last two weeks, from 2 May
  135. X1991 through 16 May 1991.  To allow for problems, I'd ask that you
  136. Xkeep the measurement daemon running through 1 June 1991.  
  137. X
  138. XAfter the experiment is over, you will need to do two things to clean
  139. Xup: 
  140. X
  141. X1.  Remove the entry from your crontab.  On a SunOS 4.x system, use
  142. Xthe command
  143. X    crontab -e
  144. Xto edit your crontab file, and delete the line 
  145. X    5,20,35,50 * * 4,5 * <directory>/udptest > /dev/null 2>&1
  146. Xwhich was added by step 5 in the installation.
  147. X
  148. XOn an HPUX or similar system, you will need save your crontab to a
  149. Xfile, edit the file, and reset your crontab from the file.  The
  150. Xcommands are the same as were used in the last section to add the line
  151. Xto your crontab.
  152. X
  153. X2.  Delete the directory containing the daemon and all its contents. 
  154. X
  155. XSecurity considerations
  156. X-----------------------
  157. X
  158. XWe believe that this program is neither a security nor performance
  159. Xproblem.  However, we're sending out the source code so you can look
  160. Xat it for yourself.  If you feel there is a problem, don't use it.
  161. X
  162. XThe daemon uses an unprivileged UDP port for communication.  You
  163. Xshould choose the port number so that it doesn't conflict with
  164. Xanything else on your system.  The default is probably fine, but you
  165. Xshould check.
  166. X
  167. XCare has been taken that it does not require root privileges either to
  168. Xrun or for installation.  I would recommend _not_ installing it as
  169. Xroot.  It uses a crontab entry to ensure that it will be run following
  170. Xa system restart, rather than requiring that it be added to the
  171. Xsystem's startup configuration.
  172. X
  173. XThe daemon neither writes nor reads files, so there is no
  174. Xpossibility of the daemon using file system space beyond what is
  175. Xrequired for the source and binary.
  176. X
  177. XThe only resources this daemon uses are the memory required to run it,
  178. Xand a trivial amount per message.  We will be sending a few messages
  179. Xeach day -- on the order of 800 per day (11 messages, three times an
  180. Xhour) -- so the daemon should not interfere with normal operations.
  181. X(We found that it added no measurable load to a local Sun4 system, as
  182. Xmeasured by the kernel's 1-, 5-, and 15-minute load averages.)
  183. X
  184. X-----
  185. X
  186. XA technical report on some preliminary work on this problem is
  187. Xavailable as TR # UCSC-CRL-91-01, and can be obtained by ftp from
  188. Xmidgard.ucsc.edu in the file pub/tr/ucsc-crl-91-01.ps.Z .
  189. X
  190. XThank you for your assistance is this experiment.
  191. X
  192. XRichard Golding
  193. Xgolding@cis.ucsc.edu
  194. XConcurrent Systems Lab
  195. XBaskin Center for Computer Engr. & Info. Sci.
  196. XApplied Sciences Building
  197. XUniversity of California
  198. XSanta Cruz CA 95064
  199. SHAR_EOF
  200. chmod 0444 INSTRUCTIONS || echo "restore of INSTRUCTIONS fails"
  201. fi
  202. if test -f Makefile; then echo "File Makefile exists"; else
  203. echo "x - extracting Makefile (Text)"
  204. sed 's/^X//' << 'SHAR_EOF' > Makefile &&
  205. XLIBS =
  206. XCFLAGS = -DUDPPORT=4296 # -DDEBUG
  207. XPROGS = udptestd 
  208. X
  209. Xall: $(PROGS)
  210. X
  211. Xudptestd: udptestd.o
  212. X    cc -o udptestd udptestd.o $(LIBS)
  213. X
  214. Xudptestd.o: udptestd.c validate.h
  215. X
  216. Xclean:
  217. X    -rm -f *.o core *~
  218. X
  219. Xspotless: clean
  220. X    -rm -f $(PROGS)
  221. SHAR_EOF
  222. chmod 0444 Makefile || echo "restore of Makefile fails"
  223. fi
  224. if test -f udptestd.c; then echo "File udptestd.c exists"; else
  225. echo "x - extracting udptestd.c (Text)"
  226. sed 's/^X//' << 'SHAR_EOF' > udptestd.c &&
  227. X#include <sys/types.h>
  228. X#include <sys/time.h>
  229. X#include <sys/socket.h>
  230. X#include <netinet/in.h>
  231. X#include <netdb.h>
  232. X#include <stdio.h>
  233. X#include "validate.h"
  234. X
  235. X#ifdef DEBUG
  236. Xchar *
  237. Xhostnameof(sa)
  238. Xstruct sockaddr_in *sa;
  239. X{
  240. X  struct hostent *h;
  241. X
  242. X  h = gethostbyaddr(sa->sin_addr,sizeof(struct in_addr),AF_INET);
  243. X  return h->h_name;
  244. X}
  245. X
  246. Xint
  247. Xportof(sa)
  248. Xstruct sockaddr_in *sa;
  249. X{
  250. X  return ntohl(sa->sin_port);
  251. X}
  252. X#endif
  253. X
  254. Xvoid
  255. Xgettimestamp(ps,pus)
  256. Xint *ps, *pus;     
  257. X{
  258. X  struct timeval t;
  259. X  
  260. X  gettimeofday(&t, NULL);
  261. X  *ps = htonl(t.tv_sec);
  262. X  *pus = htonl(t.tv_usec);
  263. X}
  264. X
  265. Xvoid
  266. Xdoecho(sock)
  267. Xint sock;
  268. X{
  269. X  req inreq;
  270. X  int len;
  271. X  int flags;
  272. X  struct sockaddr_in from;
  273. X  int fromlen;
  274. X  int rc;
  275. X  rep outrep;
  276. X
  277. X  /* get a request message */
  278. X#ifdef DEBUG
  279. X  printf("waiting for message\n");
  280. X#endif
  281. X  len = sizeof(inreq);
  282. X  fromlen = sizeof(from);
  283. X  flags = 0;
  284. X  rc = recvfrom(sock, &inreq, len, flags, (struct sockaddr *)&from, &fromlen);
  285. X  if (rc < 0) {
  286. X    perror("In recvfrom");
  287. X    return;
  288. X  } 
  289. X
  290. X  /* process it:  grab a timestamp, fill out reply, and sleep */
  291. X#ifdef DEBUG
  292. X  printf("got message:  from host [%s] port %d, sequence %d, delay %d\n",
  293. X     hostnameof(&from),portof(&from),ntohl(inreq.seq),ntohl(inreq.delaytime));
  294. X#endif
  295. X  outrep.seq = inreq.seq;
  296. X  outrep.delaytime = inreq.delaytime;
  297. X  gettimestamp(&outrep.tinsec, &outrep.tinusec);
  298. X  sleep(ntohl(inreq.delaytime));
  299. X  
  300. X  /* done processing, grab another timestamp and reply */
  301. X  gettimestamp(&outrep.toutsec, &outrep.toutusec);
  302. X  sendto(sock,&outrep,sizeof(outrep),0,&from,sizeof(from));
  303. X}
  304. X
  305. Xmain()
  306. X{
  307. X  int sock;
  308. X  int length;
  309. X  struct sockaddr_in name;
  310. X
  311. X  /* create socket from which to read */
  312. X  sock = socket(AF_INET, SOCK_DGRAM, 0);
  313. X  if (sock < 0) {
  314. X    perror("opening datagram socket");
  315. X    exit(-1);
  316. X  }
  317. X  
  318. X  /* create name and bind */
  319. X  name.sin_family = AF_INET;
  320. X  name.sin_addr.s_addr = INADDR_ANY;
  321. X  name.sin_port = UDPPORT;
  322. X  if (bind(sock, &name, sizeof(name))) {
  323. X    perror("binding datagram socket");
  324. X    exit(-2);
  325. X  }
  326. X
  327. X  /* check port value */
  328. X  length = sizeof(name);
  329. X  if (getsockname(sock, &name, &length)) {
  330. X    perror("getting socket name");
  331. X    exit(-3);
  332. X  }
  333. X#ifdef DEBUG
  334. X  printf("Socket has port #%d\n",ntohs(name.sin_port));
  335. X#endif
  336. X
  337. X  for (;;) {
  338. X    doecho(sock);
  339. X  }
  340. X
  341. X  /* NOTREACHED */
  342. X}
  343. SHAR_EOF
  344. chmod 0444 udptestd.c || echo "restore of udptestd.c fails"
  345. fi
  346. if test -f validate.h; then echo "File validate.h exists"; else
  347. echo "x - extracting validate.h (Text)"
  348. sed 's/^X//' << 'SHAR_EOF' > validate.h &&
  349. Xtypedef struct _req {
  350. X  int seq;
  351. X  int delaytime;
  352. X} req;
  353. X
  354. Xtypedef struct _rep {
  355. X  int seq;
  356. X  int delaytime;
  357. X  int tinsec, tinusec, toutsec, toutusec;
  358. X} rep;
  359. SHAR_EOF
  360. chmod 0444 validate.h || echo "restore of validate.h fails"
  361. fi
  362. exit 0
  363. Richard A. Golding                 golding@cello.hpl.hp.com or
  364.   UC Santa Cruz CIS Board (grad student)     golding@cis.ucsc.edu (best) or
  365.                         golding@slice.ooc.uva.nl 
  366. Post: Baskin Centre for CE & IS, Appl. Sci. Bldg., UC, Santa Cruz CA 95064
  367.  
  368. -- 
  369. =========================== MODERATOR ==============================
  370. Steve Stevenson                            {steve,fpst}@hubcap.clemson.edu
  371. Department of Computer Science,            comp.parallel
  372. Clemson University, Clemson, SC 29634-1906 (803)656-5880.mabell
  373.