background image

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

.jar

archive in

WEB-INF/lib

instead of packaging the

.class

files as is in

WEB-INF/classes

, and ensure that

the

.war

archive does not contain a

WEB-INF/classes

directory.

Configuring the Web Application’s Session Settings

If you have relatively short-lived sessions, try decreasing the session timeout by configuring the
value of the

timeOutSeconds

property under the

session-properties

element in

sun-web.xml

from the default value of 10 minutes.

If you have relatively long-lived sessions, you can try decreasing the frequency at which the
session reaper runs by increasing the value of the

reapIntervalSeconds

property from the

default value of once every minute.

For more information about these settings, and about session managers, see

Sun Java System

Web Server 7.0 Update 1 Developer’s Guide to Java Web Applications

.

In multi-process mode when the

persistence-type

in

sun-web.xml

is configured to be either

s1ws60

or

mmap

, the session manager uses cross-process locks to ensure session data integrity.

These can be configured to improve performance as described below.

Note –

For Java technology-enabled servers, multi-process mode is deprecated and included for

backward-compatibility only.

Tuning maxLocks (UNIX/Linux)

The implication of the number specified in the

maxLocks

property can be gauged by dividing

the value of

maxSessions

with

maxLocks

. For example, if

maxSessions = 1000

and you set

maxLocks = 10

, then approximately 100 sessions (1000/10) contend for the same lock.

Increasing

maxLocks

reduces the number of sessions that contend for the same lock and might

improve performance and reduce latency. However, increasing the number of locks also
increases the number of open file descriptors, and reduces the number of available descriptors
that would otherwise be assigned to incoming connection requests.

For more information about these settings, see Chapter 6, “Session Managers,” in

Sun Java

System Web Server 7.0 Update 1 Developer’s Guide to Java Web Applications

.

Tuning Java Web Application Performance

Sun Java System Web Server 7.0 Update 1 Performance Tuning, Sizing, and Scaling Guide •

80

Summary of Contents for Sun Java System Web Server 7.0

Page 1: ...Sun Java SystemWeb Server 7 0 Update 1 PerformanceTuning Sizing and Scaling Guide Sun Microsystems Inc 4150 Network Circle Santa Clara CA 95054 U S A Part No 820 1067 ...

Page 2: ...relatifs à la technologie incorporée dans le produit qui est décrit dans ce document En particulier et ce sans limitation ces droits de propriété intellectuelle peuvent inclure un ou plusieurs brevets américains ou des applications de brevet en attente aux Etats Unis et dans d autres pays Cette distribution peut comprendre des composants développés par des tierces personnes Certaines composants de...

Page 3: ...ty Using the CLI 26 To Monitor Statistics from the CLI 26 Monitoring Current Activity Using stats xml 29 To Enable the stats xml URI from the Admin Console 29 To Enable the stats xml URI from the CLI 30 To Limit the stats xml Statistics Displayed in the URI 30 To View stats xml Output from the CLI 31 Monitoring Current Activity Using perfdump 31 To Enable the perfdump URI from the Admin Console 31...

Page 4: ...tion 68 Java Virtual Machine JVM Information 70 Web Application Information 71 To Access Web Application Statistics From the Admin Console 71 JDBC Resource Information 72 Tuning the ACL User Cache 77 Tuning Java Web Application Performance 78 Using Precompiled JSPs 78 Using Servlet JSP Caching 79 Configuring the Java Security Manager 79 Configuring Class Reloading 79 Avoiding Directories in the Cl...

Page 5: ... Tuning 93 High File System Page In Rate 93 Reduce File System Housekeeping 93 Long Service Times on Busy Disks or Volumes 93 Solaris Platform Specific Performance Monitoring 94 Short Term System Monitoring 94 Long Term System Monitoring 95 Intelligent Monitoring 95 Solaris 10 Platform Specific Tuning Information 95 Tuning Solaris for Performance Benchmarking 96 Tuning UltraSPARC T1 Based Systems ...

Page 6: ...t 108 Dynamic Content Test Servlet 110 Dynamic Content Test C CGI 111 Dynamic Content Test Perl CGI 113 Dynamic Content Test NSAPI 114 PHP Scalability Tests 115 SSL Performance Test Static Content 118 SSL Performance Test Perl CGI 119 SSL Performance Test C CGI 120 SSL Performance Test NSAPI 121 E Commerce Web Application Test 122 Index 127 Contents Sun Java SystemWeb Server 7 0 Update 1 Performan...

Page 7: ... Web Server Tuning Settings 107 TABLE 6 2 SSL Session Cache Tuning Settings 107 TABLE 6 3 File Cache Configuration 109 TABLE 6 4 Static Content Scalability 109 TABLE 6 5 JVM Tuning Settings 110 TABLE 6 6 Dynamic Content Test Servlet Scalability 111 TABLE 6 7 CGI Tuning Settings 112 TABLE 6 8 Dynamic Content Test C CGI Scalability 112 TABLE 6 9 CGI Tuning Settings 113 TABLE 6 10 Dynamic Content Tes...

Page 8: ...rmance Test C CGI Scalability 121 TABLE 6 19 SSL Performance Test NSAPI Scalability 122 TABLE 6 20 Performance Test Pass Criteria 124 TABLE 6 21 E Commerce Web Application Scalability 125 Tables Sun Java SystemWeb Server 7 0 Update 1 PerformanceTuning Sizing and Scaling Guide 8 ...

Page 9: ...Figures FIGURE 2 1 Web Server Connection Handling 40 9 ...

Page 10: ...10 ...

Page 11: ...rver and always back up your configuration files before making any changes BeforeYou ReadThis Book Web Server can be installed as a stand alone product or as a component of Sun JavaTM Enterprise System Java ES a software infrastructure that supports enterprise applications distributed across a network or Internet environment If you are installing Web Server as a component of Java ES you should be ...

Page 12: ... Monitoring and logging server activity Using certificates and public key cryptography to secure the server Configuring access control to secure the server Using Java Platform Enterprise Edition Java EE security features Deploying applications Managing virtual servers Defining server workload and sizing the system to meet performance needs Searching the contents and attributes of server documents ...

Page 13: ... File Reference Editing configuration files Sun Java System Web Server 7 0 Update 1 Performance Tuning Sizing and Scaling Guide Tuning Sun Java System Web Server to optimize performance Sun Java System Web Server 7 0 Update 1 Troubleshooting Guide Troubleshooting Web Server Related Books The URL for all documentation about Sun Java Enterprise System Java ES and its components is http docs sun com ...

Page 14: ...dows all installations system drive Program Files Sun WebServer7 instance dir Directory that contains the instance specific subdirectories For Java ES installations the default location for instances on Solaris var opt SUNWwbsvr7 For Java ES installations the default location for instances on Linux and HP UX var opt sun webserver7 For Java ES installations the default location for instance on Wind...

Page 15: ... appear bold online Read Chapter 6 in the User s Guide A cache is a copy that is stored locally Do not save the file Symbol Conventions The following table explains symbols that might be used in this book TABLE P 4 SymbolConventions Symbol Description Example Meaning Contains optional arguments and command options ls l The l option is not required Contains a set of choices for a required command o...

Page 16: ...Web Server site docs sun com To include other Sun web sites in your search for example java sun com www sun com and developers sun com use sun com in place of docs sun com in the search field Third PartyWeb Site References Third party URLs are referenced in this document and provide additional related information Note Sun is not responsible for the availability of third party web sites mentioned i...

Page 17: ... 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 Preface 17 ...

Page 18: ...18 ...

Page 19: ...ovides a general discussion of server performance considerations and more specific information about monitoring server performance This chapter includes the following topics Performance Issues on page 19 Configuration on page 20 Virtual Servers on page 20 Server Farms on page 21 64 Bit Servers on page 21 SSL Performance on page 21 Monitoring Server Performance on page 22 Performance Issues The fir...

Page 20: ...onfiguration level so you can monitor the performance of all instances based on the configuration However the bulk of the monitoring information is available at the individual server instance or virtual server level If you are using a single Web Server instance per configuration your server is not part of a server farm the configuration level statistics show the information for the single server i...

Page 21: ...tic content while the 32 bit Web Server is confined to 4 GB of address space In general the tuning for the 64 bit Web Server is similar to the tuning for the 32 bit Web Server The differences are mostly tuned at the operating system level Tuning specifics are discussed in Tuning UltraSPARC T1 Based Systems for Performance Benchmarking on page 97 SSL Performance SSL always has a significant impact ...

Page 22: ...statistics stats xml through a browser Enable through Admin Console or through editing a configuration file Through a URI Administration Server need not be running XML formatted statistics stats xml through the command line interface Enabled by default Through the wadm command get stats xml Accessible when session threads are hanging Administration Server must be running perfdump through a browser...

Page 23: ...through the command line interface through the stats xml URI and through perfdump For all these monitoring methods the server uses statistics it collects None of these monitoring methods will work if statistics are not collected The statistics give you information at the configuration level the server instance level or the virtual server level The statistics are broken up into functional areas For...

Page 24: ... to monitor your server for performance To enable statistics use Admin Console or the wadm command line utility CLI Note Collecting statistics causes a slight hit to performance To Enable Statistics from the Admin Console From the Admin Console CommonTasks page select the configuration Click Edit Configuration Click the General tab Click the Monitoring Settings sub tab On the Monitoring Settings p...

Page 25: ...sks page select the Monitoring tab Select the configuration The configuration statistics are displayed From the drop down list select aView interval The statistics displayed in your browser are automatically updated at this interval Select the type of statistics to display The initial list of statistics types includes General Statistics Instance Statistics and Virtual Server Statistics If you choo...

Page 26: ...shows an example of the output for a single node timeStarted 1168035653 secondsRunning 1404 countRequests 690546 rpsLast1MinAvg 4491 7666 rpsLast5MinAvg 1844 6061 rpsLast15MinAvg 637 37305 countErrors 0 epsLast1MinAvg 0 0 epsLast5MinAvg 0 0 epsLast15MinAvg 0 0 maxResponseTime 0 30789953 rtLast1MinAvg 5 3970284 rtLast5MinAvg 5 208407 rtLast15MinAvg 35 56042 countBytesReceived 96800935 countBytesTra...

Page 27: ...ueue 1 countQueued15MinuteAverage 4 3203125 process 1 connectionQueue 1 countQueued 0 process 1 connectionQueue 1 countQueued1MinuteAverage 0 046875 process 1 connectionQueue 1 countTotalQueued 79171 process 1 connectionQueue 1 countQueued5MinuteAverage 4 03125 process 1 connectionQueue 1 countOverflows 0 process 1 connectionQueue 1 maxQueued 1288 process 1 connectionQueue 1 ticksTotalQueued 72495...

Page 28: ...ol 1 countThreads 1 process 1 threadPool 1 maxQueued 0 process 1 threadPool 1 peakQueued 0 process 1 threadPool 1 name NativePool process 1 threadPool 2 countQueued 0 process 1 threadPool 2 countThreadsIdle 1 process 1 threadPool 2 threadPoolId my custom pool process 1 threadPool 2 maxThreads 128 process 1 threadPool 2 countThreads 1 process 1 threadPool 2 maxQueued 0 process 1 threadPool 2 peakQu...

Page 29: ...view the stats xml output through a URI which you have to enable or you can view the stats xml output through the CLI which is enabled by default To Enable the stats xml URI from the Admin Console If you enable the stats xml URI you can access statistics for your server in XML format through a browser Note that when you use the stats xml URI you can access statistics even when the Administration S...

Page 30: ...mit the data it provides Modify the stats xml URI to limit the information by setting elements to 0 or 1 An element set to 0 is not displayed on the stats xml output For example http yourhost port stats xml thread 0 process 0 This syntax limits the stats xml output so that thread and process statistics are not included By default all statistics are enabled set to 1 Most of the statistics are avail...

Page 31: ...ance data from the Web Server internal statistics and displays them in ASCII text The perfdump output does not display all the statistics available through the command line statistics or the Admin Console but it can still be a useful tool For example you can still use perfdump even if the Administration Server is not running You can view the perfdump output through the CLI which is enabled by defa...

Page 32: ...tomatically refresh The following example sets the refresh to every 5 seconds http yourhost perf refresh 5 To Enable the perfdump URI from the CLI Use the following command to enable stats xml wadm enable perfdump user admin user password file admin password file uri uri config config name vs virtual server name Use the uri option to set the pefdump URI Deploy the configuration using the wadm depl...

Page 33: ... node node name The output appears in your command window Sample perfdump Output The following is sample perfdump output webservd pid 29133 Sun Java System Web Server 7 0 B07 13 2006 17 09 SunOS DOMESTIC Server started Fri Jul 14 14 34 15 2006 Process 29133 started Fri Jul 14 14 34 17 2006 ConnectionQueue Current Peak Limit Queue Length 2 237 1352 Total Connections Queued 67364017 Average Queue Le...

Page 34: ...y 0 0008 47998 2500 2 23 Function Processing Time 0 0335 2099689 0000 97 77 Total Response Time 0 0343 2147687 2500 100 00 Sessions Process Status Client Age VS Method URI Function 29133 response 192 6 7 7 115 https test GET qa_webapp CheckNetwork class service j2ee 29133 response 192 6 7 7 8 https test GET qa_webapp CheckNetwork class service j2ee 29133 response 192 6 7 7 4 https test GET qa_weba...

Page 35: ...2ee are functions used to serve the CGI and Java servlet requests respectively You can either define two buckets to maintain separate counters for CGI and servlet requests or create one bucket that counts requests for both types of dynamic content The cost of collecting this information is minimal and the impact on the server performance is usually negligible This information can later be accessed...

Page 36: ...l default bucket acl bucket Service method GET HEAD POST type magnus internal fn send file bucket file bucket Object name cgi ObjectType fn force type type magnus internal cgi Service fn send cgi bucket cgi bucket Object For more information see The bucket Parameter in Sun Java System Web Server 7 0 Update 1 Administrator s Configuration File Reference Performance Report The server statistics in b...

Page 37: ...er of requests 62647125 Request processing time 0 0343 2147687 2500 default bucket Default bucket Number of Requests 62647125 100 00 Number of Invocations 3374170785 100 00 Latency 0 0008 47998 2500 2 23 Function Processing Time 0 0335 2099689 0000 97 77 Total Response Time 0 0343 2147687 2500 100 00 Monitoring Current Activity Using the Java ES Monitoring Console The statistics available through ...

Page 38: ...38 ...

Page 39: ... UNIX Linux on page 81 Using find pathinfo forward on page 82 Using nostat on page 82 Using Busy Functions on page 83 Note Be very careful when tuning your server Always back up your configuration files before making any changes GeneralTuningTips As you tune your server it is important to remember that your specific environment is unique The impacts of the suggestions provided in this guide will v...

Page 40: ...r system The release notes often provide updated information about specific adjustments UnderstandingThreads Processes and Connections Before tuning your server you should understand the connection handling process in Web Server This section includes the following topics Connection Handling Overview on page 40 Custom Thread Pools on page 42 The Native Thread Pool on page 43 Process Modes on page 4...

Page 41: ...ings that affect the number and timeout of threads processes and connections in the Admin Console on the configuration s Performance tab HTTP settings and on the HTTP listener You can also use the wadm commands set thread pool prop and set http listener prop and set keep alive prop Low Latency and High Concurrency Modes The server can run in one of two modes depending upon the load It changes mode...

Page 42: ...u can also create your own thread pools in magnus conf using a thread pool Init function These custom thread pools are used for executing NSAPI Service Application Functions SAFs not entire requests If the SAF requires the use of a custom thread pool the current request processing thread queues the request waits until the other thread from the custom thread pool completes the SAF then the request ...

Page 43: ...is used internally by the server to execute NSAPI functions that require a native thread for execution Web Server uses Netscape Portable Runtime NSPR which is an underlying portability layer providing access to the host OS services This layer provides abstractions for threads that are not always the same as those for the OS provided threads These non native threads have lower scheduling overhead s...

Page 44: ...and puts the request into the connection queue A request processing thread picks up the request from the connection queue and handles the request Because the server is multi threaded all NSAPI extensions written to the server must be thread safe This means that if the NSAPI extension uses a global resource like a shared reference to a file or global variable then the use of that resource must be s...

Page 45: ...er cannot guarantee that load is distributed evenly among server processes you might encounter performance problems if you set Maximum Threads to 1 and MaxProcs greater than 1 to accommodate a legacy application that is not thread safe The problem is especially pronounced if the legacy application takes a long time to respond to requests for example if the legacy application contacts a back end da...

Page 46: ...rver xml in Sun Java System Web Server 7 0 Update 1 Administrator s Configuration File Reference TABLE 2 1 Parameter Mapping to server xml Web Server 6 1 parameter Web Server 7 0 server xml element or attribute Admin Console Location wadm command AcceptTimeout in magnus conf io timeout element of the http element Configuration s Performance tab HTTP Settings page set http prop command s io timeout...

Page 47: ... magnus conf listen queue size element of the http listener element Configuration s HTTP Listeners tab set http listener prop command s listen queue size LogVerbose in magnus conf log level element of the log element Configuration s General Tab Log Settings set error log prop command s log level property MaxAge in nsfc conf file max age element of the file cache element Configuration s Performance...

Page 48: ...ool and keep alive settings Tune these settings at the configuration level in the Admin Console or using wadm commands It is also possible to tune the server by editing the elements directly in the server xml file but editing the server xml file directly can lead to complications perfdump monitors statistics in the following categories which are described in the following sections In most cases th...

Page 49: ...TP listener The acceptor threads accept the connection and put it into the connection queue Then request processing threads take the connection in the connection queue and process the request For more information see Connection Handling Overview on page 40 Connection queue information shows the number of sessions in the connection queue and the average delay before the connection is accepted by th...

Page 50: ...mum Threads Keep Alive Queue Size Once the connection queue is full new connections are dropped Tuning If the peak queue length maximum queue size is close to the limit you can increase the maximum connection queue size to avoid dropping connections under heavy load You can increase the maximum connection queue size in the Admin Console by changing the value of the thread pool Queue Size field on ...

Page 51: ...rage queueing delay This setting is not tunable Total Number of Connections Added The new connections added to the connection queue This setting is not tunable HTTP Listener Listen Socket Information The following HTTP listener information includes the IP address port number number of acceptor threads and the default virtual server For tuning purposes the most important field in the HTTP listener ...

Page 52: ...s one less system call per connection Specify an IP address other than 0 0 0 0 for best possible performance AcceptorThreads Acceptor threads are threads that wait for connections The threads accept connections and put them in a queue where they are then picked up by worker threads For more information see Connection Handling Overview on page 40 Ideally you want to have enough acceptor threads so ...

Page 53: ...CP keep alives Also note that the name keep alive was changed to PersistentConnections in HTTP 1 1 but Web Server continues to refer to them as keep alive connections The following example shows the keep alive statistics displayed by perfdump KeepAliveInfo KeepAliveCount 198 200 KeepAliveHits 0 KeepAliveFlushes 0 KeepAliveRefusals 56844280 KeepAliveTimeouts 365589 KeepAliveTimeout 10 seconds The f...

Page 54: ...lose a connection even if the client has requested a keep alive connection The keep alive timeout is set to 0 The keep alive maximum connections count is exceeded Dynamic content such as a CGI does not have an HTTP content length header set This applies only to HTTP 1 0 requests If the request is HTTP 1 1 the server honors keep alive requests even if the content length is not set The server can us...

Page 55: ...etting The server does not close existing connections when the keep alive count exceeds the maximum connection size Instead new keep alive connections are refused and the number of connections refused count is incremented Keep Alive Refusals The number of times the server could not hand off the connection to a keep alive thread possibly due to too many persistent connections or when total number o...

Page 56: ...yle workloads would have many connections established and terminated 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 by setting the HTTP listener listen queue size to a larger value such as 8192 The HTTP listener listen queue specifies the maximum number of pending connections ...

Page 57: ...OutputStreamSize is not specified in obj conf wadm set http prop user admin user password file admin password file config config name output buffer size 16384 wadm deploy config user admin user password file admin password file config config name The following example shows setting the buffer size for the nsapi_test Service function Object name nsapitest ObjectType fn force type type magnus intern...

Page 58: ...server counts the number of active requests adding one to the number when a new request arrives subtracting one when it finishes the request When a new request arrives the server checks to see if it is already processing the maximum number of requests If it has reached the limit it defers processing new requests until the number of active requests drops below the maximum amount In theory you could...

Page 59: ...field on the configuration s Performance tab HTTP tab under Thread Pool Settings In the command line interface use the wadm set thread pool prop command s max threads property The default is 128 File Cache Information Static Content The cache information section provides statistics on how your file cache is being used The file cache caches static content so that the server handles requests for sta...

Page 60: ...Entries 0 Number of Maximum Open Files Allowed 1024 Heap Size 36064 Maximum Heap Cache Size 10735636 Size of Memory Mapped File Content 0 Maximum Memory Mapped File Size 0 Maximum Age of Entries 30 Accelerator Entries The number of files that have been cached in the accelerator cache Tuning You can increase the maximum number of accelerator cache entries by increasing the number of file cache entr...

Page 61: ...an acceleratable request was eligible for addition to the accelerator cache Tuning When the server serves a static file from the file cache the accelerator cache may be able to cache the response for faster processing on subsequent requests To maximize performance you should maximize the number of responses that are acceleratable In the default configuration all responses to requests for static fi...

Page 62: ...he Admin Console in the Maximum Entries field on the configuration s Performance tab Cache tab under File Cache In the command line interface use wadm set file cache prop and set the max entries property The default is 1024 The range of values is 1 1048576 File Cache Hit Ratio Cache Hits Cache Lookups The hit ratio available through perfdump gives you the number of file cache hits compared to cach...

Page 63: ...o However the heap size should not be so large that the operating system starts paging cached files Tuning Set the maximum heap size in the Admin Console in the Maximum Heap Space Size field on the configuration s Performance tab Cache tab under File Cache In the command line interface use wadm set file cache prop and change the max heap space property The default value is 10485760 bytes The range...

Page 64: ...rol and monitoring function nsfc dump to be accessed through the URI nfsc To use a different URI change the from parameter in the NameTrans directive The following is an example of the information you receive when you access the URI Sun Java System File Cache Status pid 3602 The file cache is enabled Cache resource utilization Number of cached file entries 174968 152 bytes each 26595136 total byte...

Page 65: ...ile ID value The flags are as follows C File contents are cached D Cache entry is marked for delete E PR_GetFileInfo returned an error for this file I File information size modify date and so on is cached M File contents are mapped into virtual memory O File descriptor is cached when TransmitFile is set to true P File has associated private data should appear on shtml files T Cache entry has a tem...

Page 66: ...ndicates the number of threads that are currently idle Peak indicates the peak number of threads in the pool Limit listed as Threads in the Admin Console indicates the maximum number of native threads allowed in the thread pool and for NativePool is determined by the setting of NativePoolMaxThreads in the magnus conf file Tuning You can modify the maximum threads for NativePool by editing the Nati...

Page 67: ...ueue If the queue is full the next request handling thread that tries to get in the queue is rejected with the result that it returns a busy response to the client It is then free to handle another incoming request instead of being tied up waiting in the queue Setting the NativePoolQueueSize lower than the maximum threads value causes the server to execute a busy function instead of the intended N...

Page 68: ...ently but has more overhead due to context switching so bigger is not always better Typically you do not need to increase this number but if you are not saturating your CPU and you are seeing requests queue up then you should increase this number Tuning You can modify the NativePoolMaxThreads by editing the NativePoolMaxThreads parameter in magnus conf NativePoolMinThreads Directive Determines the...

Page 69: ...in the Admin Console on the configuration s Performance tab DNS sub tab under DNS Cache Settings and selecting or deselecting the DNS Cache Enabled box To enable or disable it using the command line interface use wadm set dns cache prop and set the enabled property Cache Entries Current Cache Entries Maximum Cache Entries This section in perfdump shows the number of current cache entries and the m...

Page 70: ...chronous resolver By default Async DNS is disabled If it is disabled this section does not appear in perfdump To enable it using the Admin Console on the configuration s Performance tab DNS tab under DNS Lookup Settings select Asynchronous DNS To enable it using the command line interface use wadm set dns prop and set the async property to true JavaVirtual Machine JVM Information JVM statistics ar...

Page 71: ...ava HotSpot virtual machine which can be found at http java sun com docs hotspot index html Specific documents of interest include Tuning Garbage Collection with the 5 0 Java Virtual Machine http java sun com docs hotspot gc5 0 gc_tuning_5 html and Ergonomics in the 5 0 Java Virtual Machine http java sun com docs hotspot gc5 0 ergo5 html JVM options can be specified in the Admin Console on the con...

Page 72: ...ation on tuning see Tuning Java Web Application Performance on page 78 Also see Sun Java System Web Server 7 0 Update 1 Developer s Guide to Java Web Applications JDBC Resource Information A JDBC resource is a named group of JDBC connections to a database A JDBC resource defines the properties used to create a connection pool Each JDBC resource uses a JDBC driver to establish a connection to a phy...

Page 73: ...ough the Admin Console CLI and stats xml only They are not shown in perfdump Some of the monitoring data is unavailable through the Admin Console and can only be viewed through the CLI using wadm get config stats and through the stats xml output A pool is created on demand that is it is created the first time it is used The monitoring statistics are not displayed until the first time the pool is u...

Page 74: ...er increasing the minimum connections If number of leased connections is consistently at the JDBC resource s maximum number of connections consider increasing the maximum number of connections The upper limit for the number of leased connections is the number of maximum connections To change the minimum or maximum connections for a JDBC resource through the Admin Console on the Edit JDBC Resource ...

Page 75: ...akQueued The highest number of connection requests that have been queued simultaneously at any time during the lifetime of the pool Not tunable millisecondsPeakWait The maximum time in milliseconds that any connection request has been in the wait queue A high number is an indication of high pool activity The upper limit is the JDBC resource setting wait timeout countConnectionIdleTimeouts The numb...

Page 76: ...n the specific vendor database to prevent accumulation of unusable connections in the pool Wait timeout The amount of time in seconds that a request waits for a connection in the queue before timing out After this timeout the user sees an error Defaults to 60 Setting this attribute to 0 causes a request for a connection to wait indefinitely This setting could also improve performance by keeping th...

Page 77: ...me the connection is leased to an application In most cases leave this setting disabled Tuning the ACL User Cache The ACL user cache is on by default Because of the default size of the cache 200 entries the ACL user cache can be a bottleneck or can simply not serve its purpose on a site with heavy traffic On a busy site more than 200 users can hit ACL protected resources in less time than the life...

Page 78: ...ns This section includes the following topics Using Precompiled JSPs on page 78 Using Servlet JSP Caching on page 79 Configuring the Java Security Manager on page 79 Configuring Class Reloading on page 79 Avoiding Directories in the Classpath on page 80 Configuring the Web Application s Session Settings on page 80 In addition see the following sections for other tuning information related to the J...

Page 79: ...Manager The main drawback of running with the Security Manager is that it negatively impacts performance The Java Security Manager is disabled by default when you install the product Running without the Security Manager might improve performance significantly for some types of applications Based on your application and deployment needs you should evaluate whether to run with or without the Securit...

Page 80: ...ession managers see Sun Java System Web Server 7 0 Update 1 Developer s Guide to Java Web Applications In multi process mode when the persistence type in sun web xml is configured to be either s1ws60 or mmap the session manager uses cross process locks to ensure session data integrity These can be configured to improve performance as described below Note For Java technology enabled servers multi p...

Page 81: ...ou have an init cgi function in the magnus conf file and you are running in multi process mode you must add LateInit yes to the init cgi line Tune the following settings to control CGI stubs These settings are on the configuration s Performance Tab CGI sub tab Minimum Stubs Size Controls the number of processes that are started by default The first CGI stub process is not started until a CGI progr...

Page 82: ...rans fn assign name from perf find pathinfo forward name perf This feature can improve performance for certain URLs by doing fewer stats in the server function find pathinfo On Windows you can also use this feature to prevent the server from changing to when using the PathCheck server function find pathinfo For more information about obj conf see the Sun Java System Web Server 7 0 Update 1 Adminis...

Page 83: ...for your application You can specify your own busy functions for any NSAPI function in the obj conf file by including a service function in the configuration file in this format busy my busy function For example you could use this sample service function Service fn send cgi busy service toobusy This allows different responses if the server become too busy in the course of processing a request that...

Page 84: ...84 ...

Page 85: ...ur server use ACLs only when required The server is configured with an ACL file containing the default ACL allowing write access to the server only to all and an es internal ACL for restricting write access for anybody The latter protects the manuals icons and search UI files in the server The default obj conf file has NameTrans lines mapping the directories that need to be read only to the es int...

Page 86: ...ion performance Consideration of session manager properties session creation activity note that JSPs have sessions enabled by default and session idle time is needed to address this situation Too FewThreads The server does not allow the number of active threads to exceed the thread limit value If the number of simultaneous requests reaches that limit the server stops servicing new connections unti...

Page 87: ...Flushed A web site that might be able to service 75 requests per second without keep alive connections might be able to do 200 300 requests per second when keep alive is enabled Therefore as a client requests various items from a single page it is important that keep alive connections are being used effectively If the KeepAliveCount shown in perfdump Total Number of Connections Added as displayed ...

Page 88: ...d Log File Modes Keeping the log files on a high level of verbosity can have a significant impact on performance On the configuration s General Tab Log Settings page choose the appropriate log level and use levels such as Fine Finer and Finest with care To set the log level using the CLI use the command wadm set log prop and set the log level Log File Modes Sun Java SystemWeb Server 7 0 Update 1 P...

Page 89: ...n Refused Errors on page 91 Tuning TCP Buffering on page 91 Using the Solaris Network Cache and Accelerator SNCA on page 91 Files Open in a Single Process File Descriptor Limits Different platforms each have limits on the number of files that can be open in a single process at one time For busy sites you might need to increase that number On Solaris systems control this limit by setting rlim_fd_ma...

Page 90: ...file called etc init d network tuning and create a link to that file named etc rc2 d S99network tuning You can monitor the effect of these changes by using the netstat s command and looking at the tcpListenDrop tcpListenDropQ0 and tcpHalfOpenDrop values Review them before adjusting these values If they are not zero adjust the value to 2048 initially and continue to monitor the netstat output The W...

Page 91: ...n tuning the TCP protocol it is suggested that you do not change the above parameter TuningTCP Buffering If you are seeing unpredictable intermittent slowdowns in network response from a consistently loaded server you might investigate setting the sq_max_size parameter by adding the following line to the etc system file set sq_max_size 512 This setting adjusts the size of the sync queue which tran...

Page 92: ...Sendfile Save your changes Redeploy the configuration for your changes to take effect MaximumThreads and Queue Size When configuring Web Server to be used with SNCA disabling the thread pool provides better performance These settings are on the configuration s Performance tab HTTP sub tab under Thread Pool Settings To disable the thread pool deselect the Thread Pool Enabled checkbox You can also d...

Page 93: ...e On a heavily loaded machine with 4 GB of physical memory improvements have been seen with values as high as 60 You should experiment with this value starting with values around 25 On systems with large amounts of physical memory you should raise this value in small increments as it can significantly increase kernel memory requirements Reduce File System Housekeeping UNIX file system UFS volumes ...

Page 94: ... on page 22 Short Term System Monitoring Solaris offers several tools for taking snapshots of system behavior Although you can capture their output in files for later analysis the tools listed below are primarily intended for monitoring system behavior in real time The iostat x 60 command reports disk performance statistics at 60 second intervals Watch the b column to see how much of the time each...

Page 95: ...y profile see the crontab man page for an explanation of the format of this file This causes the system to store performance data in files in the var adm sa directory where by default they are retained for one month You can then use the sar command to examine the statistics for time periods of interest Intelligent Monitoring The SE toolkit is a freely downloadable software package developed by Sun...

Page 96: ...systems with high network traffic tcp_time_wait_interval ndd dev tcp 240000 60000 Set on clients too tcp_conn_req_max_q ndd dev tcp 128 1024 tcp_conn_req_max_q0 ndd dev tcp 1024 4096 tcp_ip_abort_interval ndd dev tcp 480000 60000 tcp_keepalive_interval ndd dev tcp 7200000 900000 For high traffic web sites lower this value tcp_rexmit_interval_initial ndd dev tcp 3000 3000 If retransmission is great...

Page 97: ... open file descriptors limit should account for the expected load for the associated sockets files pipes if any hires_tick etc system 1 sq_max_size etc system 2 0 Controls streams driver queue size setting to 0 makes it infinite so the performance runs won t be hit by lack of buffer space Set on clients too Note that setting sq_max_size to 0 might not be optimal for production systems with high ne...

Page 98: ...onto separate disks as much as possible Enable the disk read write cache Note that if you enable write cache on the disk some writes might be lost if the disk fails Consider mounting the disks with the following options which might yield better disk performance nologging directio noatime Network Configuration If more than one network interface card is used make sure the network interrupts are not ...

Page 99: ...age 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 bin startserv unset LD_PRELOAD_32 unset MPSSHEAP For 64 bit servers LD_PRELOAD_64 usr lib 64 mpss so 1 export LD_PRELOAD_64 export MPSSHEAP 4M bin startserv unset LD_PRELOAD_64 unset MPSSHEAP Tuning UltraSPARC T1 Based Systems for Performance Benchmarking Chapter 4 Platf...

Page 100: ...100 ...

Page 101: ... of RAM Some of the advantages which the 64 bit server has over the 32 bit server are More file cache for static content Many simultaneous servlet sessions because of the 64 bit JVM Processors On Solaris and Windows Web Server transparently takes advantage of multiple CPUs In general the effectiveness of multiple CPUs varies with the operating system and the workload Dynamic content performance im...

Page 102: ...ndle and multiply that number of users by the average request size on your site Your average request might include multiple documents If you re not sure try using your home page and all of its associated subframes and graphics Next decide how long the average user will be willing to wait for a document at peak utilization Divide by that number of seconds That s the WAN bandwidth your server needs ...

Page 103: ...Hardware on page 104 Software on page 105 Configuration and Tuning on page 105 Performance Tests and Results on page 108 Study Goals The goal of the tests in the study was to shows how well Sun Java System Web Server 7 scales The tests also helped to determine the configuration and tuning requirements for different types of content The studies were conducted with the following content 100 static 1...

Page 104: ...st 16256 Megabytes of memory Solaris 10 operating system Three Sun StoreEdge 3510 Web Server system configuration Sun Microsystems Sun Fire T2000 1000 MHz 6 cores 16376 Megabytes of memory Solaris 10 operating system Driver system configuration Three Sun Microsystems Sun FireTM X4100 Four Sun Microsystems Sun Fire V490 2 X 1050 MHzUS IV Three Sun Fire T1000 Sun Fire 880 990 MHz US III 8192 Megabyt...

Page 105: ... set ip ip_soft_rings_cnt 0 set ip ip_squeue_fanout 1 set ip ip_squeue_enter 3 set ip ip_squeue_worker_wait 0 set segmap_percent 6 set bufhwm 32768 set maxphys 1048576 set maxpgio 128 set ufs smallfile 6000000 For ipge driver set ipge ipge_tx_ring_size 2048 set ipge ipge_tx_syncq 1 set ipge ipge_srv_fifo_depth 16000 set ipge ipge_reclaim_pending 32 set ipge ipge_bcopy_thresh 512 set ipge ipge_dvma...

Page 106: ...r 1 tmp 1 while tmp ne 4 do usr sbin psradm i 1 shift numpsr expr numpsr 1 tmp expr tmp 1 done done The following example shows psrinfo output before running the script psrinfo more 0 on line since 12 06 2006 14 28 34 1 on line since 12 06 2006 14 28 35 2 on line since 12 06 2006 14 28 35 3 on line since 12 06 2006 14 28 35 4 on line since 12 06 2006 14 28 35 5 on line since 12 06 2006 14 28 35 Th...

Page 107: ... listen queue size 128 Non secure listener on port 80 Secure listener on port 443 listen queue size 15000 Keep alive enabled true threads 1 max connections 200 timeout 30 sec enabled true threads 2 max connections 15000 timeout 180 sec default web xml JSP compilation turned on JSP compilation turned off The following table shows the SSL session cache tuning settings used for the SSL tests TABLE 6 ...

Page 108: ...second Response time for single transaction round trip time in milliseconds The performance and scalability diagrams show throughput ops sec against the number of cores enabled on the system Static ContentTest This test was performed with a static download of a randomly selected file from a pool of 10 000 directories each containing 36 files ranging in size from 1KB to 1000 KB The goal of the stat...

Page 109: ...eap file size 1200000 max heap space 8000000000 max mmap file size 1048576 max mmap space l max open files 1048576 The following table shows the static content scalability results TABLE 6 4 Static Content Scalability Number Of Cores AverageThroughput ops sec Average ResponseTime ms 2 10365 184 4 19729 199 6 27649 201 The following is a graphical representation of static content scalability results...

Page 110: ...g table shows the JVM tuning settings used in the test TABLE 6 5 JVM Tuning Settings Default Tuned Xmx128m Xms256m server Xrs Xmx2048m Xms2048m Xmn2024m XX AggressiveHeap XX LargePageSizeInBytes 256m XX UseParallelOldGC XX UseParallelGC XX ParallelGCThreads number of cores XX DisableExplicitGC Number of cores Static Content Scalability 20000 21000 24000 23000 22000 25000 26000 27000 28000 19000 18...

Page 111: ...performed by accessing a C executable called printenv This executable outputs the environment variable information 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 describes the CGI tuning settings used in this test Number of cores Servlet Scalability 5000 2 4 6 6000 7000 800...

Page 112: ...8 Dynamic Content Test C CGI Scalability Number Of Cores AverageThroughput ops sec Average ResponseTime ms 2 892 112 4 1681 119 6 2320 129 The following is a graphical representation of C CGI scalability results Number of cores C CGI Scalability 2300 2200 2100 2000 1900 1800 1700 1600 1500 1400 1300 1200 1100 1000 900 800 2400 2 4 6 Throughput ops sec Throughput PerformanceTests and Results Sun Ja...

Page 113: ...l CGI TABLE 6 9 CGI Tuning Settings Default Tuned idle timeout 300 cgistub idle timeout 30 min cgistubs 0 max cgistubs 16 idle timeout 300 cgistub idle timeout 1000 min cgistubs 100 max cgistubs 100 The following table shows the results for the dynamic content test of Perl CGI TABLE 6 10 Dynamic Content Test Perl CGI Scalability Number Of Cores AverageThroughput ops sec Average ResponseTime ms 2 3...

Page 114: ...ing the unused path checks The following table shows the results of the dynamic content test for NSAPI TABLE 6 11 Dynamic Content Test NSAPI Scalability Number Of Cores AverageThroughput ops sec Average ResponseTime ms 2 6264 14 4 12520 15 6 18417 16 The following is a graphical representation of NSAPI scalability results Number of cores Perl CGI Scalability 900 850 800 750 700 650 600 550 500 450...

Page 115: ... were performed in two modes An out of process fastcgi php application invoked using the FastCGI plug in available for Sun Java System Web Server 7 0 the download will be available from http www zend com sun In process PHP NSAPI plug in The test executed the phpinfo query The goal was to saturate the cores on the server and find out the respective throughput and response time PHP Scalability with ...

Page 116: ... PHP_FCGI_MAX_REQUESTS 20000 app env LD_LIBRARY_PATH path_to_php_lib listen queue 8192 req retry 2 reuse connection 1 connection timeout 120 resp timeout 60 restart interval 0 Object mime types type magnus internal ws php exts php php3 php4 The following table shows the results of the PHP with FastCGI test TABLE 6 13 PHP Scalability with Fast CGI Number of Cores AverageThroughput ops sec Average R...

Page 117: ...dir from php nsapi dir path_to_php_script_dir name php nsapi Object name php nsapi ObjectType fn force type type magnus internal x httpd php Service fn php5_execute Object mime types type magnus internal ws php exts php php3 php4 The following table shows the results of the PHP with NSAPI test Number of cores PHP Scalability With Fast CGI 2000 2100 2400 2300 2200 2500 1900 1800 1700 1600 1500 1400...

Page 118: ...s to saturate the cores and find out the respective throughput and response time Only four cores of T2000 were used for this test This test used the following configuration Static files were created on striped disk array Sun StorEdge 3510 Multiple network interfaces were configured The file cache was enabled and tuned using the settings in Table 6 3 The SSL session cache was tuned using the settin...

Page 119: ...eTest Perl CGI This test was conducted with Perl script called printenv pl that prints the CGI environment in SSL mode The test was performed in SSL mode with the SSL session cache enabled The goal was to saturate the cores on the server and find out the respective throughput and response time The following table shows the SSL Perl CGI test results Number of cores Static Content Scalability With S...

Page 120: ...his executable outputs the environment variable information The test was performed in SSL mode with the SSL session cache enabled The goal was to saturate the cores on the server and find out the respective throughput and response time The following table shows the SSL CGI test results Number of cores Perl CGI Scalability With SSL 700 750 800 850 650 600 550 500 450 400 350 300 2 6 4 Throughput op...

Page 121: ...nvironment variables along with some text to make the entire response 2 KB The test was performed in SSL mode with the SSL session cache enabled The goal was to saturate the cores on the server and find out the respective throughput and response time The following table shows the SSL NSAPI test results Number of cores C CGI Scalability With SSL 2100 2000 1900 1800 1700 1600 1500 1400 1300 1200 110...

Page 122: ...imulate online shopping Hardware for E CommerceTest The e commerce studies were conducted using the following hardware Web Server system configuration Sun Microsystems Sun Fire 880 900MHz US III Only four CPUs were used for this test 16384 Megabytes of memory Solaris 10 operating system Number of cores NSAPI Scalability With SSL 8000 7500 7000 6500 6000 5500 5000 4500 4000 3500 3000 2500 2 6 4 Thr...

Page 123: ...ng jdbc resource jndi name jdbc jwebapp jndi name datasource class oracle jdbc pool OracleDataSource datasource class max connections 200 max connections idle timeout 0 idle timeout wait timeout 5 wait timeout connection validation auto commit connection validation property name username name value db_user value property property name password name value db_password value property property name ur...

Page 124: ...DBC connections handle database connection using prepared statements and following standard JDBC design principles Workload A randomly selected user performs the online shopping The following operations were used in the Matrix mix workload operations were carried out with precedence of operations Home AdminConfirm AdminRequest BestSellers BuyConfirm BuyRequest CustomerRegistration NewProducts Orde...

Page 125: ...ductDetail 3 SearchRequest 3 SearchResults 10 ShoppingCart 3 The following table shows the e commerce web application test results TABLE 6 21 E Commerce Web Application Scalability Number of CPUs Users Throughput ops sec 2 7000 790 4 11200 1350 The following is a graphical representation of e commerce web application scalability PerformanceTests and Results Chapter 6 Scalability Studies 125 ...

Page 126: ...lity 11500 11000 10500 10000 9500 9000 8500 8000 7500 7000 2 4 Users Users Number of CPUs E commerce Web Application Scalability 1150 1200 1250 1300 1350 1100 1050 1000 950 900 850 800 750 2 4 Throughput ops sec Throughput PerformanceTests and Results Sun Java SystemWeb Server 7 0 Update 1 PerformanceTuning Sizing and Scaling Guide 126 ...

Page 127: ...usy functions 83 C 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 ...

Page 128: ... 93 94 find pathinfo forward 82 find pathinfo function 82 flushed keep alive connections 87 88 free connections in JDBC resources 74 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 H hardware for e commerce study 122 123 for studies 104 high concurrency...

Page 129: ...ve 42 L LateInit 81 LDAP server and ACL user cache 77 leased connections in JDBC resources 74 listen socket statistics 51 load driver for studies 105 load modules function 43 log file modes 88 verbose 88 long service times 93 94 low latency mode 41 low memory problems 86 M magnus conf connection handling directives 42 init cgi multi process mode 81 manager properties properties 81 max groups per u...

Page 130: ... 57 P page sizes 99 PATH_INFO 82 PathCheck 43 83 peak concurrent users 102 perfdump about 31 37 enabling 31 32 sample output 33 35 using to monitor server activity 31 37 performance buckets 35 issues 19 20 monitoring tools 22 overview 19 37 problems 85 studies 103 126 tuning 39 83 performance buckets configuration of 36 defining in magnus conf 36 information in perfdump 37 performance report 36 37...

Page 131: ...ng term system monitoring 95 SE toolkit 95 short term system monitoring 94 95 sq_max_size 91 96 97 SSL performance 21 start options 99 statistics activating 24 25 connection queue 49 file cache information 59 listen socket information 51 monitoring 23 performance buckets 35 stats xml accessing URI 30 enabling URI 29 limiting output 30 31 using to monitor current activity 29 31 studies 103 126 conc...

Page 132: ...77 tuning tips general 39 40 platform specific 89 99 tuning Web Server 6 1 to 7 0 parameter mapping 46 48 keep alive subsystem 56 U UFS 93 under throttled server 86 UNIX file system 93 using statistics to tune your server 48 77 V validation method JDBC resource 76 validation table name JDBC resource 76 virtual servers default 53 virtual servers Continued HTTP listeners 51 performance overview 20 v...

Reviews: