Sun Java System Web Server 7.0 Update 1 Performance Tuning, Sizing, and Scaling Guide Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A.
Copyright 2007 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more U.S. patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights – Commercial software.
Contents Preface ...................................................................................................................................................11 1 Performance and Monitoring Overview .......................................................................................... 19 Performance Issues .............................................................................................................................. 19 Configuration ...............................................
Contents 2 Tuning Sun Java System Web Server ................................................................................................ 39 General Tuning Tips ........................................................................................................................... 39 Understanding Threads, Processes, and Connections ................................................................... 40 Connection-Handling Overview ....................................................................
Contents Low-Memory Situations ..................................................................................................................... 86 Too Few Threads ................................................................................................................................. 86 Cache Not Utilized .............................................................................................................................. 87 Keep-Alive Connections Flushed ..............................
Contents Networking ........................................................................................................................................ 102 6 Scalability Studies .............................................................................................................................103 Study Goals ......................................................................................................................................... 103 Study Conclusion ..........................
Tables TABLE 1–1 Methods of Monitoring Performance ..................................................................... 22 TABLE 2–1 Parameter Mapping to server.xml ........................................................................ 46 TABLE 2–2 Connection Queue Statistics .................................................................................... 50 TABLE 2–3 Keep-Alive Statistics ..................................................................................................
Tables TABLE 6–17 TABLE 6–18 TABLE 6–19 TABLE 6–20 TABLE 6–21 8 SSL Performance Test: Perl CGI Scalability ......................................................... 120 SSL Performance Test: C CGI Scalability ............................................................. 121 SSL Performance Test: NSAPI Scalability ............................................................ 122 Performance Test Pass Criteria ..............................................................................
Figures FIGURE 2–1 Web Server Connection Handling ..........................................................................
Preface This guide discusses adjustments you can make that may improve the performance of Sun Java System Web Server (henceforth known as Web Server). The guide provides tuning, scaling, and sizing tips and suggestions; possible solutions to common performance problems; and data from scalability studies. It also addresses miscellaneous configuration and platform-specific issues. Who Should Use This Book This guide is intended for advanced administrators only.
Preface TABLE P–1 Books in the Web Server Documentation Set Documentation Title Contents Sun Java System Web Server 7.0 Update 1 Documentation Center Web Server documentation topics organized by tasks and subject Sun Java System Web Server 7.0 Update 1 Release Notes ■ ■ Sun Java System Web Server 7.0 Update 1 Installation and Migration Guide Performing installation and migration tasks: Installing Web Server and its various components, ■ ■ Sun Java System Web Server 7.
Preface TABLE P–1 Books in the Web Server Documentation Set (Continued) Documentation Title Contents Sun Java System Web Server 7.0 Update 1 Developer’s Guide to Java Web Applications Implementing Java Servlets and JavaServer PagesTM (JSPTM) technology in Sun Java System Web Server Sun Java System Web Server 7.0 Update 1 Administrator’s Configuration File Reference Editing configuration files Sun Java System Web Server 7.
Preface TABLE P–2 Default Paths and File Names Placeholder Description Default Value install-dir Represents the base installation directory for Web Sun Java Enterprise System (Java ES) installations on the Server SolarisTM platform: /opt/SUNWwbsvr7 Java ES installations on the Linux and HP-UX platform: /opt/sun/webserver/ Java ES installations on the Windows platform: system-drive:\Program Files\Sun\JavaES5\WebServer7 Other Solaris, Linux, and HP-UX installations, non-root user: home-directory/sun/we
Preface Typographic Conventions The following table describes the typographic changes that are used in this book. TABLE P–3 Typographic Conventions Typeface Meaning Example AaBbCc123 The names of commands, files, and directories, and onscreen computer output Edit your .login file. Use ls -a to list all files. machine_name% you have mail.
Preface TABLE P–4 Symbol Conventions (Continued) Symbol Description Example Meaning → Indicates menu item selection in a graphical user interface. File → New → Templates From the File menu, choose New. From the New submenu, choose Templates. Documentation, Support, and Training The Sun web site provides information about the following additional resources: ■ ■ ■ Documentation (http://www.sun.com/documentation/) Support (http://www.sun.com/support/) Training (http://www.sun.
Preface Sun Welcomes Your Comments Sun is interested in improving its documentation and welcomes your comments and suggestions. To share your comments, go to http://docs.sun.com and click Send Comments. In the online form, provide the full document title and part number. The part number is a 7-digit or 9-digit number that can be found on the book's title page or in the document's URL. For example, the part number of this book is 819-2635.
1 C H A P T E R 1 Performance and Monitoring Overview Sun Java System Web Server (henceforth known as Web Server) is designed to meet the needs of the most demanding, high-traffic sites in the world. It can serve both static and dynamically generated content. Web Server can also run in SSL mode, enabling the secure transfer of information. This guide helps you to define your server workload and size a system to meet your performance needs.
Configuration servers the goal might be to provide a targeted level of performance at different price points. You need to define what performance means for your particular situation. Here are some areas to consider: ■ The number of peak concurrent users ■ Security requirements Encrypting your Web Server’s data streams with SSL makes an enormous difference to your site’s credibility for electronic commerce and other security conscious applications, but it can also seriously impact your CPU load.
SSL Performance Server Farms The clustering features of Web Server allow you to easily deploy to a server farm. Because all servers in a server farm share identical configurations, tuning is not done on a server-by-server basis. 64–Bit Servers The performance for the 64–bit Web Server is not necessarily better than the performance for the 32–bit Web Server, but the 64–bit server scales better.
Monitoring Server Performance Monitoring Server Performance Making the adjustments described in this guide without measuring their effects doesn’t make sense. If you don’t measure the system’s behavior before and after making a change, you won’t know whether the change was a good idea, a bad idea, or merely irrelevant. You can monitor the performance of Web Server in several different ways.
Monitoring Server Performance Because using the Administration Server takes computing resources, the command-line interface and the Admin Console are the most costly monitoring methods. For more information on these monitoring methods, see the following sections: ■ ■ ■ ■ ■ ■ “About Statistics” on page 23 “Monitoring Current Activity Using the Admin Console” on page 25 “Monitoring Current Activity Using the CLI” on page 26 “Monitoring Current Activity Using stats.
Monitoring Server Performance ■ Java DataBase Connectivity (JDBCTM) (available if a JDBC resource is created and the connection pool is accessed) For the virtual server, statistics are available in the following areas: ■ General ■ Response ■ Web Applications ■ Profiling Data (available if profiling is enabled) ■ Servlet and Servlet Response Cache (available if the Servlet cache is enabled in sun.web.
Monitoring Server Performance 7 Restart the server. ▼ To Enable Statistics from the CLI 1 Enter the following CLI command to enable statistics collection: ./wadm set-stats-prop --user=admin_user –password-file=password-file --config=myconfig enabled=true To disable statistics, set enabled to false. 2 To set the interval and enable profiling, use the set-stats-prop interval and profiling properties. For more information, see the help for set-stats-prop. 3 Restart the server.
Monitoring Server Performance Monitoring Current Activity Using the CLI You can also view statistics information using the wadm commands get-config-stats, get-virtual-server-stats, get-webapp-stats and get-servlet-stats. Note that the examples below do not contain all possible command options. For the complete syntax, see the help for the command. ▼ To Monitor Statistics from the CLI 1 To get statistics for a configuration deployed on a single node, enter: .
Monitoring Server Performance process.1.timeStarted=Jan 5, 2007 2:20:53 PM process.1.DNSCache.countCacheHits=687804 process.1.DNSCache.countAsyncNameLookup=0 process.1.DNSCache.countAsyncLookupsInProgress=0 process.1.DNSCache.flagAsyncEnabled=false process.1.DNSCache.countAsyncAddrLookups=0 process.1.DNSCache.flagCacheEnabled=true process.1.DNSCache.countCacheMisses=75 process.1.JDBCPool.1.countQueued=32 process.1.JDBCPool.1.countFreeConnections=0 process.1.JDBCPool.1.peakConnections=32 process.1.JDBCPool.
Monitoring Server Performance process.1.fileCache.countInfoMisses=19 process.1.jvm.countGarbageCollections=96 process.1.jvm.sizeHeap=67762048 process.1.jvm.countThreads=79 process.1.jvm.countClassesUnloaded=0 process.1.jvm.vMVendor=Sun Microsystems Inc. process.1.jvm.countTotalClassesLoaded=3170 process.1.jvm.vMName=Java HotSpot(TM) Server VM process.1.jvm.countTotalThreadsStarted=81 process.1.jvm.countClassesLoaded=3170 process.1.jvm.peakThreads=79 process.1.jvm.millisecondsGarbageCollection=1981 process.
Monitoring Server Performance The syntax gets the statistics for a given web application deployed on the given virtual server of the given instance. To get the aggregated web application statistics for a given configuration across all the nodes where the configuration has been deployed, use the command without the node option.
Monitoring Server Performance 8 Access the stats-xml URI, for example: http://yourhost:port/stats-xml The statistics are displayed in XML format. ▼ To Enable the stats-xml URI from the CLI 1 Use the following command to enable stats-xml: ./wadm enable-stats-xml --user=admin-user --password-file=admin-password-file [--uri-prefix=prefix]--config=config-name --vs=virtual-server-name Use the uri-prefix option to set the stats-xml URI. 2 Deploy the configuration using the wadm deploy-config command.
Monitoring Server Performance ■ ■ ■ ■ ■ ■ session-replication thread thread-pool thread-pool-bucket (process-level) virtual-server web-app-bucket ▼ To View stats-xml Output from the CLI In addition to a URI, you can also access stats-xml output through the command-line interface. It is enabled by default. Unlike viewing stats-xml output through the URI, the Administration Server must be running to view stats-xml output at the command-line.
Monitoring Server Performance Note – The statistics displayed by perfdump are for the server as a whole. If you enable perfdump on one virtual server, it displays statistics for the whole server, not an individual virtual server. 1 From Common Tasks, select a configuration. 2 Select the virtual server and click Edit Virtual Server. 3 Click the Monitoring Settings tab. 4 Select the Plain Text Report Enabled checkbox. 5 Provide a URI for accessing the report, for example /.perf. 6 Click Save.
Monitoring Server Performance ▼ To View the perfdump Data from the CLI In addition to a URI, you can also access perfdump output through the command-line interface. It is enabled by default. Unlike viewing perfdump output through the URI, the Administration Server must be running to view perfdump output at the command-line. However, if request processing threads are hanging in your server (for example, because they are busy), and you cannot use the URI, you can still access perfdump output through the CLI.
Monitoring Server Performance -----------------------Active Sessions 128 Keep-Alive Sessions 0 Total Sessions Created 128/128 Server cache disabled Native pools: ---------------------------NativePool: Idle/Peak/Limit Work Queue Length/Peak/Limit TestPool: Idle/Peak/Limit Work Queue Length/Peak/Limit 1/1/128 0/0/0 5/5/10 0/0/15 DNSCacheInfo: -----------------enabled yes CacheEntries 4/1024 HitRatio 62854802/62862912 ( 99.
Monitoring Server Performance 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 29133 . . . response response response response request request request request request response request request response request updating updating updating updating 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.7 192.6.7.
Monitoring Server Performance Configuration You must specify all configuration information for performance buckets in the magnus.conf and obj.conf files. Only the default-bucket is automatically enabled. First, you must enable performance statistics collection and perfdump. The following examples show how to define new buckets in magnus.
Monitoring Server Performance ■ Number of Invocations is the total number of times that the function was invoked. This differs from the number of requests in that a function could be called multiple times while processing one request. The percentage column for this row is calculated in reference to the total number of invocations for all of the buckets. ■ Latency is the time in seconds that Web Server takes to prepare for calling the function.
2 C H A P T E R 2 Tuning Sun Java System Web Server This chapter describes specific adjustments you can make that might improve Sun Java System Web Server performance. It provides an overview of Web Server's connection-handling process so that you can better understand the tuning settings. The chapter includes the following topics: ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ “General Tuning Tips” on page 39 “Understanding Threads, Processes, and Connections” on page 40 “Mapping Web Server 6.
Understanding Threads, Processes, and Connections ■ Adjust gradually When adjusting a quantitative parameter, make several stepwise changes in succession, rather than trying to make a drastic change all at once. Different systems face different circumstances, and you might leap right past your system’s best setting if you change the value too rapidly.
Understanding Threads, Processes, and Connections A request processing thread might also be instructed to send the request to a different thread pool for processing. For example, if the request processing thread must perform some work that is not thread-safe, it might be instructed to send part of the processing to the NativePool. Once the NativePool completes its work, it communicates the result to the request processing thread and the request processing thread continues processing the request.
Understanding Threads, Processes, and Connections Connection–Handling magnus.conf Directives for NSAPI In addition to the settings discussed above, you can edit the following directives in the magnus.
Understanding Threads, Processes, and Connections 3. A different thread in my-custom-pool, called the B1 thread in this example, picks up the request queued by A1. B1 completes the request and returns to the wait stage. 4. The A1 thread wakes up and continues processing the request. It executes the ObjectType SAF and moves on to the Service function. 5. Because the Service function must be processed by a thread in my-custom-pool2, the A1 thread queues the request to my-custom-pool2. 6.
Understanding Threads, Processes, and Connections Init funcs="pcheck_uri_clean_fixed_init" shlib="C:/Sun/webserver7/lib/custom.dll" fn="load-modules" NativeThread="no" The NativeThread flag affects all functions in the funcs list, so if you have more than one function in a library, but only some of them use native threads, use separate Init lines. If you set NativeThread to yes, the thread maps directly to an OS thread.
Understanding Threads, Processes, and Connections The advantage of multiple processes is that legacy applications that are not thread-aware or thread-safe can be run more effectively in Sun Java System Web Server. However, because all of the Sun Java System extensions are built to support a single-process threaded environment, they might not run in the multi-process mode.
Mapping Web Server 6.1 Tuning Parameters to Web Server 7.0 ■ Java applications that do not require session management Do not use the MaxProcs directive when the Sun Java System Web Server performs session management for Java applications. You can set the value for MaxProcs by editing the MaxProcs parameter in magnus.conf. Note – You will receive duplicate startup messages when running your server in MaxProcs mode. Mapping Web Server 6.1 Tuning Parameters to Web Server 7.
Mapping Web Server 6.1 Tuning Parameters to Web Server 7.0 TABLE 2–1 Parameter Mapping to server.xml (Continued) Web Server 6.1 parameter Web Server 7.0 server.xml element or attribute dns-cache-init Init SAF cache size Admin Console Location wadm command max-entries element of the dns-cache element Configuration's Performance tab ⇒ DNS tab set-dns-cache-prop command's max-entries property FileCacheEnabled in nsfc.
Using Monitoring Data to Tune Your Server TABLE 2–1 Parameter Mapping to server.xml Web Server 6.1 parameter (Continued) Web Server 7.0 server.xml element or attribute Admin Console Location wadm command NativePoolQueueSize in magnus.conf Unchanged NativePoolStackSize in magnus.conf Unchanged RqThrottle in magnus.conf max-threads element of Configuration's the thread-pool element Performance tab ⇒ HTTP tab set-thread-pool-prop command's max-threads property RqThrottleMin in magnus.
Using Monitoring Data to Tune Your Server ■ ■ ■ “Java Virtual Machine (JVM) Information” on page 70 “Web Application Information” on page 71 “JDBC Resource Information” on page 72 Once you have viewed the statistics you need, you can tune various aspects of your server’s performance at the configuration level using the Admin Console's Performance tab.
Using Monitoring Data to Tune Your Server TABLE 2–2 Connection Queue Statistics Present Number of Connections Queued 0 Total Number of Connections Queued 11222922 Average Connections Over Last 1 Minute 90.35 Average Connections Over Last 5 Minutes 89.64 Average Connections Over Last 15 Minutes 54.
Using Monitoring Data to Tune Your Server This setting is not tunable. Average Queue Length The Average Queue Length shows the average number of connections in the queue over the last one-minute, five-minute, and 15–minute intervals. This setting is not tunable. Average Queuing Delay The Average Queueing Delay is the average amount of time a connection spends in the connection queue.
Using Monitoring Data to Tune Your Server If you have created multiple HTTP listeners, perfdump displays all of them. To edit an HTTP listener using the Admin Console, for the configuration, select the HTTP Listeners tab. Click the listener name to edit the listener. To configure an HTTP listener using the command-line interface, use the command wadm set-http-listener-prop. For more information about adding and editing listen sockets, see the Sun Java System Web Server 7.0 Update 1 Administrator’s Guide.
Using Monitoring Data to Tune Your Server Default Virtual Server Virtual servers work using the HTTP 1.1 Host header. If the end user’s browser does not send the Host header, or if the server cannot find the virtual server specified by the Host header, Web Server handles the request using a default virtual server. You can configure the default virtual server to send an error message or serve pages from a special document root. Tuning This setting is tunable when you edit an HTTP listener.
Using Monitoring Data to Tune Your Server TABLE 2–3 Keep-Alive Statistics (Continued) Connection Timeout 10 Both HTTP 1.0 and HTTP 1.1 support the ability to send multiple requests across a single HTTP session. A web server can receive hundreds of new HTTP requests per second. If every request was allowed to keep the connection open indefinitely, the server could become overloaded with connections. On UNIX and Linux systems, this could lead to a file table overflow very easily.
Using Monitoring Data to Tune Your Server Tuning You can tune the maximum number of connections that the server allows to wait at one time before closing the oldest connection in the Admin Console by editing the Maximum Connections field on the configuration's Performance tab ⇒ HTTP tab, under Keep Alive Settings. The default is 200. In the command-line interface, use the max-connections property in the wadm set-keep-alive-prop command.
Using Monitoring Data to Tune Your Server Keep-Alive Poll Interval The keep-alive poll interval specifies the interval (in seconds) at which the system polls keep-alive connections for further requests. The default is 0.001 second, the lowest value allowed. It is set to a low value to enhance performance at the cost of CPU usage. To tune the poll interval, edit the Poll Interval field on the configuration's Performance tab ⇒ HTTP tab, under Keep Alive Settings.
Using Monitoring Data to Tune Your Server Also, chunked encoding could affect the performance for HTTP 1.1 workload. Tuning the response buffer size could positively affect the performance. A higher response buffer size in the configuration's Performance tab ⇒ HTTP tab would result in sending a Content-length: header, instead of chunking the response. To set the buffer size using the CLI, use the wadm set-http-prop command's output-buffer-size property.
Using Monitoring Data to Tune Your Server The equivalent information as the Total Number of Threads is available through the Admin Console from the Monitoring tab ⇒ Instances sub tab, under General Statistics. To see the maximum threads allowed, see the Maximum Threads field on the configuration's Performance tab ⇒ HTTP sub tab, under Thread Pool Settings. To get the equivalent of the perfdump Active Sessions, you can subtract the Number of Idle Threads from the Total Number of Threads.
Using Monitoring Data to Tune Your Server Suitable maximum threads values range from 100-500, depending on the load. Maximum Threads represents a hard limit for the maximum number of active threads that can run simultaneously, which can become a bottleneck for performance. The default value is 128. The thread pool minimum threads is the minimum number of threads the server initiates upon startup. The default value is 16.
Using Monitoring Data to Tune Your Server File Cache Entries File Cache Hit Ratio Maximum Age Accelerator Entries Acceleratable Requests Acceleratable Responses Accelerator Hit Ratio 141/1024 652/664 ( 30 120/1024 281/328 ( 131/144 ( 247/281 ( 98.19%) 85.67%) 90.97%) 87.
Using Monitoring Data to Tune Your Server File Cache Entries number, you can improve the accelerator cache utilization by following the tuning information described in “Acceleratable Requests” on page 61 and “Acceleratable Responses” on page 61. Acceleratable Requests The number of client requests that were eligible for processing by the accelerator cache. Only simple GET requests are processed by the accelerator cache.
Using Monitoring Data to Tune Your Server Tuning Higher hit ratios result in better performance. To maximize the hit ratio, see the tuning information for “Acceleratable Responses” on page 61. File Cache Enabled If the cache is disabled, the rest of this section is not displayed in perdump. In the Admin Console, the File Cache Statistics section shows zeros for the values. Tuning The cache is enabled by default.
Using Monitoring Data to Tune Your Server Tuning Set the maximum age based on whether the content is updated (existing files are modified) on a regular schedule. For example, if content is updated four times a day at regular intervals, you could set the maximum age to 21600 seconds (6 hours). Otherwise, consider setting the maximum age to the longest time you are willing to serve the previous version of a content file after the file has been modified.
Using Monitoring Data to Tune Your Server ... In the above example, the server does not cache static files from /export/mydir/ when requested by the URL prefix /myurl. For more information on editing obj.conf, see Sun Java System Web Server 7.0 Update 1 Administrator’s Configuration File Reference. File Cache Dynamic Control and Monitoring You can add an object to obj.
Using Monitoring Data to Tune Your Server ReplaceFiles: false ReplaceInterval: 1 milliseconds HitOrder: false CacheFileContent: true TransmitFile: false MaxAge: 3600 seconds MaxFiles: 600000 files SmallFileSizeLimit: 500000 bytes MediumFileSizeLimit: 1000001 bytes BufferSize: 8192 bytes CopyFiles: false Directory for temporary files: /tmp Hash table size: 1200007 buckets You can include a query string when you access the URI.
Using Monitoring Data to Tune Your Server Native Thread Pool The following example shows native thread pool information as it appears in perfdump: Native pools: ---------------------------NativePool: Idle/Peak/Limit Work Queue Length/Peak/Limit my-custom-pool: Idle/Peak/Limit Work Queue Length/Peak/Limit 1/1/128 0/0/0 1/1/128 0/0/0 If you have defined additional custom thread pools, they are shown under the Native Pools heading in perfdump.
Using Monitoring Data to Tune Your Server Peak (Peak Requests Queued in the Admin Console) is the highest number of requests that were ever queued up simultaneously for the use of a native thread since the server was started. This value can be viewed as the maximum concurrency for requests requiring a native thread. Limit is the maximum number of requests that can be queued at one time to wait for a native thread, and is determined by the setting of NativePoolQueueSize.
Using Monitoring Data to Tune Your Server The difference between this value and the maximum threads is the number of requests reserved for non-native thread requests, such as static HTML and image files. Keeping a reserve and rejecting requests ensures that your server continues to fill requests for static files, which prevents it from becoming unresponsive during periods of very heavy dynamic content load.
Using Monitoring Data to Tune Your Server CacheEntries HitRatio 4/1024 62854802/62862912 ( 99.
Using Monitoring Data to Tune Your Server Tuning You can set the maximum size of the DNS cache in the Admin Console in the Maximum Cache Size field on the configuration's Performance tab ⇒ DNS sub tab, under DNS Cache Settings. To set it using the command-line-interface, use wadm set-dns-cache-prop and set the max-entries property. The default cache size is 1024. The value range is 2-32768.
Using Monitoring Data to Tune Your Server TABLE 2–7 Java Virtual Machine (JVM) Statistics (Continued) Total Number of Classes Unloaded 0 Number of Garbage Collections Occurred 3 Number of Live Threads 8 Number of Started Threads 9 Peak Live Thread Count 8 Most of these statistics are not tunable. They provide information about the JVM's operation. Another source of tuning information on the JVM is the package java.lang.
Using Monitoring Data to Tune Your Server 3 On the Monitoring Statistics page, click Virtual Server Statistics. 4 Click the virtual server name. 5 On the Virtual Server Monitoring Statistics page, click Web Applications. 6 Select the web application for which to view statistics from the Web Application pull-down menu.
Using Monitoring Data to Tune Your Server The use of connection pooling improves application performance by doing the following: ■ Creating connections in advance. The cost of establishing connections is moved outside of the code that is critical for performance. ■ Reusing connections. The number of times connections are created is significantly lowered. ■ Controlling the amount of resources a single application can use at any moment.
Using Monitoring Data to Tune Your Server Connections This number shows the current JDBC connections, including both free and busy connections. Tuning – This setting cannot be tuned, but it is a good indicator of recent pool activity. If the number of connections is consistently higher than the minimum number of connections, consider increasing the minimum number of connections to be closer to the number of current JDBC connections.
Using Monitoring Data to Tune Your Server JDBC Resource Statistics Not Available in the Admin Console Some JDBC statistics are available through the wadm get-config-stats command (using the --node option), through stats-xml, and through SNMP but not through the Admin Console. maxConnections – The configured maximum size of the pool. Use as a reference for other statistics.
Using Monitoring Data to Tune Your Server minimize creation of connections during the life of the application and minimize pool resizing. Use a lower number if the pool load is expected to be small, to minimize resource consumption. ■ Maximum connections The maximum number of connections that a pool can have at any given time. Defaults to 32. Use this setting to enforce a limit in the amount of connection resources that a pool or application can have.
Tuning the ACL User Cache The user-defined table to use for validation when the validation method is table. Defaults to test. If this method is used, the table used should be dedicated only to validation, and the number of rows in the table should be kept to a minimum. ■ Fail All Connections Indicates whether all connections in the pool are re-created when one is found to be invalid, or only the invalid one. Only applicable if you have selected a connection validation method. Disabled by default.
Tuning Java Web Application Performance While it would be extremely unusual to hit this possible performance problem, the number of groups cached in a single ACL cache entry can be tuned with Maximum Groups setting on the configuration's Performance tab ⇒ Cache sub tab. Or you can use the max-groups-per-user property of the wadm set-acl-cache-prop command. The maximum age setting of the ACL cache determines the number of seconds before the cache entries expire.
Tuning Java Web Application Performance When adding a web application, either through the Admin Console or CLI, choose the precompile JSPs option. Enabling precompiled JSPs allows all the JSPs present in the web application to be pre-compiled, and their corresponding servlet classes are bundled in the web application's WEB-INF/lib or WEB-INF/classes directory. When a JSP is accessed, it is not compiled and instead, its precompiled servlet is used.
Tuning Java Web Application Performance Avoiding Directories in the Classpath For certain applications (especially if the Java Security Manager is enabled) you can improve performance by ensuring that there are no unneeded directories in the classpath. To do so, change the Server Class Path, Class Path Prefix, and Class Path Suffix fields on the configuration's Java tab ⇒ General sub tab for the configuration or use the command wadm set-jvm-prop. Also, package the web application's .class files in a .
Tuning CGI Stub Processes (UNIX/Linux) Tuning MMapSessionManager (UNIX/Linux) The following example describes the effect on process size when configuring the persistence-type="mmap" using the manager-properties properties. For more information, see “MMap Session Manager (UNIX Only)” in Sun Java System Web Server 7.0 Update 1 Developer’s Guide to Java Web Applications.
Using find-pathinfo-forward Using find-pathinfo-forward The find-pathinfo-forward parameter used in obj.conf can help improve your performance. It is used with the PathCheck function find-pathinfo and the NameTrans functions pfx2dir and assign-name. The find-pathinfo-forward parameter instructs the server to search forward for PATH_INFO in the path after ntrans-base, instead of backward from the end of the path in the server function find-pathinfo.
Using Busy Functions In the previous example, the server does not stat for path /ntrans-base/nsfc and /ntrans-base/nsfc/* if ntrans-base is set. If ntrans-base is not set, the server does not stat for URLs /nsfc and /nsfc/*. By default, ntrans-base is set. The example assumes the default PathCheck server functions are used. When you use nostat= virtual-path in the assign-name NameTrans, the server assumes that stat on the specified virtual-path will fail.
3 C H A P T E R 3 Common Performance Problems This chapter discusses common web site performance problems, and includes the following topics: ■ ■ ■ ■ ■ ■ “check-acl Server Application Functions” on page 85 “Low-Memory Situations” on page 86 “Too Few Threads” on page 86 “Cache Not Utilized” on page 87 “Keep-Alive Connections Flushed” on page 87 “Log File Modes” on page 88 Note – For platform-specific issues, see Chapter 4, “Platform-Specific Issues and Tips” check-acl Server Application Functions For
Low-Memory Situations Low-Memory Situations If Web Server must run in low-memory situations, reduce the thread limit to a bare minimum by lowering the value of the Maximum Threads setting on the configuration's Performance Tab ⇒ HTTP sub tab. You can also set it with wadm set-thread-pool-prop command's max-threads property. Your web applications running under stress might sometimes result in the server running out of Java VM runtime heap space, as can be seen by java.lang.
Keep-Alive Connections Flushed Cache Not Utilized If the file cache is not utilized, your server is not performing optimally. Since most sites have lots of GIF or JPEG files that should always be cacheable, you need to use your cache effectively. Some sites, however, do almost everything through CGIs, SHTML, or other dynamic sources. Dynamic content is generally not cacheable, and inherently yields a low cache hit rate. Don’t be too alarmed if your site has a low cache hit rate.
Log File Modes Caution – On UNIX/Linux systems, if the keep-alive maximum connections value is too high, the server can run out of open file descriptors. Typically 1024 is the limit for open files on UNIX/Linux, so increasing this value above 500 is not recommended. Log File Modes Keeping the log files on a high-level of verbosity can have a significant impact on performance.
4 C H A P T E R 4 Platform-Specific Issues and Tips This chapter provides platform-specific tuning tips, and includes the following topics: ■ ■ ■ ■ ■ “Solaris Platform-Specific Issues” on page 89 “Solaris File System Tuning” on page 93 “Solaris Platform-Specific Performance Monitoring” on page 94 “Tuning Solaris for Performance Benchmarking” on page 96 “Tuning UltraSPARC T1–Based Systems for Performance Benchmarking” on page 97 Solaris Platform-Specific Issues This section discusses miscellaneous Sola
Solaris Platform-Specific Issues An alternative way to make this change is using the ulimit –n "value" command. Using this command does not require a system restart. However, this command only changes the login shell, while editing the etc/system file affects all shells. Failure to Connect to HTTP Server If users are experiencing connection timeouts from a browser to Web Server when the server is heavily loaded, you can increase the size of the HTTP listener backlog queue.
Solaris Platform-Specific Issues Connection Refused Errors If users are experiencing connection refused errors on a heavily loaded server, you can tune the use of network resources on the server. When a TCP/IP connection is closed, the port is not reused for the duration of tcp_time_wait_interval (default value of 240000 milliseconds). This is to ensure that there are no leftover segments. The shorter the tcp_time_wait_interval, the faster precious network resources are again available.
Solaris Platform-Specific Issues ■ ■ ■ ■ ■ nca(1) snca(1) nca.if(4) ncakmod.conf(4) ncalogd.conf(4) ▼ To Enable SNCA to Work With Web Server This procedure assumes that SNCA has been configured, as discussed above. 1 From the Common Tasks page, choose a configuration and click Edit Configuration. 2 Click the HTTP Listeners tab and select the HTTP listener to edit. 3 On the Edit HTTP Listener page, set the Protocol Family to nca. The HTTP listener must be listening on port 80 for this to work.
Solaris File System Tuning Solaris File System Tuning This section discusses changes that can be made for file system tuning, and includes topics that address the following issues: ■ ■ ■ “High File System Page-In Rate” on page 93 “Reduce File System Housekeeping” on page 93 “Long Service Times on Busy Disks or Volumes” on page 93 Please read the descriptions of the following parameters carefully. If the description matches your situation, consider making the adjustment.
Solaris Platform-Specific Performance Monitoring (the %b and svc_t columns, respectively). Service times are unimportant for disks that are less than about 30% busy, but for busier disks, service times should not exceed about 20 milliseconds. If your busy disks have slower service times, improving disk performance might help Web Server performance substantially.
Solaris 10 Platform-Specific Tuning Information ■ The mpstat 60 command gives a detailed look at CPU statistics, while the netstat -i 60 command summarizes network activity. Long-Term System Monitoring It is important not only to "spot-check" system performance with the tools mentioned above, but to collect longer-term performance histories so you can detect trends.
Tuning Solaris for Performance Benchmarking Tuning Solaris for Performance Benchmarking The following table shows the operating system tuning for Solaris used when benchmarking for performance and scalability. These values are an example of how you might tune your system to achieve the desired result.
Tuning UltraSPARC® T1–Based Systems for Performance Benchmarking Tuning UltraSPARC® T1–Based Systems for Performance Benchmarking Use a combination of tunable parameters and other parameters to tune your system for performance benchmarking. These values are an example of how you might tune your system to achieve the desired result.
Tuning UltraSPARC® T1–Based Systems for Performance Benchmarking TABLE 4–2 Tuning 64–bit Systems for Performance Benchmarking (Continued) Parameter Scope Default Value Tuned Value Comments tcp_conn_req_max_q0 ndd /dev/tcp 1024 3000 tcp_max_buf ndd /dev/tcp 4194304 tcp_cwnd_max ndd/dev/tcp 2097152 tcp_xmit_hiwat ndd /dev/tcp 8129 400000 To increase the transmit buffer. tcp_recv_hiwat ndd /dev/tcp 8129 400000 To increase the receive buffer. Note that the IPGE driver version is 1.
Tuning UltraSPARC® T1–Based Systems for Performance Benchmarking tmp=‘expr $tmp + 1‘ done done Put all network interfaces into a single group. For example: $ifconfig ipge0 group webserver $ifconfig ipge1 group webserver Web Server Start Options In some cases, performance can be improved by using large page sizes. To start the 32–bit Web Server with 4 MB pages: LD_PRELOAD_32=/usr/lib/mpss.so.1 ; export LD_PRELOAD_32; export MPSSHEAP=4M; .
5 C H A P T E R 5 Sizing and Scaling Your Server This chapter examines the subsystems of your server, and provides recommendations for optimal performance. The chapter includes the following topics: ■ ■ ■ ■ ■ “64-Bit Server” on page 101 “Processors” on page 101 “Memory” on page 102 “Drive Space” on page 102 “Networking” on page 102 64-Bit Server The 64–bit server, available on Solaris SPARC and AMD64 platforms only, is more scalable than the 32–bit version.
Memory Memory As a baseline, Web Server requires 64 MB RAM. Multiple CPUs require at least 64 MB for each CPU. For example, if you have four CPUs, you should install at least 256 MB RAM for optimal performance. For high numbers of peak concurrent users, also allow extra RAM for the additional threads. After the first 50 concurrent users, add an extra 512 KB for each peak concurrent user. Drive Space You need to have enough drive space for your OS, document tree, and log files.
6 C H A P T E R 6 Scalability Studies This chapter describes the results of scalability studies. You can refer to these studies for a sample of how the server performs, and how you might configure your system to best take advantage of Web Server’s strengths.
Study Conclusion Study Conclusion When tuned, Sun Java System Web Server 7.0 scaled almost linearly in performance for dynamic and static content. Hardware The studies (except for the e-commerce study) were conducted using the following hardware. For hardware information for the e-commerce study, see “Hardware for E-Commerce Test” on page 122.
Configuration and Tuning Software The load driver for these tests was an internally-developed Java application framework called the Faban driver. Configuration and Tuning The following tuning settings are common to all the tests in this study. Individual studies may also have additional configuration and tuning information.
Configuration and Tuning ndd ndd ndd ndd -set -set -set -set /dev/tcp /dev/tcp /dev/tcp /dev/tcp tcp_max_buf 4194304 tcp_cwnd_max 2097152 tcp_recv_hiwat 400000 tcp_xmit_hiwat 400000 Network Configuration Since the tests used multiple network interfaces, it was important to make sure that all the network interfaces were not going to the same core.
Configuration and Tuning 5 no-intr since 12/07/2006 09:17:04 ................. Web Server Tuning The following table shows the tuning settings used for the Web Server.
Performance Tests and Results Performance Tests and Results This section contains the test-specific configuration, tuning, and results for the following tests: ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ “Static Content Test” on page 108 “Dynamic Content Test: Servlet” on page 110 “Dynamic Content Test: C CGI” on page 111 “Dynamic Content Test: Perl CGI” on page 113 “Dynamic Content Test: NSAPI” on page 114 “PHP Scalability Tests” on page 115 “SSL Performance Test: Static Content” on page 118 “SSL Performance Test: Perl CGI” o
Performance Tests and Results TABLE 6–3 File Cache Configuration Default Tuned enabled=true enabled=true max-age=30 sec max-age=3600 max-entries=1024 max-entries=1048576 sendfile=false sendfile=true max-heap-file-size=524288 max-heap-file-size=1200000 max-heap-space=10485760 max-heap-space=8000000000 max-mmap-file-size=0 max-mmap-file-size=1048576 max-mmap-space=0 max-mmap-space= l max-open-files=1048576 The following table shows the static content scalability results.
Performance Tests and Results Static Content Scalability Throughput(ops/sec) 28000 27000 26000 25000 24000 23000 22000 21000 20000 19000 18000 17000 16000 15000 14000 13000 12000 11000 10000 Throughput 2 4 6 Number of cores Dynamic Content Test: Servlet This test was conducted using the servlet. The test prints out the servlet's initialization arguments, environments, request headers, connection and client information, URL information, and remote user information.
Performance Tests and Results The following table shows the results for the dynamic content servlet test. TABLE 6–6 Dynamic Content Test: Servlet Scalability Number Of Cores Average Throughput (ops/sec) Average Response Time (ms) 2 5287 19 4 10492 19 6 15579 19 The following is a graphical representation of servlet scalability results.
Performance Tests and Results TABLE 6–7 CGI Tuning Settings Default Tuned idle-timeout=300 idle-timeout=300 cgistub-idle-timeout=30 cgistub-idle-timeout=1000 min-cgistubs=0 min-cgistubs=100 max-cgistubs=16 max-cgistubs=100 The following table shows the results of the dynamic content test for C CGI.
Performance Tests and Results Dynamic Content Test: Perl CGI This test was conducted with Perl script called printenv.pl that prints the CGI environment. CGI tuning settings were applied to the server. The goal was to saturate the cores on the server and find out the respective throughput and response time. The following table shows the CGI tuning settings used in the dynamic content test for Perl CGI.
Performance Tests and Results Perl CGI Scalability 900 850 Throughput(ops/sec) 800 750 700 650 Throughput 600 550 500 450 400 350 300 2 4 6 Number of cores Dynamic Content Test: NSAPI The NSAPI module used in this test was printenv2.so. It prints the NSAPI environment variables along with some text to make the entire response 2 KB. The goal was to saturate the cores on the server and find out the respective throughput and response time.
Performance Tests and Results NSAPI Scalability 19000 18000 17000 Throughput(ops/sec) 16000 15000 14000 Throughput 13000 12000 11000 10000 9000 8000 7000 6000 5000 2 4 6 Number of cores PHP Scalability Tests PHP is a widely-used scripting language uniquely suited to creating dynamic, Web-based content. It is the most rapidly expanding scripting language in use on the Internet due to its simplicity, accessibility, wide number of available modules, and large number of easily available applications.
Performance Tests and Results TABLE 6–12 Tuning Settings for FastCGI Plug-in Test Configuration Tuning magnus.conf Init fn="load-modules" shlib="path_to_web_server_plugin_dir/fastcgi/libfastcgi.so" funcs="responder_fastcgi" shlib_flags="(global|now)" obj.conf NameTrans fn="assign-name" from="/fcgi/*" name="fcgi.config"
Performance Tests and Results TABLE 6–15 PHP Scalability with NSAPI Number of Cores Average Throughput (ops/sec) Average Response Time (ms) 2 950 105 4 1846 108 6 2600 115 The following is a graphical representation of PHP scalability with NSAPI.
Performance Tests and Results ■ Web Server is configured with 64 bit The following table shows the SSL static content test results. TABLE 6–16 SSL Performance Test: Static Content Scalability Number of Cores Average Throughput (ops/sec) Average Response Time (ms) 2 2284 379 4 4538 387 6 6799 387 The following is a graphical representation of static content scalability with SSL.
Performance Tests and Results TABLE 6–17 SSL Performance Test: Perl CGI Scalability Number of Cores Average Throughput (ops/sec) Average Response Time (ms) 2 303 329 4 580 344 6 830 361 The following is a graphical representation of Perl scalability with SSL.
Performance Tests and Results TABLE 6–18 SSL Performance Test: C CGI Scalability Number of Cores Average Throughput (ops/sec) Average Response Time (ms) 2 792 126 4 1499 133 6 2127 141 The following is a graphical representation of C CGI scalability with SSL.
Performance Tests and Results TABLE 6–19 SSL Performance Test: NSAPI Scalability Number of Cores Average Throughput (ops/sec) Average Response Time (ms) 2 2729 29 4 5508 30 6 7982 32 The following is a graphical representation of NSAPI scalability with SSL.
Performance Tests and Results Database system configuration: ■ ■ ■ ■ Sun Microsystems Sun Fire 880 ( 900MHz US-III+) 16384 Megabytes of memory Solaris 10 operating system Oracle 10.1.0.2.0 Driver system configuration: ■ ■ Sun Microsystems Sun Fire 880 ( 900MHz US-III+) Solaris 10 operating system Network configuration: The Web Server, database, and the driver machines were connected with a gigabit Ethernet link.
Performance Tests and Results JVM tuning: -server -Xmx1500m -Xms1500m -Xss128k -XX:+DisableExplicitGC E-commerce Application Description The test models an e-commerce web site that sells items from a large inventory. It uses the standard web application model-view-controller design pattern for its implementation: the user interface (that is, the view) is handled by 16 different JSP pages which interface with a single master control servlet.
Performance Tests and Results TABLE 6–20 Performance Test Pass Criteria (Continued) Transaction 90th Percentile Response Time (Seconds) BuyRequest 3 CustomerRegistration 3 Home 3 NewProducts 5 OrderDisplay 3 OrderInquiry 3 ProductDetail 3 SearchRequest 3 SearchResults 10 ShoppingCart 3 The following table shows the e-commerce web application test results.
Performance Tests and Results E-commerce Web Application Scalability 11500 11000 10500 Users 10000 9500 Users 9000 8500 8000 7500 7000 2 4 Number of CPUs The following is a graphical representation of e-commerce web application scalability. E-commerce Web Application Scalability 1350 1300 Throughput(ops/sec) 1250 1200 1150 1100 1050 Throughput 1000 950 900 850 800 750 2 126 Number of CPUs 4 Sun Java System Web Server 7.
Index Numbers and Symbols C 64–bit servers performance advantages, 21 scaling, 101 cache not utilized, 87 caching, servlet/JSP, 79 cgi-bucket, 36 CGIStub processes, 81 check-acl SAF, 85 class-loader, 79 class reloading, configuring, 79 classpath, directories in, 80 configurations and performance, 20 statistics, 23 connection handling, 40-42 connection queue information, 49-51 connection queue size, and SNCA, 92 connection refused errors, 91 connection settings, JDBC resource, 75-77 connection timeouts,
Index disabling network interrupts, 98-99 disk configuration, 98 DNS cache, 68-70 async enabled, 70 current entries, 69-70 entries, 69-70 hit ratio, 70 maximum entries, 69-70 drive space, sizing issues, 102 dynamic control and monitoring, file cache, 64 dynamic reload interval, 79 func_insert, 83 G get-config-stats command, 26 get-perfdump command, 33 get-stats-xml command, 31 get-virtual-server-stats command, 28 get-webapp-stats command, 28 guarantee isolation, JDBC resource, 77 E H enable-perfdump c
Index J L Java ES monitoring console, 37 Java heap tuning, 71 Java HotSpot VM, 71 java.lang.
Index monitoring server performance (Continued) using Java EE monitoring console, 37 using perfdump, 31-37 using performance buckets, 35-37 using SE toolkit, 95 using stats-xml, 29-31 mpstat 60 command, 95 multi-process mode, 44-46 N NameTrans, 43, 82 native thread pool, 43-44, 66 NativePoolMaxThreads, 66, 68 NativePoolMinThreads, 68 NativePoolQueueSize, 67 NativePoolStackSize, 67 NativeThread, 44 ndd command, 91 netstat -i 60, 95 netstat -s command, 90 network configuration, 98-99 for studies, 106-107 ne
Index Q quality of service features, 20 statistics and, 24 queued connections, in JDBC resources, 74 R ratio, hit, 62 reapIntervalSeconds, 80 refresh, 65 reload-interval, 78 restart, 65 rlim_fd_max, 89, 96, 97 S scalability studies, 103-126 SE toolkit, 95 segmap_percent, 93 send-cgi, 35 send-file, nocache parameter, 63 server instances, statistics, 23 Service, 43, 83 servlet/JSP caching, 79 session creation information, 57-59 session-properties, 80 session settings, web application, 80-81 set-http-prop c
Index TerminateTimeout directive, 42 test results, 103-126 thread pools, 48, 65-68 custom, 42-43 disabled, 41 native thread pool, 43-44, 66 threads, 40-46 acceptor, 52 creation statistics, 57-59 keep-alive, 56 maximum, 58 maximum and SNCA, 92 multi-process mode, 44 too few, 86 tips, general, 39-40 transaction isolation level, JDBC resource, 77 tuning maxLocks, 80 tuning MMapSessionManager, 81 tuning TCP buffering, 91 tuning the Web Server, 39-83 Java web applications performance, 78-81 threads, processes,