Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.arch Subject: Re: ~8-job "knee" in response curves on Suns (was Re: IBM RS6000) Message-ID: <3956@skye.ed.ac.uk> Date: 16 Jan 91 19:28:27 GMT References: <1991Jan10.214122.9506@news.arc.nasa.gov> <5257@auspex.auspex.com> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 199 I've several times heard about the "knee" in the performance of Suns as the number of concurrent processes increases, so I wrote a simple benchmark. It forks n processes, which then write to each other in a circle of pipes. Note that all but one process is blocked waiting for input at any time. Here are some results. The program is at the end. Sun 3/75: The knee is noticeable. Switching rate is about constant for up to 7 processes, then it starts to decline. 2 : 897 switches / second 3 : 862 switches / second 4 : 860 switches / second 5 : 856 switches / second 6 : 851 switches / second 7 : 860 switches / second 8 : 686 switches / second 9 : 650 switches / second 10 : 641 switches / second 11 : 621 switches / second 12 : 621 switches / second 13 : 589 switches / second 14 : 597 switches / second Sun 3/260: Similar but more severe. 2 : 1626 switches / second 3 : 1648 switches / second 4 : 1587 switches / second 5 : 1543 switches / second 6 : 1474 switches / second 7 : 1431 switches / second 8 : 876 switches / second 9 : 608 switches / second 10 : 632 switches / second 11 : 618 switches / second 12 : 598 switches / second 13 : 560 switches / second 14 : 577 switches / second Sparcstation 1: Rather variable, gets very slow above 8 processes. 2 : 1971 switches / second 3 : 1944 switches / second 4 : 1944 switches / second 5 : 1092 switches / second 6 : 1892 switches / second 7 : 1184 switches / second 8 : 835 switches / second 9 : 416 switches / second 10 : 396 switches / second 11 : 396 switches / second 12 : 379 switches / second 13 : 359 switches / second Sun 4/470: No obvious knee. 2 : 4228 switches / second 4 : 4537 switches / second 6 : 4370 switches / second 8 : 4215 switches / second 10 : 4134 switches / second 12 : 3807 switches / second 14 : 4020 switches / second 16 : 4013 switches / second 18 : 3998 switches / second 20 : 3922 switches / second 22 : 3465 switches / second 24 : 3737 switches / second 26 : 3541 switches / second 28 : 3448 switches / second 30 : 3644 switches / second 32 : 3598 switches / second 34 : 3563 switches / second 36 : 3500 switches / second -- Richard /* see how fast we can switch between processes */ #include #include int master = 1; int from, to; main(argc, argv) int argc; char **argv; { int one_to_two[2], n_to_1[2]; int iter, procs, reads = 0, pid; static char buf[] = "x"; struct timeval tp1, tp2; procs = atoi(argv[1]); iter = argc > 2 ? atoi(argv[2]) : 100; pipe(one_to_two); pipe(n_to_1); from = n_to_1[0]; to = one_to_two[1]; make_child(procs-1, one_to_two, n_to_1[1], n_to_1[0]); pid = getpid(); if(master) write(to, buf, 1); gettimeofday(&tp1, (struct timezone *)0); while(1) { switch(read(from, buf, 1)) { case -1: perror("read"); exit(1); case 0: #ifdef DEBUG printf("process %d exiting after %d reads\n", pid, reads); #endif if(master) { double sec; gettimeofday(&tp2, (struct timezone *)0); sec = (tp2.tv_sec - tp1.tv_sec) + (tp2.tv_usec - tp1.tv_usec) / 1e6; printf("%d switches / second\n", (int)(procs*iter/sec + 0.5)); } exit(0); case 1: reads++; #ifdef DEBUG printf("process %d read %c\n", pid, buf[0]); #endif if(master && reads == iter) close(to); else write(to, buf, 1); } } } make_child(n, parentpipe, lastwriter, closeme) int n, parentpipe[2], lastwriter, closeme; { if(fork() == 0) { /* child */ master = 0; close(parentpipe[1]); close(closeme); from = parentpipe[0]; if(n == 1) /* This is the last process */ to = lastwriter; else { int p[2]; pipe(p); to = p[1]; make_child(n-1, p, lastwriter, from); } } else { close(parentpipe[0]); close(lastwriter); } } -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin