fastfs (was: Benchmarking network and disk I/O under Solaris)

fastfs (was: Benchmarking network and disk I/O under Solaris)

Post by Andrew Gabri » Thu, 23 Jan 1997 04:00:00





Quote:

>For some reason I am not seeing the disk and network I/O I
>expected.  I am not sure how does one test network performance.
>I simply downloaded a couple of huge files to a winows machine
>from a Linux box (with a cheap $20 ISA Ne2000 clone) and my Solaris
>box, with all 3 machines in the same room connected to the same
>hub and I noticed that Linux machine was approximately twice as fast.

I don't know if this has any bearing on your test, but Linux (and
SCO and maybe FreeBSD?) mount filesystems with filesystem metadata
written asynchronously (lazy writes) by default. Solaris does not,
and this can make the Solaris filesystem very much slower than
Linux or SCO's (particlarly if you are doing lots of directory
and inode updating).

However, if you set Solaris's filesystem to async metadata writes,
it then beats SCO's EAFS, except for one case where SCO seems to
completely optimse out all disk i/o if you just create and delete
empty files (e.g. lock files).

However, solaris comes with no command to do this. :-(
You will have to pick up and compile the fastfs command for yourself.
Unfortunately, I don't remember a pointer to it on the net, but I'm
sure someone will oblige with one (Casper?)...

--


 
 
 

fastfs (was: Benchmarking network and disk I/O under Solaris)

Post by Casper H.S. Dik - Network Security Engine » Fri, 24 Jan 1997 04:00:00



>I don't know if this has any bearing on your test, but Linux (and
>SCO and maybe FreeBSD?) mount filesystems with filesystem metadata
>written asynchronously (lazy writes) by default. Solaris does not,
>and this can make the Solaris filesystem very much slower than
>Linux or SCO's (particlarly if you are doing lots of directory
>and inode updating).

Here's another one:

Solaris uses a unified VM/buffer cache and that's fine.  However, early on
it was discovered that much I/O would cause all programs (non dirty text
pages) to be paged out; and that didn't do wonders for performance.

So it was decided that a file being written to disk could have at most
[ufs:ufs_HW] bytes of writes outstanding.  Writing to the file is
suspend until no more than [ufs:ufs_LW] bytes of writes are outstanding.
So, in effect, large file writes are slowed down as not to inconvenience
other users.  The default for ufs:ufs_HW is 384K, ufs:ufs_LW is 256K.
The effect may therefor be immediately notible on files > 384K.

You can switch this behavious off by adding the following to /etc/system:

        set ufs:ufs_WRITES = 0

and reboot or use adb for immediate effect:

        echo ufs_WRITES/W0 | adb -wk

I've seen one customer experience a 50x speedup when manipulating
particularly large files w/ lots of random reads/writes.

Useful if you want to use 128M primarily to cache a few big files.

Quote:>However, if you set Solaris's filesystem to async metadata writes,
>it then beats SCO's EAFS, except for one case where SCO seems to
>completely optimse out all disk i/o if you just create and delete
>empty files (e.g. lock files).
>However, solaris comes with no command to do this. :-(
>You will have to pick up and compile the fastfs command for yourself.
>Unfortunately, I don't remember a pointer to it on the net, but I'm
>sure someone will oblige with one (Casper?)...

        ftp.wins.uva.nl:/pub/solaris/fastfs.c.gz

Works on SunOS 4.1.[234]* and Solaris 2.x

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

fastfs (was: Benchmarking network and disk I/O under Solaris)

Post by Davin Mil » Sat, 25 Jan 1997 04:00:00


Andrew Gabriel <and...@cucumber.demon.co.uk> wrote:

?
?However, solaris comes with no command to do this. :-(
?You will have to pick up and compile the fastfs command for yourself.
?Unfortunately, I don't remember a pointer to it on the net, but I'm
?sure someone will oblige with one (Casper?)...

Here's it as Casper posted it back in March 95.

Davin.
--
Davin Milun    Internet:  mi...@cs.Buffalo.EDU     mi...@acm.org
               Fax:       (716) 645-3464
               WWW:       http://www.cs.buffalo.edu/~milun/
---------------------------------------------------------------------------

>From: cas...@fwi.uva.nl (Casper H.S. Dik)
>Newsgroups: comp.unix.solaris
>Subject: Re: Disk I/O on Sparc 20/514 just bites
>Date: 14 Mar 1995 10:23:37 +0100
>Organization: FWI, University of Amsterdam

...

You'd do it with the programm I append here.
The consequence are that durig a panic a disk may be in a lot
funier state than fsck can make.  (Also, Solaris 2.3 won't reboot properly
if / is a "fast" filesystem).

Casper

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#               "End of shell archive."
# Contents:  fastfs.c
# Wrapped by casper@mail on Tue Mar 14 10:22:21 1995
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'fastfs.c' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'fastfs.c'\"
else
echo shar: Extracting \"'fastfs.c'\" \(4592 characters\)
sed "s/^X//" >'fastfs.c' <<'END_OF_FILE'
X/*
X * $Id: fastfs.c,v 1.3 1995/02/02 15:32:19 casper Exp casper $
X *
X * This programs turns on/off delayed I/O on a filesystem.
X *
X * Usage:   fastfs filesystem fast|slow|status
X *
X * Note that it is intended for use with restore(8)
X * to speed up full filesystem restores. Remember
X * that if a filesystem is running with delayed I/O
X * enabled when the system crashes it can result in
X * fsck being unable to "fix" the filesystem on reboot
X * without manual intervention.
X *
X * Typical use is
X *
X * fastfs /home fast
X * cd /home; restore rf /dev/rst5
X * fastfs /home slow
X *
X * The above gives about a 500% increase in the speed of
X * the restore (your milage may vary).
X *
X * Its also good for /tmp giving most of the benifits of tmpfs
X * without the problems.
X *
X * In rc.local
X *
X * fastfs /tmp fast
X *
X * but you may need to add fsck -y /tmp into /etc/rc.boot
X * before the real fsck to ensure the machine always boots
X *
X * Adapted from the original fastfs.c code by
X * Peter Gray,  University of Wollongong.
X *
X * Casper Dik
X*/
X
X#include <stdio.h>
X#include <string.h>
X#include <sys/ioctl.h>
X#include <sys/filio.h>
X#include <fcntl.h>
X#include <errno.h>
X#ifndef FIODIO
X#define SOLARIS
X#define FIODIO _FIOSDIO
X#define FIODIOS _FIOGDIO
X#include <sys/mnttab.h>
X#define MTAB "/etc/mnttab"
X#else
X#include <mntent.h>
X#define MTAB "/etc/mtab"
X#endif
X
X#ifndef SOLARIS
Xextern char *sys_errlist[];
Xextern int sys_nerr;
X#define strerror(x) ((x > sys_nerr || x < 0) ? "Uknown error" : sys_errlist[x])
X#endif
X
Xint errors;
X
Xchar *cmds[] = {  "slow", "fast", "status" };
X
X#define CMD_SLOW 0
X#define CMD_FAST 1
X#define CMD_STATUS 2
X#define CMD_ERROR -1
X#define CMD_AMBIGUOUS -2
X
Xint
Xstr2cmd(str)
Xchar *str;
X{
X    int i,len = strlen(str), hits = 0, res = CMD_ERROR;
X    for (i = 0; i < sizeof(cmds)/sizeof(char*); i++) {
X       if (strncmp(str, cmds[i], len) == 0) {
X           res = i;
X           hits++;
X       }
X    }
X    if (hits <= 1)
X       return res;
X    else
X       return CMD_AMBIGUOUS;
X}
X
Xvoid
Xfastfs(path, cmd)
Xchar *path;
Xint cmd;
X{
X    int fd = open(path, O_RDONLY);
X    int flag, newflag, oldflag, nochange = 0;
X    char *how;
X
X    if (fd < 0) {
X       perror(path);
X       errors ++;
X       return;
X    }
X    if (ioctl(fd, FIODIOS, &oldflag) == -1) {
X       perror("status ioctl");
X       errors ++;
X       return;
X    }
X    switch (cmd) {
X       case CMD_SLOW:
X           flag = 0;
X           if (oldflag == flag)
X               nochange = 1;
X           else
X               if (ioctl(fd, FIODIO, &flag) == -1) {
X                   perror("slow ioctl");
X                   errors ++;
X                   return;
X               }
X           break;
X       case CMD_FAST:
X           flag = 1;
X           if (oldflag == flag)
X               nochange = 1;
X           else
X               if (ioctl(fd, FIODIO, &flag) == -1) {
X                   perror("fast ioctl");
X                   errors ++;
X                   return;
X               }
X           break;
X       case CMD_STATUS:
X           how = "";
X           break;
X       default:
X           fprintf(stderr,"Internal error: unexpected command\n");
X           exit(1);
X           /*NOTREACHED*/
X    }
X    if (ioctl(fd, FIODIOS, &newflag) == -1) {
X       perror("status ioctl");
X       errors ++;
X    } else {
X       if (cmd != CMD_STATUS && flag != newflag)
X           printf("FAILED: ");
X       if (cmd != CMD_STATUS)
X           how = nochange ? "already " : "now ";
X       printf("%s\tis %s%s\n", path, how, cmds[newflag]);
X    }
X    close(fd);
X}
X
Xvoid usage()
X{
X    fprintf(stderr,"Usage: fastfs -a [slow|status|fast]\n");
X    fprintf(stderr,"Usage: fastfs path1 .. pathN [slow|status|fast]\n");
X    exit(1);
X}
X
Xint
Xmain(argc, argv)
Xint argc;
Xchar   **argv;
X{
X    int opstat = 0;
X    int i;
X    char *cmd;
X    int icmd;
X    
X    /*
X     * New usage:
X     * fastfs -a  [ report status on all ufs filesystems ]
X     * fastfs -a status|slow|fast
X     * fastfs path1 ... pathN status|slow|fast
X     */
X
X    if (argc < 2) usage();
X
X    if (argc > 2) {
X       if (str2cmd(argv[argc-1]) == CMD_ERROR)
X           opstat = 1;
X    } else
X       opstat = 1;
X
X    if (opstat)
X       cmd = "status";
X    else
X       cmd = argv[argc-1];
X
X    if ((icmd = str2cmd(cmd)) < 0)
X       usage();
X
X    if (strcmp(argv[1],"-a") == 0) {
X       FILE *fp = fopen(MTAB,"r");
X#ifdef SOLARIS
X       struct mnttab mp, mtemplate;
X#else
X       struct mntent *mnt;
X#endif
X
X       if (fp == NULL) {
X           fprintf(stderr,"Can't open %s\n", MTAB);
X           exit(1);
X       }
X       if (argc + opstat != 3)
X           usage();
X#ifdef SOLARIS
X       mtemplate.mnt_fstype = "ufs";
X       mtemplate.mnt_special = 0;
X       mtemplate.mnt_mntopts = 0;
X       mtemplate.mnt_mountp = 0;
X       mtemplate.mnt_time = 0;
X       while (getmntany(fp, &mp, &mtemplate) == 0)
X           fastfs(mp.mnt_mountp, icmd);
X#else
X       while (mnt = getmntent(fp)) {
X           if (strcmp(mnt->mnt_type,"4.2") != 0)
X               continue;
X           fastfs(mnt->mnt_dir, icmd);
X       }
X#endif
X       fclose(fp);
X    } else {
X       for (i = 1; i < argc + opstat - 1; i++)
X           fastfs(argv[i], icmd);
X    }
X
X    exit(errors ? 1 : 0);
X}
END_OF_FILE
if test 4592 -ne `wc -c <'fastfs.c'`; then
    echo shar: \"'fastfs.c'\" unpacked with wrong size!
fi
# end of 'fastfs.c'
fi
echo shar: End of shell archive.
exit 0

 
 
 

1. Benchmarking network and disk I/O under Solaris

I have a Pentium PRO 200MHz system with an adaptec 2940UW and
a Quantum Atlas ultra wide 7200RPM drive. The system also has
a 3COM 3c590 PCI 100Mbps ethernet card.  This system is running
Solaris X86 2.5.1 with all the latest patches applied.

For some reason I am not seeing the disk and network I/O I
expected.  I am not sure how does one test network performance.
I simply downloaded a couple of huge files to a winows machine
from a Linux box (with a cheap $20 ISA Ne2000 clone) and my Solaris
box, with all 3 machines in the same room connected to the same
hub and I noticed that Linux machine was approximately twice as fast.

Then I ran a simple disk performance test :

bash# ls -l
total 388848
-rw-r--r--   1 root     other    198975576 Dec 20 00:08 test.txt

bash# time cp test.txt test1.txt
real     2:03.7
user        0.0
sys        17.1

This was done late at night when I was only person logged on and the
system load avg. was below .02.  According to this the system processed
approximately 2.5MB/second.  Is this normal ?  I haven't run a disk
performance test like this on the Linux box, but I have a feeling that
it will beat my Solaris machine with its slow IDE drive.

Atif Khan

2. PROFIL system call

3. is there any build-in 'fastfs' utility in Solaris 8 or Solaris 9?

4. Canon BJC 4300

5. Bizzare disk and network benchmarks. What gives?

6. Shotgun file manager

7. fastfs doesn't work for Solaris 7?

8. best upgrade for 6100/60--MkLinux works on Newer card

9. Is "fastfs" still relevent on Solaris 8?

10. Matrox Mystique ands X.

11. Benchmarks x86 Solaris vs Linux and Solaris 2.6 x86 vs sparc

12. Solaris 10, built new disk, now cannot boot off solaris 8 disk???

13. fastfs and stale NFS file handles (icky)