Title: J2EE Tuning Raiders under the Bea WebLogic Platform
[comment]
Author: zhouhg (dev2dev ID) Summary:
As J2EE software has been widely used in all walks of life, system tuning is increasingly attracted by software developers and application server providers. For end customers, in an efficient, stable implementation of their business needs is their basic requirements. So J2EE tuning is very important, and Bea WebLogic Server is a leading application server in the industry. J2EE tuning under the Bea WebLogic platform is especially important, she will provide us with universal J2EE tuning programs. Recent network, J2EE tuning article in magazine is endless. I also share some experience in my usual work to everyone, and throw bricks.
table of Contents
Preface Chapter 1 Application Tuning 1.1.1 Universal Code Tuning 1.1.2 Decrease Unsupply 1.1.3 Using the appropriate type 1.1.4 Try to use pool, buffer and cache1.2 JDBC code tuning 1.2.1 Strict resource use 1.2.2 Practical skills 1.2.3 Optimize SQL statement 1.3 Web Code Tuning 1.3.1 HttpSession 1.3.2 JSP code tuning 1.3.3 Servlet code tuning 1.4 JMS code tuning 1.4.1 pay necessary Matters, avoid using unnecessary feature 1.4.2 Selection of message type 1.4.3 Confirmation mode selection and JMS transaction 1.5 EJB code tuning 1.5.1 Effective use design mode 1.5.2 Using EJB and WebLogic features 1.5.3 cache Resources 1.5.4 How to choose and use some small skills for other small skills 2 Application Server Tuning 2.1 JVM Tuning 2.1.1 Garbage Collection and Heap Size 2.2 JROCKIT Tuning 2.2 Server Tuning 2.2.1 Try to Using local I / O libraries 2.2.2 Adjustment Default execution thread number 2.2.3 Adjust connection parameters 2.2.4 Creating a new execution queue 2.3 JDBC Tuning 2.3.1 Adjustment connection pool configuration 2.4 Web Tuning 2.4.1 Adjustment Web application description 2.5 JMS Tuning 2.6 EJB Tuning 2.6.1 Adjusting Pool and Cache2.6.2 Optimized Transaction Isolation Level and Transaction Attributes 2.6.3 Other Tips Chapter III Database Tuning 3.1.1 Oracle Performance Optimization 3.1.2 Oracle Other Adjusting Chapter 4 Operating System Tuning 4.1 Operating System Adjustment 4.1.1 HP-UX4.1.2 Solaris4.1.3 AIX4.1.4 Linux4.1.5 Windows Chapter 5 Performance Monitoring and Performance Analysis 5.1 Performance Bottle Neck 5.2 Operating System Monitoring 5.3 Database Monitoring 5.4 WebLogic Monitoring 5.4.1 JVM Monitor 5.4.2 Console Monitoring 5.4.3 Practical Tool Analysis 5.5 Application Analysis Summary Reference About the author
Preface (catalog)
As J2EE software has been widely used in all walks of life, system tuning is increasingly attracted by software developers and application server providers. For end customers, in an efficient, stable implementation of their business needs is their basic requirements. So J2EE tuning is very important, and Bea WebLogic Server is a leading application server in the industry. J2EE tuning under the Bea WebLogic platform is especially important, she will provide us with universal J2EE tuning programs. Recent network, J2EE tuning article in magazine is endless. I also share some experience in my usual work to everyone, and throw bricks. This article analyzes the system tuning from the J2EE application architecture (below), first we generally go to the application, to review the code, do the code level optimization, then adjust the application server (BEA WebLogic8.1) and database ( Oracle9i's parameters, which will of course be the performance of the operating system and network (including hardware upgrade). It is true that in many of the projects I have encountered, they have seen tuning after performance issues, and generally do system parameters adjustment. I can't solve the code. In fact, we should take the code. Level Tune is placed in the application design, and the modification of the code will be an extremely painful thing when testing production.
WebLogic platform J2EE application architecture first chapter application tuning (directory) 1.1.1 Universal code Tuning 1.1.2 Reduce Universal Operation Objects is a very expensive job, so we should try to reduce the creation of objects, Declare it when you need it, initialize it, don't repeat an object, try to use it again, and use the back null facilitates garbage collection. Let the class implement the Cloneable interface, using factory mode, will reduce the creation of classes, each time through the clone () method to get the object. Additional interface can also reduce the creation of classes. Initialization for member variables should also be avoided, especially when a class is derived. Abnormal throwing is unfavorable. Throw an exception first to create a new object. The constructor of the throwable interface is called, the native method of FillInstackTrace (), and the FillInstackTrace () method checks the stack to collect the trace information. As long as there is an abnormality being thrown, the VM must adjust the calling stack because a new object is created during the processing. An exception can only be used for error processing, and should not be used to control the program process. In addition, it is recommended to turn off the DEBUG output, try to use serialization, synchronization operation, and time-consuming service (such as Date ()). 1.1.3 Using the appropriate type When the original type does not meet our requirements, use complex types. The difference between String and StringBuffer does not have to be said, it is our most type, which is strongly recommended to use StringBuffer when it involves character operation. Use INtern () instead of equal when doing String matches. Classes with Final modifiers are unborn, if a class is specified for Final, all methods of this class are Final. The Java compiler looks for the opportunity to inline all Final methods, which will enable performance by 50% average. The properties and methods of classes are also beneficial to use Final or Static modifiers. The parameters passed when calling the method and the temporary variables created in the call are saved in the stack, and the speed is faster. So try to use local variables. ArrayList and Vector, HashMap and HashTable are class we often use, the former does not support synchronization, the latter supports synchronization, the former performance is better, and most cases choose the former. 1.1.4 Try to use pool, buffer and cache using pool, buffer, and cache to greatly improve the performance of the system, which is suitable in most of J2EE. In WebLogic, a large number of pools: JDBC Connection Pool, Socket Pool, Object Pool and Thread Pool. In an I / O operation, buffer is a must, especially for large files, otherwise easy to cause memory overflow. The BUFFERED FileoutputStream is fast than Buffered FileoutPutStream than Buffered FileWriter as possible because FileWriter needs Unicode to Byte's conversion because FileWrit is required. The JDBC, JSP, EJB and JMS mentioned later we have also recommended use buffer and cache. Set buffersize for HttpservletResponse, use WL-Cache, cache objects obtained on the JNDI tree, and more. In addition, non-blocking I / O using JDK 1.4 has greatly improved performance. 1.2 JDBC code Tuning 1.2.1 Strict resources Using JDBC code Tuning is the use of WebLogic's connection pools instead of their own direct connection database. In my own project, I have encountered the problem of connecting the pool, most of the problem of deadlock and connection leaks, and finally do not modify the code. WebLogic provides powerful and well-performance database connection pools. We have to do just to encapsulate a connection management class, get the data source and cache on the JNDI tree, get a connection, and provide a range of shutdown database resources. The principle for any resource is used to finish closing, whether it is a database resource, context environment, or a file. The leakage of the database resource is very easy to cause memory leaks, and even the system crashes.
After using the database resource, close the resultSet, Statement, and Connection, and pay special attention to the resulting RESUTSET and STATEMENT in one database operation multiple times in a database connection. try {// open connection pstmt = conn.prepareStatement (strSql1); pstmt.executeUpdate (); pstmt.close (); pstmt = conn.prepareStatement (strSql2); rs = pstmt.executeQuery (); while (rs.next ( )) {// process}} (); pstmt.close ();} catch (Exception E) {// Close RS, PSMT, Con} finally {// close RS, PSMT, CON} 1.2.2 Practogram Tips also have some small skills in JDBC operations. Since the default automatic submission mode is obtained, use Connection.SetAutoCommit (False) to turn off automatic submission, using preparedstatement, bulk update, business complex or large data amount operation Store procedures, try to use RowSet, and setup collection cache FetchSize and setting record set Reading directions FetchDirection also has certain improvements to performance. 1.2.3 Optimization of the SQL statement SQL statement involves the knowledge of many databases, requires cooperation with the index, so you need DBA to check the SQL in the code. Common, select * does not advocate use, the efficiency is extremely efficient, it is recommended to explicitly obtain columns, even if all fields should also be columns, and use count (*) when taking the total, to improve the hit rate of Cache, try to do SQL reuse. For large data quotes, you can take advantage of the characteristics of the Oracle database, and take out the data of the M-N row, implement the paging query. In addition, improve performance is that all character data is saved as Unicode, and Java processes all data in Unicode, so the database driver does not have to perform a conversion process. 1.3 Web Code Tuning 1.3.1 HttpSession Use the application server to save a lot of sessions, it is easy to cause insufficient memory, so try to reduce the use of session, the object in the session should not be a big object, preferably a simple small object, implement strings Putting the interface. When the session is no longer needed, you should call the invalidate () method to clear the session in time. When a variable does not need, timely call the removeAttribute () method to clear the variable. Do not place the EJB object in the session. 1.3.2 JSP Code Tuning Currently, there are two ways to introduce external resources in the JSP page: include instructions, and include Actions. Include instruction: For example <% @ include file = "Copyright.html"%>, which introduces the specified resource when compiling. Before compiling, the pages with the include instructions and the specified resources are merged into one file. The referenced external resource is determined when compiling is more efficient than running. Include Action: For example
However, only when the referenced content is frequently changed, or before the request is not determined before the request for the main page does not appear, use the include action. For JSPs that do not have the need to track session status, the automatically created session can save some resources. Use the following page instruction: <% @ page session = "false"%>; try not to define the JSP page as a single thread, should be set to <% @ page isthreadsafe = "true"%>; best using the output cache in the JSP page Function, such as: <% @ page buffer = "32KB"%>; try to cache static or relative static content, cache JSP: The result of the application can significantly improve the operation performance of the application. 1.3.3 Servlet Code Tuning Servlet Code Tuning is relatively simple: Time walking between servlets, forward is more efficient than Sendredirect; set HTTPSERVLETRESPONSE buffer, such as: response.setBuffersize (20000); cache static in the init () method Data, and release it in DESTROY (); it is recommended to use the SERVLETOUTPUTSTREAM to output a picture in the servlet; avoiding the customary transaction in servlet and JSP. 1.4 JMS Code Tuning 1.4.1 Note the necessary matters to avoid the use of unnecessary feature JMS to provide a powerful message processing mechanism, but in order to maximize the performance of the JMS system, avoid the use of unwanted features, at the same time Pay attention to the necessary matters. For example: try to use the easiest and smallest message type directly using the receiving program; the message selector should be as simple as possible (it is best not to use), try not to use complex operators such as Like, IN or BetWeen, use characters The speed of string data is the slowest speed; be sure to define a specific JMS connection plant, and disable the default JMS connection factory; do not use the JAVAX. * With WebLogic. * Names in the namespace of WebLogic. * Try to use asynchronous consumption Those, the thread does not have to block the arrival of the message; pay attention to the closure after using the resources on the JNDI tree. 1.4.2 Selection Standard JMS for Message Types provides five messages, and the TextMessage application is most common. When the message sent is a collection of several raw data types, it is best to use the MapMessage message type, not to use ObjectMessage for Reduce coupling between different systems. In addition, the message uses compression to carefully consider, and compression does not necessarily reduce the message size. If the producer, consumers and destination are inserted inside the same WebLogic Server, it is usually not used. WebLogic unique XMLMessage can provide embedded support for a message selector running on the message main body, and is easy to exchange. Therefore, it is recommended to transfer messages between applications use XML message format, and interior of the application uses a binary message format. 1.4.3 Confirmation Selection and JMS Transaction When using a transaction session, try to use the appropriate message confirmation: If the requirements are allowed, use no_ackknowledge; non-lasting subscribers use DUPS_OK_ACKNOWLEDGE or MULTICAST_NO_ACKNOWEDGE. Use JTA's useertransaction, the confirmation method will be ignored. When using JMS transactions, invalid messages will cause the transaction to roll back, so that the message is retransmitted. At this point, the invalid message can be sent to the error message queue and submit the JMS transaction, which will ensure that the message will not be passed again.
1.5 EJB Code Tuning 1.5.1 Effective Use Design Mode GOF "Design Mode" provides our high performance, easy-to-extend J2EE applications to provide theoretical guarantee and technical support. EJB as the core components and technologies of J2EE, and the use of design patterns has a great impact on system performance. Service Locator and Value Object have been familiar with us, and the design models such as "EJB DESIGN PATTERNS" in "EJB DESIGN PATTERNS" are designed to provide us with design model: cache pair EJBHOME access; use facade mode, not exposing Entity Beans, encapsulating entity beans with session beans; if you can process it asynchronously, use MDB instead of session bean; package business logic in light level JavaBean; use value objects, etc. Simple object delivery data Do not use the GET / SET method to operate the Entity Bean. Of course, excessive models or intensive models are not advocated. The general principle is to reduce network traffic and improve transaction management. 1.5.2 Features using EJB and WebLogic use EJB and WebLogic new features often improve performance. Tips related to EJB2.0 are: an application using local interfaces, for Entity Beans, to use local interfaces, avoid overhead of remote calls; use CMP management relationships, rather than BMP, and the performance of CMP in EJB2.0 is greatly improved. Performance and portability are better than BMP; use EJBSELECT to perform internal queries; use Home methods to perform external query and batch; database driver level deletion, etc. Tips related to WebLogic feature are: Use the automatically generated primary key, WebLogic provides automatic generating primary key function for the CMP for Oracle and SQLServer two databases, saving the time of entity beans to generate primary keys, and setting key-cache-size is not less than 100; WebLogic's performance is better, using container management, rather than bean management transactions; WebLogic provides a great help for CMP dynamic queries and batch insertion features. 1.5.3 Cache Resource For SLSB or MDB, use the setmessagedrivencontext () or ejbcreate () method to cache specific resources, release in the ejbremove () method; for SLSB or MDB, use setsessionContext () or ejbcreate () method to cache Specific resources are released in the ejbremove () method; for the Entity Bean, use the setentityContext () method to cache specific resources and release it in the unstentityContext () method. 1.5.4 How to choose and use ENTITY BEAN 1. When designing EJB, you should consider the grain size of EJB, fine-grained EJB is too large in transaction management and resource management, try to create coarse grain size EJB, don't be too thick, thick You can meet the actual needs; 2. Entity bean is not the only way, if only one small data subset is often changed, it is recommended to use JDO; 3. When operating the large data, it is directly used by jdbc than Entity Bean. Effective; 4. Avoid using the Finder method that returns a large data group, such as a FindAll () method, because its implementation is too large; 5. Consider setting domain group Field Groups, reduce unnecessary and expensive attributes, such as blob; 6. For EJB1.1 or BMP, you can set the is-modified-method-name property. Determine whether or not to call EJBStore () according to the value of ismodified (), and reduce unnecessary operations; 7. Avoid connecting multiple tables to create BMP You can use views, stored procedures, or O / R mapping, etc.
1.5.5 Other Tips 1. Consider using the Javax.ejb.Sessionsynchronization interface, provide methods for recovering data after Rollback: afterbegin (), beforecompletion (), aftercompletion (); 2. After using SFSB, call Remove ( Method release example; 3. If you don't need EJB services, it is recommended to use a normal Java class; 4. Avoid call between EJBs; 5. Use multiple read mode. Chapter 2 Application Server Tuning (Catalog) 2.1 JVM Tuning 2.1.1 Waste Collection and Heap Size Waste Collection (GC) refers to the process of the memory occupied by the Objects that are no longer used in the Java bile, while Java stack ( HEAP) refers to the space of the Java application object. The heap size determines the frequency and time of the GC. The larger the heap, the GC frequency is low, and the speed is slow. The smaller the heap, the GC frequency is high, and the speed is fast. So the GC and heap size are a group of contradictions. To get the ideal HEAP heap size, you need to use the -verbosegc parameter (Sun JDK: -XLoggc:
2.2 Server Tuning WebLogic Server consists of listening threads, socket multiplexers, and executable queues of executive threads. When the server receives the connection request by the listener thread, it will give the connection control to the socket multiplexer waiting for the reception request. Then, the socket multiplexer reads the request from the socket and puts this request and related security information or transaction environments into the appropriate queue (generally the default execution queue). When a request appears in the execution queue, there will be an idle execution thread to take the request from the queue, and return answers, then wait for the next request. Therefore, we must improve the performance of WebLogic, you must start from the performance of the adjustment core component. 2.2.1 Try to use the local I / O library WebLogic Server has two sets of socket multiplexers: Java version and local libraries. It is more efficient to use a small local library, try to activate Enable Native IO (default), at which point UNIX uses CPUS 1 thread by default, and Windo is double CPU. If the system does not load the local library, Java.lang.unsatisfiedLinKexception will only be used, and only the Java socket multiplexer can be used to adjust the Socket Readers, and the default is 33%. This parameter can be set in the Console Server Tuning Configuration configuration bar. 2.2.2 Adjustment The default execution thread is ideal for the number of threads is determined by many factors, such as machine CPU performance, bus architecture, I / O, operating system process schedule mechanism, and JVM thread scheduling mechanism. The default thread is 25 in the WebLogic production environment. As the number of CPUs increases, WebLogic can almost linearly improve the number of threads. The more threads, the more time spent on thread switching, the smaller the number of threads, and the CPU may not be fully utilized. In order to obtain an ideal thread number, it needs to be repeated. In the test, it can be adjusted as a 20 * CPUS. When the idle thread is small, the CPU utilization is relatively low, and the size of the thread can be appropriately increased (each five increments). For PC Server and Window 2000, it is preferred that each CPU is less than 50 threads, preferably from about 90% in CPU. Since the current WebLogic execution thread does not narrow the number of threads, the parameters Threads Increase should be set to 0, and the size of the priority should not be changed. 2.2.3 Adjusting the Connection Parameters WebLogic Server Use the Accept Backlog Parameters to specify the queue size requested by the server to the operating system, the default value is 50. When the system is overloaded, this value may be too small, and the log is reported to the valid connection request, which can be rejected, which can improve the Accept Backlog 25% until the connection refusal to errors disappear. For Portal types, the default value is often not enough. Login Timeout and SSL Login Timeout parameters represent the timeout time of normal connections and SSL connections, if the client connection is larger than the server interrupt or SSL capacity, you can try to add this value. These parameters can be found in the Console Server Tuning Configration configuration bar. 2.2.4 Creating a new execution queue Creating a new execution queue helps to solve the core business priority to avoid problems such as cross-blocked, deadlocks, and long-term processes. It is usually different from your own execution queue and the default execution queue, where priority should not be set to 9 or 10. Defining a new execution queue is easy to use the Configure a New Excute Queue link in the View Excute Queue option to customize new execution queues. After creating a new execution queue, the user needs to configure allocation policies for the application's J2EE component so that it can find new queues. For example: To bundle the servlet or JSP to a specific execution queue, you must replace the web.xml file entry, set the WL-Dispatch-Policy initialization parameter to your own execution queue name.
2.5 JMS Tuning 1. Add -Dweblogic.jmsthreadPoolSize = n (at least 5) to increase the number of threads that process JMS, add -xxenablefatspin on JROCKIT to reduce lock conflicts; 2. Using file storage policies, write a synchronous write policy Set to Direct-Write, simultaneously enable disk write cache on the Windows platform; 3. When using distributed destinations, activate the connection plant LOAD BALANCING Enabled, Server Affinity Enabled; 4. To reduce the unnecessary JMS request route, if There is a transaction between multiple destinations, and the deployment is on the same JMS server, try to deploy the connection plant to the WebLogic instance where the JMS server is located, and the connection plant will be deployed to all servers in the cluster. Each JMS server and destination member in the cluster use similar settings as much as possible; 5. Enable message paging storage function to release memory, you can set up the JMS server and destination, activate Messages Paging Enabled and Bytes Paging Enabled, using the limit Prevent server from exhausting all available memory spaces for receiving messages; 6. Producer must use stream control outside of the WEBLogic Server process, and increase send timeout; 7. Set great value for JMS Server Expiration Scan Interval, Proactively scan expiration message; 8. Use FIFO or LIFO mode to process destination messages; 9. MDB max-beans-in-free-pool should not be greater than the maximum number of MDB threads (default thread number / 2 1). 2.6 EJB Tuning 2.6.1 Adjusting Pool and Cache Initial-Beans-in-Free-Pool Defines the number of instances of the SLSB startup, default is 0, which can be queried to normal and raised the size to reduce the initial response time. Max-beans-in-free-pool is the maximum number, default 1000 for SLSB, is very helpful in the case of frequent creation and deletion of instances, generally do not adjust, at least the number of default threads, too much easily cause memory overflow. For Entity Bean, because of anonymous, it can be protected when using the Finder, Home, and Create methods frequently. For SFSB, try to set the max-beans-cache parameter to meet the requirements of the BEAN instance on the maximum number of concurrent users, avoid excessive passivation behavior of state session beans. Idle-Timeout-Seconds is small as much as possible, and if the SFSB is not used to store the web application session state to 0. For Entity Beans, Max-Beans-in-Cache can also first adopt the default value 1000, monitor instance caches and passivation, and then properly adjust. Parallel Policy Concurrency-Strategy Defines how entity Bean manages locks, there are four strategies: Exclusive, Database, Readonly, Optimistic. Efficiency is in turn, reliability is lowered, try to avoid using a mutex, if Bean does not need to update the operation, use a read-only policy, more even, if the content of Bean does not change, set read-timeout-seconds is 0, Optimistic Parallel Policy Adopt Transaction Cache Policy, set the cache-between-transactions element to true in the Entity-Cache descriptor. 2.6.2 Optimizing transaction isolation levels and transaction attributes For EJB components, there are four transaction isolation levels: Transaction-Serializable: Reject other processing, scalability, or insert data operation before processing is completed; Transaction-RepeAtable Read: Preventive modification is being used by other processing calls; transactoin -read-committed: Prevents writing locking of data being modified by other processing; Transaction-read-uncommitted: Allows processing unsolved data and allowing The process can be ignored when the recording is added.
The above isolation level is reducing, efficiency and performance in turn. Therefore, it is recommended to select the lowest isolation level that satisfies the premise of business data integrity. The same is true for the settings of the transaction attribute. For deletion, modification, and insert operations are set to Required, which is set to Supports or Notsupports for read-only operations. 2.6.3 Other Tips 1. Use the default value of Finders-load-beans to avoid "N 1" query problem, and improve the performance of the system; 2. Use delay-updates-untricil-end- The default value of the OF-TX parameter is true, unless the application has special requirements for certain changes; 3. The application does not need to perform existence check after each business method is called, set the check-exists-on-method to False to improve the performance of the program; 4. In the same application, set enable-call-by-reference to true; 5. Reentrant is set to false to avoid loading sub-data in advance. Chapter III Database Tuning (Catalog) 3.1.1 Oracle Performance Optimization Oracle9i Performance Optimization In addition to adjusting Kernal, the adjustment of Oracle startup files is mainly adjusted, that is, the parameters of the SGA. Note that the optimal parameters of the machine of different digits of different operating systems are not the same, which mainly have Windows and UNIX points, 32-bit, and 64-bit points. First, you need to massify the number of processes and cursors. Generally, the default value is relatively small for practical applications. For example, the number of processes can be adjusted to 300, and the number of cursors can be adjusted to 500. Second, look at an empirical formula: OS uses memory SGA session * (sort_AREA_SIZE HASH_AREA_SIZE 2M) <0.7ram, usually considered to be reasonable at this time. Here sort_area_size is 64K, hash_area_size is 128K (when you need more sort_area_size, calculate the adjusted value), the session indicates the maximum number of concurrent processes, assumes 100. If the machine, the OS occupies 200m, the PGA occupies about 200m, then the SGA can be set to 400-500m, and if 2G memory can be 1G to SGA, 8g can be 5g to SGA. However, for 32-bit databases, you usually use only 1.7G memory. Then, the basic principles of the parameter setting in the SGA are: Data Buffer usually can be as large as possible, Shared_Pool_SIZE must be moderate, log_buffer is usually larger than a few hundred k to 1m. Specific: Data Buffer 1G memory can be set to 500M, 2G set to 1.2G, 8G can be set to 5G. Shared_pool_size is not too large, usually should be controlled in 200M - 300M, if a large number of stored procedures can be used, can be increased to 500m according to the value of SGA, and if the increasing hit rate is not improved, the increase is nothing. Specific: 1G memory can be set to 100m, 2G is set to 150m, and 8G can be set to 300m. If Java_Pool_Size is not used, Java_Pool_Size 10-20M can be used. Large_pool_size If the MTS is not set, it can be considered as session * (sort_AREA_SIZE 2M) if the MTS is set, if the MTS is set. Finally, the memory settings can be considered according to the status information and V $ SYSTEM_EVENT, V $ SYSSTAT, V $ SESSSTAT, V $ Latch, and other View information. 3.1.2 Other adjustments to Oracle For Oracle's high efficiency operation, in addition to the memory factors mentioned above, there is a good database design: table, view, index, and log of reasonable planning and establishment. The performance of I / O is also an important factor, and page switches and page assignments should be minimized. In addition, it is to improve the efficiency of the checkpoint.
Chapter 4 Operating System Tuning (Catalog) 4.1 Operating System Adjusting Operating System The Factors Affecting Application Run Performance (CPU, Memory, Hard Disk, etc.), core parameters, TCP / IP parameters, and patches . Here, the optimization of the operating system, in addition to updating the latest patches to ensure that the application is running normally, the TCP / IP parameter, the file descriptor is adjusted, and there are other special parameter adjustments for individual operating systems. The following will be described in turn, more information, please refer to the documentation of each operating system. 4.1.1 HP-UX For HP-UX, you first need to install Java Patch: http://www.hp.com/products1/unix/java/patches/index.html, then you need to confirm that the core parameters in the document below Meet (you can use the SAM command to modify the core parameters): http: //e-docs.bea.com/platform/suppconfigs/configs81/hpux11_risc/81sp3.html#80105. Adjust TCP parameters: ndd -set / dev / tcp tcp_conn_req_max 1024 adjusts the maximum allowable length of the listening queue to 1024. Sometimes the maximum amount of memory used by the operating system restriction process is less than the memory size you want to configure, you need to adjust this value. Readers can learn more HP-UX adjustment suggestions from http://docs.hp.com/hpux/onlinedocs/tkp-90203/tkp-90203.html. 4.1.2 Solaris TCP tuning parameters of the waiting period tcp-time-wait-interval is recommended to 60000ms:? / Usr / sbin / ndd set / dev / tcp tcp_time_wait_interval 60000; other parameters are adjusted as follows: tcp_xmit_hiwat / tcp_recv_hiwat 131072tcp_conn_req_max_q / tcp_conn_req_max_q0 16384 Adjusts the number of file descriptors opened by a process: Soft limit and hard limit and the size of the hash table, modify / etc / system file: set tcp: tcp_con_hash_size = 32768set rlim_fd_cur = 8192set rlim_fd_max = 8192 More Adjustment Information Please consult: http://docs.sun.com/db/doc/806-7009(Solaris9). 4.1.3 AIX AIX Adjust the TCP parameters with no command, waiting time interval TCP_TIMEWAIT: no -o tcp_timewait = 4, set the tcp.timewait parameter to 4 15 seconds, 1 minute. Run the no -a command will display all the current property values. Since UDP_SendSpace default cache size is 8K, in order to reduce I / O exception, adjust to 32K: no -o udp_sendspace = 32768. In addition, when WebLogic HTTP is busy, you can adjust the maximum SomaxConn to 8192 of the listening queue (the default value is 1024). More information: http: //publib16.boulder.ibmo.com/pseries/en-us/aixbman/prftungd/prftungd.htm. 4.1.4 Linux Adjustment Linux System Using the SysctL Command Modify TCP Parameters Waiting Time Interval: SysctL -w ip_ct_tcp_timeout_time_wait = 60; Adjust the maximum number of open files: In the /etc/sysctl.conf file, add: fs.file-max = 65535 , Then run sysctl -p; adjust to open file descriptor Maximum number 8192: In /etc/security/limits.conf file, add: WebLogic Hard Nofile 8192 (for WebLogic users), then run ULimit in the WebLogic boot file- N 8192 activates the setting. For more information, please check: http://ipsysctl-tutorial.frozentux.net/ipsysctl-tutorial.html.
4.1.5 Adjustment of the Windows Windows system is done by modifying the registry HKEY-LOCAL-MachineSystemCurrent ControlsetServices folder. You can adjust the value of the waiting time interval in the TCPIPArameters subfolder. Value of the TCPTIMedWaitDelay parameter. The default value of the listening queue is 15. To modify it, you can create a DWORD entry listenbackLog in the INetInfoparameters subdirectory. In addition, Windows2000 Service Pack also affects system stability: http://e-docs.bea.com/platform/suppconfigs/configs81/win2ksvr_as_data_pentium/81sp3.html. Chapter 5 Performance Monitoring and Performance Analysis (Table of Contents) 5.1 Performance Bottleneck Finally, introduce common commands and tools for practical analysis of J2EE application performance. For a high-performance J2EE application, the theoretical experience of J2EE tuning is still not enough. Master performance monitoring, find bottlenecks and problem diagnosis is the key to ensuring that the J2EE system continues to run efficiently. Bottlenecks refer to all of the limitations of all throughput operations and serious affect the response time. It is very difficult to find and correct bottlenecks in a distributed system, and experienced teams need to solve. Bottlenecks happen on the web server, in the program code, on the application server, database, operating system, and network, hardware. Experience shows that bottlenecks are easily happening: Database connection and queue; application server program code; application server and web server hardware; network and TCP configuration. These links can be monitored in practice. 5.2 Operating System Monitoring The performance monitoring of the operating system level is mainly to monitor the usage of memory, CPU, I / O, and switching zones. The Windows platform can be viewed by the task manager and the Perfmon tool. If the UNIX system can use the STAT series command (VMSTAT, MPSTAT, IOSTAT) to monitor memory, CPU, and I / O instant changes, use the SWAP command to view the use of the switching area. If the operating system is equipped with Top, Topas, Glance, use Top, Topas, Glance will easily see the instant change in the WebLogic process to the operating system's memory, CPU, and I / O resource. The network performance can be monitored by ping and netstat, such as packet re-send, duplicate packets, and data package nozzles. Note: The UNIX command mentioned herein is not applicable to all operating systems for reference only. 5.3 Database Monitoring Database Terminal Monitoring This is ORACLE9I as an example, which can use Oracle Interprise Manager Console with Oracle Oracle Interprise Manager Console to monitor the execution of session and SQL. There are other professional database monitoring tools that can be used, such as Spotlight (http://www.quest.com/spotlight-portal/) can be very image and intuitively to the CPU, memory, I / O, DATA of Oracle database. Buffer Size, Shared Pool Size, Redo Buffer and other parameters for instant monitoring, and automatically displays unattractive parameters in red. 5.4 WebLogic Monitoring 5.4.1 JVM Monitoring Adoption Java Parameters - Verbose: GC to analyze the JVM GC is very cumbersome, and it is not intuitive. Use the -xloggc: gc.log parameter to write the GC log into the file, using the GC tool hpjtune (http://www.javaperformancetuning.com/tools/hpjtune/index.shtml), you can easily see if the current JVM parameter configuration is reasonable. In strict sense, HPJTUNE is an analytical tool that is not a monitoring tool.
Here, the fastest JVM on the JROCKET, the Intel platform, add -XManagement parameters in the WebLogic boot command, you can perform the console command monitoring WebLogic's memory usage and CPU loads under the WebLogic boot command. To set the Mode of Operation property in the Tools / Preferences menu to developer, JRocket will provide the Method Profiler tool, which can make all the number of members of the member method executed on the JRockit Java virtual machine, the total time to execute, and each call execution time Statistics, code-level tuning, this is another great advantage of JROCKIT. 5.4.2 Console Monitoring WebLogic Console provides a wealth of monitoring features in addition to management configuration. Through WebLogic Console, first we can view the run of the server. 5.4.2.1 Server Monitoring By using the server's Performance Monitoring tab, you can check the request throughput, the execution queue volume pressure, and the JVM stack utilization. The current statistics of threads can be performed by clicking on "Monitor All Active Queues ..." in the Performance Genaral tab. In addition, the Monitoring tab can also monitor the case of service such as JTA and JMS.
5.4.2.2 JDBC Monitoring In the Connection Pool Monitoring tab, WebLogic Console provides real-time statistics for each database connection pool. Three of these important parameters can react to the health of WebLogic Server: Connections High, Wait Second High and Waiters High. Connection High Indicates that the maximum number of connections to the pool after starting from the server, if the maximum number greater than the pool, you need to adjust Maxium Capacity. Waiters HIGH indicates that the application waits for the maximum number of connections in the case where there is no connection. We can adjust the connection pool capacity based on the size of Waiters High. More parameters can be added to the Customize this View link, parameter meanings reference: http: //e-docs.bea.com/wls/docs81/consoleHelp/Domain_jdbconnectionPool_Monitor.html# 11104829.5.2.3 Web Monitoring Web Application Monitoring tab You can monitor the number of SESSION numbers for web applications, as well as the SERVLET's response, and activate the session monitoring enabled to get the statistics of all session. For more information, please refer to: http: //e-docs.bea.com/wls/docs81/consoleHelp/web_applications.html #1106723.5.4.2.4 JMS monitoring Welogic Console JMS monitoring function is more, not only in Server JMS Monitoring tab You can monitor the connection and usage of Active JMS Connections, Pooled JMS Connections, and Active JMS Servers. You can also monitor the consumption and production of JMS Session Pool, Active JMS Destinations, and Durable Subscribers. For example, we can monitor the number and byte number of JMS Queue's reception and consumption messages. See: http://edocs81/consolehelp/JMS_Monitor.html can be found in the details of JMS monitoring. 5.4.2.5 EJB Monitoring EJB Monitoring includes monitoring of four EJBs of SLSB, SFSB, Entity Bean, MDB. I believe that EJB monitoring provides a very rich runtime statistics (http://e-docs.bea.com/wls/docs81/consolehelp/eb.html# 11105036), which is very beneficial to perform performance tuning for EJB. The SLSB tab provides the user with the runtime statistics of the instance pool. Pool Miss Ratio represents the MISS rate of the instance pool, and the pool waiter Total Count indicates the cumulative time of the thread waiting for the bean instance, and the pool timeout total count represents the timeout number. When Pool Miss Ratio is large, Max-Beans-Free-Pool can be increased. SFSB can focus on Cache Miss Ratio and Activation Count. When Cache Miss Ratio is too large, MAX-Bean-in-Cache does not necessarily be helpful, you need to try the Max-Bean-in-Cache that you need to get the lowest Cache Miss Ratio. Activation will severely slow down the speed of the application. If the value of a bean is too high, you need to consider adding the size of the max-bean-in-cache. Entity Bean combines the SLSB Free Pool and SFSB Cache. It can be monitored in conjunction with the above strategy. The MDB is only more than one parameter JMSConnection Alive, and the report EJB is successfully connected to the JMS destination. More console monitoring information can be found at http://edocs.bea.com/wls/docs81/consolehelp/index.html.
5.4.3 Utility Analysis WebLogic In addition to providing console for application monitoring, users can also write JMX programs or monitor through SNMP protocols. Quest Spotlight for WebLogic Server provides a similar monitoring feature similar to WebLogic Console and is red. Here, it has to be mentioned in actual combat THREAD DUMP for analyzing performance bottlenecks, and unified commands use WebLogic.Admin command thread_dump. On Windows, you can also use
About Author (TCE) Zhou Haigen (Dev2DEV ID: Zhouhg) Heiji Software (China) Co., Ltd. Technical Consultant, BEA CERTIFIED Specialist, Bea Dev2dev writer. Many years of engaged in J2EE development work, currently working on technical support, mainly studying J2EE technology in WebLogic application, tuning. There is a pragmatic pragmatic, like special research technology, is a sports fan. Contact: 010-85251858-1053, Zhouhaigen @ Hotmail.com