Sun Performance Tuning Overview
Total Page:16
File Type:pdf, Size:1020Kb
Sun Performance Tuning Overview A structured approach to improving application performance based upon insight into the intricacies of SPARC and Solaris. SMCC Technical Marketing December 1993 Sun Microsystems Computer Corporation 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. Part No.: 801-4872-07 Revision B, December 1993 1991,1992,1993 Sun Microsystems, Inc.—Printed in the United States of America. 2550 Garcia Avenue, Mountain View, California 94043-1100 U.S.A RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR 52.227-19. The products described in this paper may be protected by one or more U.S. patents, foreign patents, or pending applications. TRADEMARKS Sun, Sun Microsystems, the Sun logo, are trademarks or registered trademarks of Sun Microsystems, Inc. UNIX and OPEN LOOK are registered trademarks of UNIX System Laboratories, Inc. All other product names mentioned herein are the trademarks of their respective owners. All SPARC trademarks, including the SCD Compliant Logo, are trademarks or registered trademarks of SPARC International, Inc. SPARCstation, SPARCserver, SPARCengine, SPARCworks, and SPARCompiler are licensed exclusively to Sun Microsystems, Inc. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK® and Sun™ Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. X Window System is a trademark and product of the Massachusetts Institute of Technology. Please Recycle Contents Preface. xiii 1. Introduction . 15 Performance Measurement. 16 Quick Reference for Common Tuning Tips . 17 The First 10 Tuning Steps . 17 2. Source Code . 19 Algorithms . 19 Algorithmic Classification . 19 An Example Problem . 20 Space Versus Time . 20 Programming Model . 21 Choice Of Language To Express The Algorithm Or Model 21 Debug And Test Tools . 23 Compiler And Optimisations. 24 Automatic Parallelization. 24 iii Effective Use Of Provided System Functions. 25 Mapped files. 25 Asynchronous I/O. 25 Memory Allocation Tuning . 26 Linking, Localisation Of Reference And Libraries. 26 Tuning Shared Libraries . 27 3. Executable . 29 Customising The Execution Environment . 29 Limits . 29 Tracing In SunOS 4.X. 30 Tracing In Solaris 2 . 32 Timing . 33 The Effects Of Underlying Filesystem Type . 33 UFS . 34 Tmpfs . 34 NFS . 35 Cachefs . 35 Tuning Filesystems . 36 Tunefs . 36 Eagle DiskPak . 36 4. Databases & Configurable Systems. 37 Examples. 37 Hire An Expert! . 37 Use Sun’s Database Excelerator Product with SunOS 4.X . 37 iv Sun Performance Tuning Overview—December 1993 Basic Tuning Ideas . 38 Increasing Buffer Sizes . 38 Using Raw Disk Rather Than Filesystems . 38 Balance The Load Over All The Disks . 39 Which Disk Partition To Use . 39 The Effect Of Indices . 40 5. Kernel . 41 Buffer Sizes And Tuning Variables . 41 Solaris 2 Performance Tuning Manual . 42 Maxusers In SunOS 4.X. 42 Using /etc/system To Modify Kernel Variables In Solaris 2 42 Maxusers In Solaris 2 . 43 Using Pstat In SunOS 4.X To Examine Table Sizes . 44 Using Sar In Solaris 2 To Examine Table Sizes And Kernel Memory Allocation . 45 Directory Name Lookup Cache (dnlc) . 45 Inode Cache . 46 Buffer Cache . 46 Setting Default Limits . 48 Solaris 2 Performance Improvements . 49 Using Sar Effectively In Solaris 2. 50 MMU Algorithms And PMEGS . 50 The Sun-4 MMU - sun4, sun4c, sun4e Kernel Architectures 50 Contexts . 52 Contents v The SPARC Reference MMU - sun4m Kernel Architecture 53 The SPARC Reference MMU Table Walk Operation . 54 The Paging Algorithm and How To Tune It . 56 Understanding Vmstat Output . 56 The Paging Algorithm In SunOS 4.X . 58 Kernel Variables To Control Paging In SunOS 4.X . 59 Swapping Out And How To Get Back In (SunOS 4.X) . 62 The Paging Algorithm In Solaris 2 . 63 Swapping Out And How To Get Back In (Solaris 2) . 67 Sensible Tweaking . 67 Configuring Devices . 72 Kernel Configuration In SunOS 4.X. 72 Kernel Configuration In Solaris 2 . 72 Mapping Device Nicknames To Full Names In Solaris 2 . 72 Kernel Profiling Using Kgmon In Solaris 2. 74 Monitoring The System With Proctool . 76 References . 77 6. Memory. 79 Cache Tutorial . 79 Why Have A Cache? . 79 Cache Line And Size Effects . 80 A Problem With Linked Lists . 82 Cache Miss Cost And Hit Rates For Different Machines . 84 Virtual Write Through Caches . 84 vi Sun Performance Tuning Overview—December 1993 Virtual Write Back Caches . 85 Physical Write Back Caches . 86 On-Chip Caches . 87 The SuperSPARC Two Level Cache Architecture . 88 I/O Caches . 90 Kernel Block Copy . 90 Software Page Copies . 91 The Classic Cache Aligned Block Copy Problem. 91 Kernel Bcopy Acceleration Hardware. 92 7. Windows and Graphics . 93 8. Disk . 95 The Disk Tuning Performed For SunOS 4.1.1. 95 Throughput Of Various Common Disks. 95 Understanding The Specification. 95 Sequential Versus Random Access . 99 Effect Of Disk Controller, SCSI, SMD, IPI. 99 SCSI Controllers. 99 SMD.