Sun Microsystems 820434310 manual

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

Go to page of

A good user manual

The rules should oblige the seller to give the purchaser an operating instrucion of Sun Microsystems 820434310, along with an item. The lack of an instruction or false information given to customer shall constitute grounds to apply for a complaint because of nonconformity of goods with the contract. In accordance with the law, a customer can receive an instruction in non-paper form; lately graphic and electronic forms of the manuals, as well as instructional videos have been majorly used. A necessary precondition for this is the unmistakable, legible character of an instruction.

What is an instruction?

The term originates from the Latin word „instructio”, which means organizing. Therefore, in an instruction of Sun Microsystems 820434310 one could find a process description. An instruction's purpose is to teach, to ease the start-up and an item's use or performance of certain activities. An instruction is a compilation of information about an item/a service, it is a clue.

Unfortunately, only a few customers devote their time to read an instruction of Sun Microsystems 820434310. A good user manual introduces us to a number of additional functionalities of the purchased item, and also helps us to avoid the formation of most of the defects.

What should a perfect user manual contain?

First and foremost, an user manual of Sun Microsystems 820434310 should contain:
- informations concerning technical data of Sun Microsystems 820434310
- name of the manufacturer and a year of construction of the Sun Microsystems 820434310 item
- rules of operation, control and maintenance of the Sun Microsystems 820434310 item
- safety signs and mark certificates which confirm compatibility with appropriate standards

Why don't we read the manuals?

Usually it results from the lack of time and certainty about functionalities of purchased items. Unfortunately, networking and start-up of Sun Microsystems 820434310 alone are not enough. An instruction contains a number of clues concerning respective functionalities, safety rules, maintenance methods (what means should be used), eventual defects of Sun Microsystems 820434310, and methods of problem resolution. Eventually, when one still can't find the answer to his problems, he will be directed to the Sun Microsystems service. Lately animated manuals and instructional videos are quite popular among customers. These kinds of user manuals are effective; they assure that a customer will familiarize himself with the whole material, and won't skip complicated, technical information of Sun Microsystems 820434310.

Why one should read the manuals?

It is mostly in the manuals where we will find the details concerning construction and possibility of the Sun Microsystems 820434310 item, and its use of respective accessory, as well as information concerning all the functions and facilities.

After a successful purchase of an item one should find a moment and get to know with every part of an instruction. Currently the manuals are carefully prearranged and translated, so they could be fully understood by its users. The manuals will serve as an informational aid.

Table of contents for the manual

  • Page 1

    Sun GlassF ish Enterprise Ser v er 2.1 P er f ormance T uning Guide Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part N o: 820–4343–10 January 2009[...]

  • Page 2

    Copyright 2009 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. I n particular, and without limitation, these intellectual property rights may include one or more U.S[...]

  • Page 3

    Cont ents Preface ...................................................................................................................................................13 1 Overview of Enterprise Ser v er Performance T uning ..................................................................... 17 Process Overview ......................................[...]

  • Page 4

    Tuning Tips for Specic Types of EJB Components ............................................................... 42 JDBC and Database Access ......................................................................................................... 46 Tuning M essage-Driven Beans ......................................................................[...]

  • Page 5

    Improving ORB P erformance with J ava Serialization ............................................................. 75 Thread P ool Settings ........................................................................................................................... 76 Tuning Thread P ools (Unix /L inux only) ...........................................[...]

  • Page 6

    Disk I/O Settings ................................................................................................................ ........ 102 TCP/IP Settings .......................................................................................................................... 102 Tuning UltraSP ARC T1–B ased Systems ........................[...]

  • Page 7

    F igures FIGURE 1–1 J ava EE A pplication Model ....................................................................................... 20 7[...]

  • Page 8

    8[...]

  • Page 9

    T ables T ABLE 1–1 P erformance Tuning Roadmap ............................................................................... 17 T ABLE 1–2 Factors That Aect P erformance ............................................................................. 24 T ABLE 3–1 B ean Type P ooling or Caching ..............................................[...]

  • Page 10

    10[...]

  • Page 11

    Examples EXAMPLE 4–1 Heap Conguration on Solaris ................................................................................ 89 EXAMPLE 4–2 Heap Conguration on Windows ........................................................................... 90 11[...]

  • Page 12

    12[...]

  • Page 13

    P refac e The P erformance Tuning Guide describes how to get the best performance with Enterprise Server. This preface contains information about and conventions for the entire Sun GlassFish TM Enterprise Server documentation set. Sun GlassFish Ent erprise S erver Documentation Set T ABLE P–1 Books in the Enterprise Server Documentation Set Book [...]

  • Page 14

    T ABLE P–1 Books in the Enterprise Server D ocumentation Set (Continued) Book Title Description H igh A vailability Administration Guide Setting up clusters, working with node agents, and using load balancers. A dministration Reference Editing the Enterprise Server conguration le, domain.xml . Performance Tuning G uide Tuning the Enterprise[...]

  • Page 15

    T ypogr aphic Con ventions The following table describes the typographic changes that are used in this book. T ABLE P–3 Typographic Conventions T ypeface Meaning Example AaBbCc123 The names of commands, les, and directories, and onscreen computer output Edit your .login le. Use ls -a to list all les. machine_name% you have mail. AaBbCc12[...]

  • Page 16

    T ABLE 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 N ew. From the N ew submenu, choose Templates. Documentation, Support, and T r aining The Sun web site provides information about the following addition[...]

  • Page 17

    O v er view of Enterprise Ser ver P er formanc e T uning You can signicantly improve performance of the Sun GlassFish Enterprise Server and of applications deployed to it by adjusting a few deployment and server conguration settings. However, it is important to understand the environment and performance goals. An optimal conguration for a [...]

  • Page 18

    T ABLE 1–1 Performance Tuning Roadmap (Continued) Step Description of T ask Location of Instructions 3 Installation: I f you are using H ADB for session persistence, ensure that the H ADB software is installed. I nstallation Guide 4 Deployment: Install and run your applications. Familiarize yourself with how to congure and administer the Enter[...]

  • Page 19

    Understanding Opera tional Requirements Before you begin to deploy and tune your application on the Application Server, it is important to clearly dene the operational environment. The operational environment is determined by high-level constraints and requirements such as: ■ “A pplication Architecture” on page 19 ■ “Security Requireme[...]

  • Page 20

    M oderately complex enterprise applications can be developed entirely using servlets and JSP technology. M ore complex business applications often use Enterprise JavaBeans (EJB) components. The A pplication Server integrates the web and EJB containers in a single process. Local access to EJB components from servlets is very ecient. However, some[...]

  • Page 21

    Security Requirements M ost business applications require security. This section discusses security considerations and decisions. User A uthentication and Authoriza tion A pplication users must be authenticated. The A pplication Server provides three dierent choices for user authentication: le-based, LD AP , and Solaris. The default le bas[...]

  • Page 22

    ■ What is the nature of the applications with respect to security? Do they encrypt all or only a part of the application inputs and output? What percentage of the information needs to be securely transmitted? ■ Are the applications going to be deployed on an application server that is directly connected to the Internet? Will a web server exist [...]

  • Page 23

    Administr ation A single A pplication Server installation on a server can encompass multiple instances. A group of one or more instances that are administered by a single A dministration Server is called a domain . Grouping server instances into domains permits dierent people to independently administer the groups. You can use a single-instance [...]

  • Page 24

    T ABLE 1–2 Factors That Aect P erformance Concept In practice Measurement Value sourc es User Load Concurrent sessions at peak load Transactions P er Minute (TPM) Web Interactions P er Second (WIPS) (Max. number of concurrent users) * (expected response time) / (time between clicks) Example: (100 user s*2s e c )/1 0s e c=2 0 A pplication Scala[...]

  • Page 25

    ▼ T o Determine Capacity Determine performance on a single CPU. First determine the largest load that a single processor can sustain. You can obtain this gure by measuring the performance of the application on a single-processor machine. Either leverage the performance numbers of an existing application with similar processing characteristics [...]

  • Page 26

    fraction of them are logged in and performing business transactions. A common mistake during capacity planning is to use the total size of customer population as the basis and not the average and peak numbers for concurrent users. The number of concurrent users also may exhibit patterns over time. ■ What is the average and peak amount of data tra[...]

  • Page 27

    T uning Y our Application This chapter provides information on tuning applications for maximum performance. A complete guide to writing high performance J ava and J ava EE applications is beyond the scope of this document. This chapter discusses the following topics: ■ “J ava Programming Guidelines” on page 27 ■ “J ava Server Page and Ser[...]

  • Page 28

    String str = " testing " ; str = str + " abc " ; The compiler translates this code as: String str = " testing " ; StringBuffer tmp = new StringBuffer(str); tmp.append( " abc " ); str = tmp.toString(); Therefore, copying is inherently expensive and overusing it can reduce performance signicantly. Assign nul[...]

  • Page 29

    Declare Method Arguments nal Declare method arguments final if they are not modied in the method. In general, declare all variables final if they are not modied after being initialized or set to some value. Synchr onize Only When Necessary Do not synchronize code blocks or methods unless synchronization is required. Keep synchronized block[...]

  • Page 30

    Suggested C oding Practices This section provides some tips on coding practices that improve servlet and JSP application performance. General Guidelines Follow these general guidelines to increase performance of the presentation tier: ■ Minimize J ava synchronization in servlets. ■ Don’ t use the single thread model for servlets. ■ Use the [...]

  • Page 31

    Congur ation and Deployment Tips Follow these conguration tips to improve performance. These tips are intended for production environments, not development environments. ■ To improve class loading time, avoid having excessive directories in the server CLASSPATH . Put application-related classes into J AR les. ■ HTTP response times are [...]

  • Page 32

    E JB Per f ormance T uning The Enterprise Server’ s high-performance EJB container has numerous parameters that aect performance. Individual EJB components also have parameters that aect performance. The value of individual EJB component’ s parameter overrides the value of the same parameter for the EJB container. The default values are d[...]

  • Page 33

    asadmin get --user admin --host e4800-241-a --port 4848 -m specjcmp.application.SPECjAppServer.ejb-module. supplier_jar.stateful-session-bean.BuyerSes.bean-cache.* The following is a sample of the monitoring output: resize-quantity = -1 cache-misses = 0 idle-timeout-in-seconds = 0 num-passivations = 0 cache-hits = 59 num-passivation-errors = 0 tota[...]

  • Page 34

    collection is happening too frequently, and the pool size is growing, but the cache hit rate is small, then the pool-idle-timeout-in-seconds can be reduced to destroy the instances. Note – Specifying a max-pool-size of zero (0) means that the pool is unbounded. The pooled beans remain in memory unless they are removed by specifying a small interv[...]

  • Page 35

    To nd the possible objects (applications, modules, beans, and methods) and object attributes that can be monitored, use the A dmin Console. For more information, see Chapter 18, “M onitoring Components and Services, ” in Sun GlassFish Enterprise Server 2.1 A dministration Guide . Alternatively, use the asadmin list command. For more informat[...]

  • Page 36

    ■ Cache EJB resources : Use setSessionContext() or ejbCreate() to cache bean resources. This is again an example of using bean lifecycle methods to perform application actions only once where possible. Remember to release acquired resources in the ejbRemove() method. Use the Appropria te Stubs The stub classes needed by EJB applications are gener[...]

  • Page 37

    Pref er Local Inter faces An EJB component can have remote and local interfaces. Clients not located in the same application server instance as the bean (remote clients) use the remote interface to access the bean. Calls to the remote interface require marshalling arguments, transportation of the marshalled data over the network, un-marshaling the [...]

  • Page 38

    semantics. See “Value A dded Features” in Sun GlassF ish Enterprise Server 2.1 Developer’ s Guide for more details about the pass-by-reference ag. To specify that an EJB component will use pass by reference semantics, use the following tag in the sun-ejb-jar.xml deployment descriptor: <pass-by-reference>true</pass-by-reference>[...]

  • Page 39

    source are going to be involved in a transaction. If a database participates in some distributed transactions, but mostly in local or single database transactions, it is advisable to register two separate JDBC resources and use the appropriate resource in the application. Congur e JDBC Resources as One-Phase Commit Resources To improve performan[...]

  • Page 40

    Use version consistency to improve performance while protecting the integrity of data in the database. Since the application server can use multiple copies of an EJB component simultaneously, an EJB component’ s state can potentially become corrupted through simultaneous access. The standard way of preventing corruption is to lock the database ro[...]

  • Page 41

    ... </cmp-field-mapping> <consistency> <check-version-of-accessed-instances> <column-name>OrderTable.VC_VERSION_NUMBER</column-name> </check-version-of-accessed-instances> </consistency> </entity-mapping> In addition, you must establish a trigger on the database to automatically update the version col[...]

  • Page 42

    For example, enable threadpools named priority-1 and priority-2 to the <orb> element as follows: <orb max-connections= " 1024 " message-fragment-size= " 1024 " use-thread-pool-ids= " thread-pool-1,priority-1,priority-2 " > Include the threadpool ID in the use-thread-pool-id element of the EJB component’ s[...]

  • Page 43

    to the steady load of users), beans would be frequently passivated and activated, causing a negative impact on the response times, due to CPU intensive serialization and deserialization as well as disk I/O . Another important variable for tuning is cache-idle-timeout-in-seconds where at periodic intervals of cache-idle-timeout-in-seconds , all the [...]

  • Page 44

    ■ Database rows represented by the bean do not change. ■ The application can tolerate using out-of-date values for the bean. For example, an application might use a read-only bean to represent a list of best-seller books. Although the list might change occasionally in the database (say, from another bean entirely), the change need not be ree[...]

  • Page 45

    For example, you have this relationship dened in the ejb-jar.xml le: <relationships> <ejb-relation> <description>Order-OrderLine</description> <ejb-relation-name>Order-OrderLine</ejb-relation-name> <ejb-relationship-role> <ejb-relationship-role-name> Order-has-N-OrderLines </ejb-relationship-[...]

  • Page 46

    Pre-fetching generally improves performance because it reduces the number of database accesses. However, if the business logic often uses Orders without referencing their OrderLines, then this can have a performance penalty, that is, the system has spent the eort to pre-fetch the OrderLines that are not actually needed. A void pre-fetching for s[...]

  • Page 47

    Reduce the database transaction isolation level when appropriate. Reduced isolation levels reduce work in the database tier, and could lead to better application performance. H owever, this must be done after carefully analyzing the database table usage patterns. Set the database transaction isolation level with the A dmin Console on the Resources [...]

  • Page 48

    Cache Bean-Specic Resourc es Use the setMessageDrivenContext() or ejbCreate() method to cache bean specic resources, and release those resources from the ejbRemove() method. Limit Use of JMS C onnec tions When designing an application that uses JMS connections make sure you use a methodology that sparingly uses connections, by either pooling [...]

  • Page 49

    T uning the Enterprise Ser ver This chapter describes some ways to tune the Enterprise Server for optimum performance, including the following topics: ■ “Deployment Settings” on page 49 ■ “Logger Settings” on page 50 ■ “Web Container Settings” on page 51 ■ “EJB Container Settings” on page 53 ■ “J ava M essage Service Set[...]

  • Page 50

    Disable Aut o -deployment Enabling auto-deployment will adversely aect deployment, though it is a convenience in a development environment. For a production system, disable auto-deploy to optimize performance. If auto-deployment is enabled, then the Reload P oll Interval setting can have a signicant performance impact. Disable auto-deployment[...]

  • Page 51

    General Settings In general, writing to the system log slows down performance slightly; and increased disk access (increasing the log level, decreasing the le rotation limit or time limit) also slows down the application. Also, make sure that any custom log handler doesn’ t log to a slow device like a network le system since this can advers[...]

  • Page 52

    Manager Properties: Reap Inter val M odifying the reap interval can improve performance, but setting it without considering the nature of your sessions and business logic can cause data inconsistency, especially for time-based persistence-frequency. For example, if you set the reap interval to 60 seconds, the value of session data will be recorded [...]

  • Page 53

    E JB C ontainer Settings The EJB Container has many settings that aect performance. As with other areas, use monitor the EJB Container to track its execution and performance. Monitoring the E JB C ontainer M onitoring the EJB container is disabled by default. Enable monitoring with the Admin Console under C ongurations > cong-name > [...]

  • Page 54

    Note – If you develop and deploy your EJB components using Sun J ava Studio, then you need to edit the individual bean descriptor settings for bean pool and bean cache. These settings might not be suitable for production-level deployment. T uning the EJB Pool A bean in the pool represents the pooled state in the EJB lifecycle. This means that the[...]

  • Page 55

    ■ P ool Idle Timeout : the maximum time that a stateless session bean, entity bean, or message-driven bean is allowed to be idle in the pool. After this time, the bean is destroyed if the bean in case is a stateless session bean or a message driver bean. This is a hint to server. The default value is 600 seconds. The corresponding EJB deployment [...]

  • Page 56

    Max Cache Size Maximum number of beans in the cache. M ake this setting greater than one. The default value is 512. A value of zero indicates the cache is unbounded, which means the size of the cache is governed by Cache Idle Timeout and Cache Resize Quantity. The corresponding EJB deployment descriptor attribute is max-cache-size . Cache Resize Qu[...]

  • Page 57

    T ABLE 3–2 EJB Cache and Pool Settings (Continued) Cache Settings Pool Settings T ype of Bean cache- resize- quantity max- cache- size cache- idle- timeout- in- seconds removal- timeout- in- seconds victim- selection- policy refresh- period- in- seconds steady- pool-size pool- resize- quantity max- pool- size pool-idle- timeout-in- seconds Entity[...]

  • Page 58

    than cache misses, then option B is an appropriate choice. You might still have to change the max-cache-size and cache-resize-quantity to get the best result. If the cache hits are too low and cache misses are very high, then the application is not reusing the bean instances and hence increasing the cache size (using max-cache-size ) will not help [...]

  • Page 59

    asadmin get -m serverInstance.transaction-service.* The following statistics are gathered on the transaction service: ■ total-tx-completed Completed transactions. ■ total-tx-rolled-back Total rolled back transactions. ■ total-tx-inflight Total inight (active) transactions. ■ isFrozen Whether transaction system is frozen (true or false) ?[...]

  • Page 60

    Recov er On Restar t ( Automa tic Recovery) To set the Recover on Restart attribute with the A dmin Console, go to C ongurations > cong-name > Transaction Service. Click the Recover check box to set it to true (checked, the default) or false (un-checked). You can also set automatic recovery with asadmin , for example: asadmin set server[...]

  • Page 61

    With asadmin , use the following command to list the monitoring parameters available: list --user admin --port 4848 -m server-instance-name .http-service.* where server-instance-name is the name of the server instance. Use the following command to get the values: get --user admin --port 4848 -m server.http-service. parameter-name .* where parameter[...]

  • Page 62

    HitRatio The hit ratio is the number of cache hits divided by the number of cache lookups. This setting is not tunable. Note – If you turn o DNS lookups on your server, host name restrictions will not work and IP addresses will appear instead of host names in log les. Caching DNS Entries I t is possible to also specify whether to cache the [...]

  • Page 63

    File C ache Information (le- cache) The le cache caches static content so that the server handles requests for static content quickly. The le-cache section provides statistics on how your le cache is being used. For information on tuning the le cache, see “HTTP F ile C ache” on page 67 . ■ N umber of Hits on Cached File Content[...]

  • Page 64

    C onnec tion Queue ■ Total Connections Queued: Total connections queued is the total number of times a connection has been queued. This includes newly accepted connections and connections from the keep-alive system. ■ A verage Queuing Delay: A verage queueing delay is the average amount of time a connection spends in the connection queue. This [...]

  • Page 65

    ■ Request Timeout ■ Buer Length Thread C ount The Thread Count parameter species the maximum number of simultaneous requests the server can handle. The default value is 5. When the server has reached the limit or request threads, it defers processing new requests until the number of active requests drops below the maximum amount. Increasi[...]

  • Page 66

    Buer Length The size (in bytes) of the buer used by each of the request processing threads for reading the request data from the client. A djust the value based on the actual request size and observe the impact on performance. In most cases the default should suce. If the request size is large, increase this parameter. Keep Aliv e Both HTT[...]

  • Page 67

    Time Out Time Out determines the maximum time (in seconds) that the server holds open an HTTP keep alive connection. A client can keep a connection to the server open so that multiple requests to one server can be serviced by a single network connection. Since the number of open connections that the server can handle is limited, a high number of op[...]

  • Page 68

    Max Files C ount Max F iles C ount determines how many les are in the cache. If the value is too big, the server caches little-needed les, which wastes memory. If the value is too small, the benet of caching is lost. Try dierent values of this attribute to nd the optimal solution for specic applications—generally, the eects w[...]

  • Page 69

    T uning HT TP Listener Settings Change HTTP listener settings in the A dmin Console under C ongurations > cong-name > HTTP Service > HTTP Listeners > listener-name . Network A ddress For machines with only one network interface card (NI C), set the network address to the IP address of the machine (for example, 192.18.80.23 instead[...]

  • Page 70

    ORB Settings The Enterprise Server includes a high performance and scalable CORB A Object Request Broker (ORB). The ORB is the foundation of the EJB Container on the server. Overview The ORB is primarily used by EJB components via: ■ RMI/IIOP path from an application client (or rich client) using the application client container. ■ RMI/IIOP pat[...]

  • Page 71

    set serverInstance.iiop-service.orb.system.monitoringEnabled=true reconfig serverInstance Connection Statistics The following statistics are gathered on ORB connections: ■ total-inbound-connections Total inbound connections to ORB . ■ total-outbound-connections Total outbound connections from ORB . Use this command to get ORB connection statist[...]

  • Page 72

    T ABLE 3–3 Tunable ORB Settings (Continued) RMI/ IIOP from ORB to Enterprise Server communication infrastructure, thread pool steady-thread-pool-size, max-thread-pool-size, idle-thread-timeout-in-seconds RMI/ IIOP from a vendor ORB parts of communication infrastructure, thread pool steady-thread-pool-size, max-thread-pool-size, idle-thread-timeou[...]

  • Page 73

    ■ Minimum P ool Size: The minimum number of threads in the ORB thread pool. Set to the average number of threads needed at a steady (RMI/ IIOP) load. ■ Maximum P ool Size: The maximum number of threads in the ORB thread pool. ■ Idle Timeout: N umber of seconds to wait before removing an idle thread from pool. Allows shrinking of the thread po[...]

  • Page 74

    Load Balancing For information on how to congure RMI/II OP for multiple application server instances in a cluster, Chapter 9, “RMI-IIOP Load Balancing and Failover, ” in Sun GlassFish E nterprise Server 2.1 H igh A vailability A dministration Guide . When tuning the client ORB for load-balancing and connections, consider the number of connec[...]

  • Page 75

    ++++++++++++++++++++++++++++++ Message(Thread[ORB Client-side Reader, conn to 192.18.80.118:1050,5,main]): createFromStream: type is 4 < MessageBase(Thread[ORB Client-side Reader, conn to 192.18.80.118:1050,5,main]): Message GIOP version: 1.2 MessageBase(Thread[ORB Client-side Reader, conn to 192.18.80.118:1050,5,main]): ORB Max GIOP Version: 1.[...]

  • Page 76

    ▼ T o Enable Java Serialization You must set this property on all servers that you want to use JSG. In the tree component, e xpand the Congurations node. Expand the desired node. Select the JVM S ettings node In the JVM Settings page, choose the JVM Options tab . Click Add JVM Option, and enter the f ollowing value: -Dcom.sun.CORBA.encoding.OR[...]

  • Page 77

    is not oered in a Unix/Linux user interface. However, it is possible to edit the OS-scheduled thread pools and add new thread pools, if needed, using the A dmin Console. Resourc es ■ “JDBC C onnection P ool Settings” on page 77 ■ “Connector C onnection P ool Settings” on page 80 JDBC C onnec tion P ool Settings For optimum performanc[...]

  • Page 78

    ■ “Timeout Settings” on page 78 ■ “Isolation Level Settings” on page 79 ■ “Connection Validation Settings” on page 79 P ool Size Settings The following settings control the size of the connection pool: Initial and Mimimum P ool Size Size of the pool when created, and its minimum allowable size. Maximum P ool Size Upper limit of si[...]

  • Page 79

    ■ Idle Timeout : M aximum time in seconds that a connection can remain idle in the pool. After this time, the pool can close this connection. This property does not control connection timeouts on the database server. Keep this timeout shorter than the database server timeout (if such timeouts are congured on the database), to prevent accumulat[...]

  • Page 80

    Connection Validation Required If true, the pool validates connections (checks to nd out if they are usable) before providing them to an application. If possible, keep the default value, false. Requiring connection validation forces the server to apply the validation algorithm every time the pool returns a connection, which adds overhead to the [...]

  • Page 81

    asadmin> create-connector-connection-pool --raname jdbcra --connectiondefinition javax.sql.DataSource -transactionsupport LocalTransaction TESTPOOL Close All Connections On Any F ailure Chapter 3 • T uning the Enterprise Ser ver 81[...]

  • Page 82

    82[...]

  • Page 83

    T uning the Java Runtime S ystem This chapter discusses the following topics: ■ “J ava Virtual Machine Settings” on page 83 ■ “Managing M emory and Garbage C ollection” on page 84 ■ “Further I nformation” on page 91 Jav a V ir tual Machine Settings J2SE 5.0 provides two implementations of the H otSpot Java virtual machine (JVM): ?[...]

  • Page 84

    Managing Memor y and Garbage Collection The eciency of any application depends on how well memory and garbage collection are managed. The following sections provide information on optimizing memory and allocation functions: ■ “Goals” on page 32 ■ “Tracing Garbage Collection” on page 86 ■ “Other Garbage Collector Settings” on pa[...]

  • Page 85

    When the new generation lls up, it triggers a minor collection in which the surviving objects are moved to the old generation. When the old generation lls up, it triggers a major collection which involves the entire object heap. Both HotSpot and Solaris JDK use thread local object allocation pools for lock-free, fast, and scalable object allo[...]

  • Page 86

    T racing Garbage Collec tion The two primary measures of garbage collection performance are throughput and pauses . Throughput is the percentage of the total time spent on other activities apart from GC. Pauses are times when an application appears unresponsive due to GC. Two other considerations are footprint and promptness . Footprint is the work[...]

  • Page 87

    Although applications can explicitly invoke GC with the System.gc() method, doing so is a bad idea since this forces major collections, and inhibits scalability on large systems. I t is best to disable explicit GC by using the ag -XX:+DisableExplicitGC . The Enterprise Server uses RMI in the A dministration module for monitoring. Garbage cannot [...]

  • Page 88

    memory structures. The dierence between the maximum address space and the total of those values is the amount of memory that can be allocated to the heap. You can improve performance by increasing your heap size or using a dierent garbage collector. In general, for long-running server applications, use the J2SE throughput collector on machine[...]

  • Page 89

    ■ Decide the total amount of memory you can aord for the JVM. Accordingly, graph your own performance metric against young generation sizes to nd the best setting. ■ Make plenty of memory available to the young generation. The default is calculated from NewRatio and the -Xmx setting. ■ Larger eden or younger generation spaces increase t[...]

  • Page 90

    To prevent load address collisions, set preferred base addresses with the rebase utilty that comes with Visual Studio and the Platform SDK. Use the rebase utility to reassign the base addresses of the A pplication Server DLLs to prevent relocations at load time and increase the available process memory for the J ava heap. There are a few A pplicati[...]

  • Page 91

    F ur ther Information For more information on tuning the JVM, see: ■ J ava HotSpot VM Options ■ Frequently A sked Questions About the J ava HotSpot Virtual Machine ■ P erformance D ocumentation for the J ava HotSpot VM ■ J ava performance web page ■ M onitoring and Management for the J ava Platform ( J2SE 5.0) ■ The jvmstat monitoring u[...]

  • Page 92

    92[...]

  • Page 93

    T uning the Operating S ystem and Pla tform This chapter discusses tuning the operating system (OS) for optimum performance. I t discusses the following topics: ■ “Server Scaling” on page 93 ■ “Solaris 10 Platform-Specic Tuning Information” on page 95 ■ “Tuning for the Solaris OS” on page 95 ■ “Linux Conguration” on pa[...]

  • Page 94

    the relative amount of time it spends in I/O versus CPU activity. Studies have shown that doubling the number of CPUs increases servlet performance by 50 to 80 percent. Memor y See the section Hardware and Software Requirements in the Sun J ava System A pplication Server Release Notes for specic memory recommendations for each supported operatin[...]

  • Page 95

    Solaris 10 Platform-Specic T uning Informa tion Solaris TM Dynamic Tracing (DTrace) is a comprehensive dynamic tracing framework for the Solaris Operating System (OS). You can use the DTrace Toolkit to monitor the system. The DTrace Toolkit is available through the OpenSolaris TM project from the DTraceToolkit page ( http://www.opensolaris.org/o[...]

  • Page 96

    T ABLE 5–1 Tuning Parameters for Solaris (Continued) Parameter Scope Default Tuned V alue Comments 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 trac web sites, lower this value. tcp_rexmit_interval_[...]

  • Page 97

    F ile Descriptor Setting On the Solaris OS, setting the maximum number of open les property using ulimit has the biggest impact on eorts to support the maximum number of RMI/IIOP clients. To increase the hard limit, add the following command to /etc/system and reboot it once: set rlim_fd_max = 8192 Verify this hard limit by using the followin[...]

  • Page 98

    echo 262143 > /proc/sys/net/core/rmem_default #above configuration for 2.4.X kernels echo 4096 131072 262143 > /proc/sys/net/ipv4/tcp_rmem echo 4096 13107262143 > /proc/sys/net/ipv4/tcp_wmem #disable " RFC2018 TCP Selective Acknowledgements, " and " RFC1323 TCP timestamps " echo 0 > /proc/sys/net/ipv4/tcp_sack echo 0[...]

  • Page 99

    Some of the values depend on the system resources available. After making any changes to /etc/system , reboot the machines. F ile Descriptors A dd (or edit) the following lines in the /etc/system le: set rlim_fd_max=65536 set rlim_fd_cur=65536 set sq_max_size=0 set tcp:tcp_conn_hash_size=8192 set autoup=60 set pcisch:pci_stream_buf_enable=0 Thes[...]

  • Page 100

    T uning for Linux platf orms To tune for maximum performance on Linux, you need to make adjustments to the following: ■ “File Descriptors” on page 100 ■ “Virtual M emory” on page 101 ■ “Network I nterface” on page 102 ■ “Disk I/O Settings” on page 102 ■ “TCP/IP Settings” on page 102 F ile Descriptors You may need to in[...]

  • Page 101

    cputime unlimited filesize unlimited datasize unlimited stacksize 8192 kbytes coredumpsize 0 kbytes memoryuse unlimited descriptors 1024 memorylocked unlimited maxproc 8146 openfiles 1024 The openfiles and descriptors show a limit of 1024. To increase the limit to 65535 for all users, edit /etc/security/limits.conf as root, and modify or add the no[...]

  • Page 102

    Netw ork Inter face To ensure that the network interface is operating in full duplex mode, add the following entry into /etc/rc.local : mii-tool -F 100baseTx-FD eth0 where eth0 is the name of the network interface card (NIC). Disk I/O Settings ▼ T o tune disk I/O per formance f or non SCSI disks T est the disk speed. Use this command: /sbin/hdpar[...]

  • Page 103

    Add the follo wing to /etc/sysctl.conf # Disables packet forwarding net.ipv4.ip_forward = 0 # Enables source route verification net.ipv4.conf.default.rp_filter = 1 # Disables the magic-sysrq key kernel.sysrq = 0 net.ipv4.ip_local_port_range = 1204 65000 net.core.rmem_max = 262140 net.core.rmem_default = 262140 net.ipv4.tcp_rmem = 4096 131072 262140[...]

  • Page 104

    T ABLE 5–2 Tuning 64–bit Systems for Performance Benchmarking Parameter Scope Default Value T uned Value Comments rlim_fd_max /etc/system 65536 260000 Process open le descriptors limit; should account for the expected load (for the associated sockets, les, pipes if any). hires_tick /etc/system 1 sq_max_size /etc/system 2 0 Controls stream[...]

  • Page 105

    Disk C ongura tion If HTTP access is logged, follow these guidelines for the disk: ■ Write access logs on faster disks or attached storage. ■ If running multiple instances, move the logs for each instance onto separate disks as much as possible. ■ Enable the disk read/write cache. N ote that if you enable write cache on the disk, some writ[...]

  • Page 106

    ■ To start the 32–bit Enterprise Server with 4–Mbyte pages, use the following options: LD_PRELOAD_32=/usr/lib/mpss.so.1 ; export LD_PRELOAD_32; export MPSSHEAP=4M; ./bin/startserv; unset LD_PRELOAD_32; unset MPSSHEAP ■ To start the 64–bit Enterprise Server with 4–Mbyte pages, use the following options: LD_PRELOAD_64=/usr/lib/64/mpss.so.[...]

  • Page 107

    T uning for High-A vailability This chapter discusses the following topics: ■ “Tuning H ADB” on page 107 ■ “Tuning the Enterprise Server for High-A vailability” on page 116 ■ “Conguring the Load B alancer” on page 120 T uning HADB The A pplication Server uses the high-availability database (HAD B) to store persistent session st[...]

  • Page 108

    If the database runs out of device space, the H ADB returns error codes 4593 or 4592 to the Enterprise Server. Note – See Sun J ava System A pplication Server Error Message Reference for more information on these error messages. H ADB also writes these error messages to history les. In this case, H ADB blocks any client requests to insert, or [...]

  • Page 109

    Note – hadbm does not add data devices to a running database instance. Placing HADB les on Phy sic al Disks For best performance, data devices should be allocated on separate physical disks. This applies if there are nodes with more than one data device, or if there are multiple nodes on the same host. Place devices belonging to dierent nod[...]

  • Page 110

    P er formance For best performance, all H ADB processes ( clu_xxx_srv ) must t in physical memory. They should not be paged or swapped. The same applies for shared memory segments in use. You can congure the size of some of the shared memory segments. If these segments are too small, performance suers, and user transactions are delayed or [...]

  • Page 111

    ■ FreeSize: free size in MB . ■ Usage: percent used. Use the hadbm resourceinfo command to monitor resource usage, for example the following command displays data buer pool information: %hadbm resourceinfo --databuf NodeNo Avail Free Access Misses Copy-on-write 0 32 0 205910260 8342738 400330 1 32 0 218908192 8642222 403466 The columns in th[...]

  • Page 112

    The log records remain in the buer until they are processed locally and shipped to the mirror node. The log records are kept until the outcome (commit or abort) of the transaction is certain. If the H ADB node runs low on tuple log, the user transactions are delayed, and possibly timed out. T uning LogBuerSize Begin with the default value. L [...]

  • Page 113

    Large BLOBs necessarily allocate many disk blocks, and thus create a high load on the node internal log. This is normally not a problem, since each entry in the nilog is small. T uning InternalLogbuerSiz e Begin with the default value. L ook out for HIGH LOAD informational messages in the history les. The relevant messages contain nilog , and[...]

  • Page 114

    Calculating the number of locks To calculate the number of locks needed, estimate the following parameters: ■ N umber of concurrent users that request session data to be stored in HAD B (one session record per user) ■ Maximum size of the BLO B session ■ P ersistence scope (max session data size in case of session/modied session and maximum[...]

  • Page 115

    For example, the output displayed by this command might look something like this: Node No. Avail Free Waits 0 50000 50000 na 1 50000 50000 na ■ A vail: N umber of locks available. ■ Free: N umber of locks in use. ■ Waits: N umber of transactions that have waited for a lock.“na” (not applicable) if all locks are available. To change the nu[...]

  • Page 116

    For more information on conguring the load balancer plug-in, see “Conguring the HTTP Load Balancer” in Sun GlassFish Enterprise Server 2.1 H igh A vailability Administration G uide . HADB timeouts The sql_client time out value may aect performance. Opera ting Sy stem C ongura tion If the number of semaphores is too low, H ADB can fa[...]

  • Page 117

    T uning S ession P ersistence F requenc y The Enterprise Server provides HTTP session persistence and failover by writing session data to H ADB. You can control the frequency at which the server writes to H ADB by specifying the persistence frequency. Specify the persistence frequency in the A dmin Console under C ongurations > cong-name &[...]

  • Page 118

    Session P ersistence Scope You can specify the scope of the persistence in addition to persistence frequency on the same page in the A dmin Console where you specify persistence frequency, C ongurations > cong-name > A vailability Service (Web Container A vailability). For detailed description of dierent persistence scopes, see Chapt[...]

  • Page 119

    I t is important to pay attention while determining the HTTP session size. If you are creating large HTTP session objects, calculate the H ADB nodes as discussed in “Tuning H ADB ” on page 107 . Checkpointing Stateful Session Beans Checkpointing saves a stateful session bean (SFSB) state to the H ADB so that if the server instance fails, the SF[...]

  • Page 120

    For optimal performance, use a pool with eight to 16 connections per node. F or example, if you have four nodes congured, then the steady-pool size must be set to 32 and the maximum pool size must be 64. A djust the Idle Timeout and P ool Resize Quantity values based on monitoring statistics. For the best performance, use the following settings:[...]

  • Page 121

    ■ interval-in-seconds : Species the interval at which health checks of instances occur. The default is 30 seconds. ■ timeout-in-seconds : Species the timeout interval within which a response must be obtained for a listener to be considered healthy. The default is 10 seconds. If the typical response from the server takes n seconds and unde[...]

  • Page 122

    122[...]

  • Page 123

    Index A A cceptor Threads, 69 access log, 64 A ddrLookups, 62 application architecture, 19 scalability, 24 tuning, 27 arrays, 27 authentication, 21 authorization, 21 automatic recovery, 60 A verage Queuing Delay, 64 B B commit option, 57 bandwidth, 94 benchmarking, tuning Solaris for, 104 best practices, 27 Buer Length, HTTP Service, 66 C C comm[...]

  • Page 124

    deployment settings, 49 tips, 31 deserialization, 27-29 disabling network interrupts, 105 disk conguration, 105 disk I/O performance, 102 disk space, 94 distributed transaction logging, disabling, 59 DNS cache, 61-62 DNS lookups, 62, 67 dynamic reloading, disabling, 50 E EJB components cache tuning, 35-36, 36, 55-56 commit options, 57-58 monitor[...]

  • Page 125

    HTTP Service (Continued) tuning, 64 HTTP sessions, 30 I idle timeout EJB cache, 56 EJB pool, 55 IIOP Client A uthentication Required, 72 IIOP messages, 74-75 Initial Thread Count, HTTP Service, 65 InternalLogbuerSize, 112-113 ip:ip_squeue_bind, 104 ip:ip_squeue_fanout, 104 IP stack, 99 ipge:ipge_bcopy_thresh, 104 ipge:ipge_srv_fo_depth, 104 i[...]

  • Page 126

    monitoring (Continued) transaction service, 58 N N ameLookups, 62 Network A ddress, 69 network conguration, 105 network interface, 102 network interrupts, disabling, 105 NewRatio, 88 NewSize, 88 Node Supervisor P rocess (NSUP), 109 null, assigning, 28 N umberOfL ocks, 113-115 O open les, 97, 101 operating system, tuning, 93-106 operational re[...]

  • Page 127

    session (Continued) timeout, 51 Small/M edium File Size, HTTP le cache, 68 SO AP attachments, 29 Solaris JDK, 85 TCP/IP settings, 95 tuning for performance benchmarking, 104 version 9, 31 sq_max_size, 95, 104 SSL, 21 start options, 105-106 stateful session beans, 42-43, 119 stateless session beans, 43 storing persistent session state, 107 String[...]

  • Page 128

    X x86, 98 XA -capable data sources, 38-39 -Xms, 88 -Xmx, 88 -XX +DisableExplicitGC, 87 MaxH eapFreeRatio, 88 MaxP ermSize, 86 MinH eapFreeRatio, 88 Index Sun GlassFish Enterprise Server 2.1 P er f ormance Tuning Guide • Januar y 2009 128[...]