1992.12.22

SUBJECT: Network Performance Tuning

STATUS OF THIS MEMO:
System Performance Tuning°ú °ü·ÃÇÏ¿© NETWORK PerformanceÀÇ ÃøÁ¤À» ÇϱâÀ§ÇÑ
utility¸¦ Á¤¸®ÇÑ °ÍÀÓ

CONTENTS:
1. UNIX Networking
2. Network Performance Issues
   1) Data Corruption on the network
   2) Gathering Network Integrity data from NFS
   3) Network and CPU Load
   4) Reducing the NFS Workload
   5) Timeout
   6) NFS Workload and Kernel Table Size
3. RFS: System V Remote File Sharing

DESCRIPTION:

1. UNIX Networking

   - TCP/IP networkingÀº BSD UNIX Release 4.1C¿¡¼­ portingµÇ¾ú°í
     Release 4.2¿¡¼­ rlogin, rsh, rcpµîÀÇ network toolµéÀÌ Æ÷ÇԵǾú´Ù

   - BerkeleyÀÇ TCP/IP´Â °ÅÀÇ ¸ðµç System V¿¡ optionÀ¸·Î portingµÇ¾ú°í

   - SUNÀÇ NFSµµ optionÀ¸·Î portingµÇ¾ú´Ù

   - NFS¿Í TCP/IP´Â System V Release 4¿¡¼­ ¿ÏÀüÈ÷ äÅõǾú´Ù

   - AT&TÀÇ RFS(remote File System) facilityµµ System V.3¿Í ÃÖ±ÙÀÇ SunOS¿¡¼­ 
     availableÇÏ´Ù

   - System V.4´Â NFS¿Í ÇÔ²² RFSµµ Æ÷ÇÔ

   - TCP/IP package´Â BSD¿¡¼­´Â socket mechanismÀ» System V¿¡¼­´Â STREAMS
     facility¸¦ äÅÃ

   ¢Ñ Network performance´Â ½Ã½ºÅÛ¿¡ ¸Å¿ì Áß¿äÇÑ ¿µÇâÀ» ³¢Ä¡¹Ç·Î °¡±ÞÀû ¸ðµç
      workstationµéÀº local disk¸¦ °¡Áö´Â°ÍÀÌ ¹Ù¶÷Á÷Çϸç

      ¸¸¾à ¹Ýµå½Ã diskless workstationÀ» °¡Á®¾ß ÇÑ´Ù¸é file server´ç 4-5
      ½Ã½ºÅÛÀ» ³ÑÁö¾Êµµ·Ï ±¸¼ºÇϴ°ÍÀÌ ¹Ù¶÷Á÷ÇÏ´Ù

      ¸¸¾à ls, cat, editorµîÀÇ °£´ÜÇÑ utility¸¦ ¼öÇàÇÒ¼ö ÀÖ´Â superintelligent
      terminalÀ» Á¢¼Ó½Ã´Â file server´ç 8´ë Á¤µµ°¡ Àû´çÇϸç

      file server´ç workstationÀÇ Á¢¼Ó¼ö´Â 15-20´ë°¡ Àû´çÇÏ´Ù.

2. Network Performance Issues

   network performanceÀÇ ÃÖÀûÈ­¸¦ À§ÇØ networkÀº ´ÙÀ½ 3°¡Áö Á¶°ÇÀ» °®Ãç¾ß ÇÑ´Ù

   - Á¤È®ÇÑ dataÀÇ Àü¼ÛÀÌ ÀÌ·ç¾îÁ®¾ß ÇÑ´Ù

   - network userµéÀÇ ¿ä±¸¿¡ ºÎÇÕÇÏ´Â ÃæºÐÇÑbandwidthÀ» Á¦°øÇؾßÇÑ´Ù
     ¸¸¾à, bandwidthÀÌ ÃæºÐÄ¡¸øÇÏ¸é µÎ point°£ÀÇ Àü¼Û½Ã ¸Å¿ì¸¹Àº ½Ã°£ÀÌ ¼Ò¿äµÈ´Ù

   - network¿¡ ÀÖ´Â °¢systemµéÀº network trafficÀ» Á¦¾îÇϱâ À§ÇØ ÃæºÐÈ÷
     »¡¶ó¾ß ÇÑ´Ù

   1) Data Corruption on the network

      - network problemÀ» °£´ÜÈ÷ diagnosingÇϱâ À§ÇÑ tool·Î netstat -i°¡ ÀÖ´Ù
    
        % netstat -i 

        . systemÀÌ bootingÀÌÈÄ¿¡ ¹ß»ýÇÑ ¸ðµç input/output packetÀÇ ¼öµîÀÌ
          reportµÇ´Âµ¥

        . input-error³ª output-error´Â 0.025%ÀÌÇÏ¿©¾ß Çϸç
          collisionÀÌ 10%¿¡ ±ÙÁ¢Çϸé network¿¡ overload°¡ ÃÊ·¡µÈ´Ù

        . ´ÙÀ½Àº netstat¸¦ simulationÇÏ´Â sample scriptÀÌ´Ù
 
          #!/bin/sh
          # get a series of netstat reports & normalize
          # invoked as: program-name interval interface-name

          ( while true  # simulate vmstat behavior: one report every
            do          # interval seconds
                  sleep $1
                  netstat -i
            done ) | awk \
            "BEGIN { printf \"%12s%12s%12s%12s%12s\n\", \"New Ipkts\",\
                    \"New Ierrs\", \"New opkts\",\"New Oerrs\",\"collis\";
                    pipkts=0; pierrs=0; popkts=0; poerrs=0; pcollis=0
                   }
             # find the line describing the interface we care about
             /^$2/ { ipkts=\$5 - pipkts; ierrs=\$6 -pierrs; opkts=\$7 - popkts
                     oerrs=\$8 - poerrs; collis=\$9 - pcollis
                     printf \"%12d%12d%12d%12d%12d\n", ipkts, ierrs, opkts,\
                             oerrs, collis
                     pipkts=\$5; pierrs=\$6; popkts=\$7; poerrs=\$8;\
                             pcollis=\$9
                   }" -


      - gateway¿¡ ¹ß»ýÇÑ errorÀÇ ±Ù¿øÀ» ¹ß°ßÇϱâÀ§ÇØ  "netstat -s"¸¦ »ç¿ëÇÒ¼ö 
        ÀÖÀ¸¸ç ÀÌ´Â ip, icmp, tcp, udpº°·Î Àü¼ÛµÈ data·®¹× ¹ß»ýµÈ errorÀǼö¸¦
        reportÇÑ´Ù
 
        . gateway¿¡ bad checksum errorÀÇ ¹ß»ý¿©ºÎ¸¦ simulateÇÏ´Â shell script

          # !/bin/sh
          # LOOK FOR ERRORS WHILE CROSSING GATEWAYS
          # invoke as program-name host1 host2 ... hostn
          bigfile=/vmunix       # pick any large file you want,
                                # the bigger the better
                                # or even better, create a file
                                # that's even larger
          netstst -s | grep "checksum"      # get initial report
          for host in $*
          do
              echo  "Testing copies from $host to $myself"
              rcp $bigfile $host:/tmp
              rcp $host:/tmp/$bigfile /dev/null
              netstat -s | grep "checksum"  # has anything changed?
              rsh $host "rm /tmp/$bigfile"
          done

   2) Gathering Network Integrity data from NFS

      nfsstat -c command¸¦ »ç¿ëÇÏ¿© systemÀÇ client-side NFS statistics¸¦
      reportÇÒ¼ö ÀÖ´Ù

      % nfsstat -c

      Client rpc:
      calls    badcalls retrans  badxid   timeout  wait     newcred  timers
      15       0        0        0        0        0        0        0        
 
      Client nfs:
      calls      badcalls   nclget     nclsleep
      15         0          15         0          
      null       getattr    setattr    root       lookup     readlink   read    
      0  0%      4 26%      0  0%      0  0%      8 53%      0  0%      2 13%   
      wrcache    write      create     remove     rename     link       symlink 
      0  0%      0  0%      0  0%      0  0%      0  0%      0  0%      0  0%   
      mkdir      rmdir      readdir    fsstat     
      0  0%      0  0%      0  0%      1  6%   
   
      - retrans field´Â ÀÌ host°¡ ¾î¶² RPC client¿¡ retransmitÇÑ packetÀÇ ¼ö¸¦
        ³ªÅ¸³»¸ç, ¾î¶² NFS fileÀ» read/writeÇÒ¶§ ¹ß»ýÇϴµ¥
        ¸¸¾à Client nfs callÀÇ total¼öÀÇ 5%¸¦ ³ÑÀ¸¸é ½É°¢ÇÑ ¹®Á¦°¡ ÀÖ´Ù

      - badxid field¿Í retrans filed¸¦ ºñ±³ÇÏ¿© ´ë·« °°À¸¸é networkÀÇ NFS
        server´Â clientÀÇ ¿ä±¸¿¡ ´ëÇØ troubleÀ» °¡Áö°í ÀÖÀ½À» ÀǹÌÇÑ´Ù

   3) Network and CPU Load

      CPU¿¡ load°¡ ¸¹ÀÌ °É¸®¸é networkÀÇ performance°¡ ¶³¾îÁö°Ô µÇ´Âµ¥ spray
      utility¸¦ ÀÌ¿ëÇÏ¿© systemÀÇ CPU¸¦ ckeckÇÒ ¼ö ÀÖ´Ù

      % /etc/spray otherhost
       sending 1162 packets of lnth 86 to hyundai6 ...
               in 1.2 seconds elapsed time,
               53 packets (4.56%) dropped by hyundai6
       Sent:   942 packets/sec, 79.2K bytes/sec
       Rcvd:   899 packets/sec, 75.6K bytes/sec

       ¿©±â¼­ Áß¿äÇÑ ¿ä¼Ò´Â dropµÈ packetÀÇ ¼öÀε¥ dropµÈ¼ö°¡ 5% ÀÌÇÏÀÇ ÀûÀº
       ¼ö¶ó¸é ¹®Á¦°¡ ¾øÀ¸³ª ±× ¼ö°¡ ¸¹´Ù¸é packetÀ» receiveÇÏ´Â otherhostº¸´Ù
       ´õ ºü¸£°Ô packetÀ» generateÇϴ°ÍÀ» ³ªÅ¸³»¹Ç·Î
       otherhost°¡ network¿¡ ¹ÝÀÀÇÒ¼ö ÀÖµµ·Ï ºü¸£Áö ¸øÇϸç CPU¿¡ load°¡ ¸¹À½À»
       ÀǹÌÇÑ´Ù

   4) Reducing the NFS Workload

      NFS serverÀÇ workload¸¦ ÁÙÀÏ·Á¸é client systemÀÇ /etc/fstab fileÀ» 
      ¼öÁ¤ÇÏ¿© read¿Í write buffer size¸¦ ´Ã¿©Áִ°ÍÀÌ ÁÁÀ¸¸ç
      ¸¸¾à µÎ ½Ã½ºÅÛÀÇ pagesize°¡ 4096 byte¶ó¸é 
    
      server:/remfs/dataspace /space nfs rw,hard,wsize=4096,rsize=4096 0 0

      ½Ã½ºÅÛÀÇ page-size´Â "pagesize" command¸¦ »ç¿ëÇÏ¿© È®ÀÎÇÒ¼ö ÀÖÀ¸¸ç
      rsize¿Í wsize´Â remote filesystem¿¡¸¸ Àû¿ëµÇ¸ç local filesystem¿¡
      »ç¿ëÇؼ­´Â ¾ÈµÈ´Ù

   5) Timeout

      NFS client°¡ ¾î¶² ÁÖ¾îÁø ½Ã°£µ¿¾È NFS request¿¡ ´ëÇÑ response¸¦ ¹ÞÁö 
      ¸øÇϸé times outÀÌ ¹ß»ýÇϸç, ÀÌ´Â NFS server¿¡ load°¡ ¸¹ÀÌ °É·Á ÃæºÐÈ÷
      ºü¸£°Ô NFS request¸¦ ó¸®ÇØ ÁÖÁö¸øÇÔÀ» ÀǹÌÇÑ´Ù

      ÀÌ·±°æ¿ì timeout period¸¦ Áõ°¡½ÃÄÑ time outÀ» ¹æÁö, reponse¸¦ ¾òÀ»¼ö 
      Àִµ¥ /etc/fstab¿¡ timeout period¸¦ Á¤ÀÇÇÒ¼ö ÀÖ´Ù

      server:/mf /mf nfs noquota,hard,bg,intr,timeo=15 0 0
             (ÀÌ°ÍÀº timeout period°¡ 1.5 secondÀÓÀ» ÀǹÌ)

      "nfsstat -c" command¸¦ »ç¿ë timeoutµÈ ¼ö¸¦ checkÇÒ¼ö ÀÖ°í À̶§ callÀÇ
      ¼ö¿¡ ºñÇØ 5% ÀÌ»óÀÌ ¹ß»ýµÇ¸é problemÀ» °¡Áö°í ÀÖÀ½À» ÀǹÌÇÑ´Ù

   6) NFS Workload and Kernel Table Size

      NFS¿Í °ü·Ã CPUÀÇ performance¿¡ ¿µÇ⸦ ÁÖ´Â ¶ÇÇϳªÀÇ ¿ä¼Ò°¡ Àִµ¥ 
      NFS serverÀÇ fileµéÀº ´Ù¸¥ ¸¹Àº systemÀÇ »ç¿ëÀÚ¿¡ ÀÇÇØ access µÇ¹Ç·Î
      non-NFS systemº¸´Ù ¸¹Àº kernelÀÇ inode¿Í file tableÀÌ ÇÊ¿äÇÔÀ» ÀǹÌÇϸç
      ºÎÁ·½Ã system¿¡ ½É°¢ÇÑ overhea¸¦ ³¢Ä£´Ù
      
      BSD UNIX¿¡¼­´Â MAXUSERS configuration constant¸¦ ¼öÁ¤ÇÏ¿©
      inode tableÀ» Æ÷ÇÔÇÑ Áß¿äÇÑ tableÀÇ size¸¦ ´Ã¿©ÁÙ¼ö ÀÖÀ¸¸ç

      System V¿¡¼­´Â ninodes³ª inodes parameterÀÇ settingÀ» Áõ°¡½ÃÄÑ kernel
      size fmf   

3. RFS: System V Remote File Sharing

   - RFS´Â NFS¿¡ ºñ±³µÇ´Â °ÍÀ¸·Î ´ëºÎºÐÀÇ System V¿¡ optionÀ̸ç System V.4¿¡
     standardÀÌ´Ù

   - NFS¿Ü °°ÀÌ °¢°¢ÀÇ filesystem¸¦ networkÀ» ÅëÇØ mountÇÒ¼ö ÀÖ°ÔÇÏ¿© userµéÀÌ
     local¿¡¼­¿Í °°ÀÌ accessÇÒ¼ö ÀÖµµ·Ï ÇÑ´Ù

   % sar -Du    RFS operationÀ» ó¸®Çϱâ À§ÇØ »ç¿ëµÈ CPUÀÇ %¸¦ report

   % sar -Dc    systemÀÌ ¾ó¸¶³ª ¸¹Àº RFS request¸¦ ó¸® Çߴ°¡¸¦ report

   % fusage     network structureÀÇ balance¸¦ checkÇϴµ¥ µµ¿òÀ» ÁÖ´Â tool·Î
                °¢ filesystemº°·Î local°ú remote userµé¿¡ ÀÇÇØ accessµÈ dataÀÇ
                ·®À» summaryÇÏ¿© report

   % sar -Db    RFS Buffer usage¸¦ report

   % sar -S     availableÇÑ server processÀÇ ¼ö¸¦ report
                server process´Â NFS daemon°ú °°Àº °³³äÀ̸ç MINSERVE¿Í
                MAXSERVE configuration parameter¿¡ ÀÇÇØ process¼ö¸¦ Á¶Àý

   % netstat -m Special Considerations for STREAMS



Revision History
Created     on Dec  22 ,1992