Академический Документы
Профессиональный Документы
Культура Документы
7 Database Tuning 10
7.1 Collating Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
7.2 changing JCR tables to be not volatile . . . . . . . . . . . . . . . . . . . . 10
B References 18
C Credits 19
i
Preface
This document was written with intent to be a central source for tuning a Websphere
Portal Web Content Management and DB2 environment.
It describes the different parts of the environment that are special to that environment.
It was written by the IBM WPLC Performance Team and IBM Toronto Lab.
The document describes how to tune the Application Server and the WebSphere Portal.
Furthermore it points out various registry variables and several database manager and
database configuration parameters that should be set to the specified values as a good
start.
The ongoing maintenance section is a guideline how to keep the DB2 system perfor-
mant during the growth of the system.
ii
IBM WebSphere Portal Web Content Manager and DB2 Tuning Guide
• Configuring the application server and the resources defined for that application
server
When tuning your individual systems, it is important to begin with a baseline, monitor
the performance metrics to determine if any parameters should be changed and, when a
change is made, monitor the performance metrics to determine the effectiveness of the
change.
http://www.ibm.com/software/webservers/appserv/was/library/
The following are settings, based on our experience with the workloads described in
this document, which differed from those in the IBM WebSphere Portal Version 6.0
Tuning Guide for AIX on the Power4 platform:
While we set the minimum and maximum heap sizes to the same values, this may
not be the best choice for production systems which are running on IBM JDKs. In our
measurement runs, the system is under load for a relatively short time (around 3 hours),
and it is running with portlets which do not have large memory requirements. When
using portlets which will have larger memory requirements, or for continuous operation,
it may be possible to reduce heap fragmentation by setting the initial heap size to 320
megabytes.
After doing any tuning of heap sizes, monitor the system to make sure that paging
is not occurring. As mentioned above, paging can cause poor performance.
vmo -p -o v pinshm=1
chuser capabilities=CAP BYPASS RAC VMM,CAP PROPAGATE $USER
5. Restart Portal Server. To verify if large pages are being used, run the AIX com-
mand vmstat -l 1 5 and check the ”alp” column which is the active large page
used. It should be a non-zero value if large pages are being used.
In release 1.3.1 Service Refresh 7 and above, the Garbage Collector allocates a kCluster
as the first object at the bottom of the heap. A kCluster is an area of storage that is
used exclusively for class blocks. It is large enough to hold 1280 entries. Each class block
is 256 bytes long.
The Garbage Collector then allocates a pCluster as the second object on the heap.
A pCluster is an area of storage that is used to allocate any pinned objects. It is 16 KB
long.
When the kCluster is full, the Garbage Collector allocates class blocks in the pClus-
ter. When the pCluster is full, the Garbage Collector allocates a new pCluster of 2 KB
Because this new pCluster can be allocated anywhere in the heap and must be pinned,
it can cause fragmentation problems. The pinned objects effectively deny the GC the
ability to combine free space during heap compaction and could result in a heap that
contains a lot of free space but in relatively small discrete amounts, so that an allocation
that appears to be well below the total free heap space will fail. To solve this problem,
release 1.3.1 at SR7, and later, provides command-line options to specify the kCluster
(-Xk), pCluster (-Xp) and pCluster overflowsize (-Xp). Use these options to set the ini-
tial sizes of the ’clusters’ to be large enough to avoid fragmentation issues.
For the prepared statement cache size, the path is Resources → JDBC Providers →
provider name → Data Sources → datasource name → WebSphere Application Server
data source properties. The provider name and datasource name are based on the names
selected for that database during the database transfer step. Look for the parameter
Statement cache size.
We set the prepared statement cache size to 1 statement for all Datasources to reduce
the demands on native memory, thus avoiding crashes.
DB2_RR_TO_RS=YES
DB2_EVALUNCOMMITTED=YES
DB2_SKIPDELETED=ON
DB2_INLIST_TO_NLJN=YES
DB2_MINIMIZE_LISTPREFETCH=ON
DB2 RR TO RS This parameter is deprecated since DB2 v8.2. If you don’t get an
error when trying to set the parameter in DB2 higher than version 8.2, it is ok to have
it set. If you get an error, never mind. The next two variables are the replacement for
it.
When DB2 RR TO RS is on, RR behavior cannot be guaranteed for scans on user tables
because next key locking is not done during index key insertion and deletion. Cata-
log tables are not affected by this option. The other change in behavior is that with
DB2 RR TO RS on, scans will skip over rows that have been deleted but not committed,
even though the row may have qualified for the scan.
DB2 EVALUNCOMMITTED When enabled, this variable allows, where possible, ta-
ble or index access scans to defer or avoid row locking until a data record is known to
satisfy predicate evaluation. DB2 EVALUNCOMMITTED is applicable only to statements us-
ing either Cursor Stability or Read Stability isolation levels. For index scans, the index
must be a type-2 index. Furthermore, deleted rows are skipped unconditionally on table
scan access while deleted keys are not skipped for type-2 index scans unless the registry
variable DB2 SKIPDELETED is also set.
DB2 SKIPDELETED When enabled, this variable allows statements using either Cur-
sor Stability or Read Stability isolation levels to unconditionally skip deleted keys during
index access and deleted rows during table access. With DB2 EVALUNCOMMITTED enabled,
deleted rows are automatically skipped, but uncommitted pseudo-deleted keys in type-2
indexes are not skipped unless DB2 SKIPDELETED is also enabled.
DB2 INLIST TO NLJN Sometimes the optimizer does not have accurate information
to determine the best join method for the rewritten version of the query. This can occur
if the IN list contains parameter markers or host variables which prevent the optimizer
from using catalog statistics to determine the selectivity. This registry variable causes
the optimizer to favor nested loop joins to join the list of values, using the table that
contributes the IN list as the inner table in the join.
DB2_REDUCED_OPTIMIZATION=5
Attention: This parameter should only be set when explicitly advised by IBM.
Note: If you need federated database support, you must not set FEDERATED to NO.
APPLHEAPSZ 4096
APP CTL HEAP SZ 1024
STMTHEAP 8192
DBHEAP 2400
LOCKLIST 1000
LOGFILSIZ 1000
LOGPRIMARY 12
LOGSECOND 20
LOGBUFSZ 128
AVG APPLS 5
LOCKTIMEOUT 30
MAXLOCKS 70
MAXAPPLS AUTOMATIC
As the instance user enter the following commands, but change DBNAME to the actual
database name:
DBHEAP 4800
SORTHEAP 4096
APPLHEAPSZ 16384
APP CTL HEAP SZ 20000
STMTHEAP 16384
NUM IOCLEANERS 11
NUM IOSERVERS 11
As the instance user enter the following commands, but change JCRDB to the name of
the JCR database:
7 Database Tuning
Database performance is very important for obtaining good performance from WCM.
The maintenance tasks and practices mentioned here and in the IBM WebSphere Portal
Version 6.0 Tuning Guide were found to be critical to the performance and correct op-
eration of WebSphere Portal in our lab environment. Additional database maintenance
and tuning may be needed in your production environments. For further information on
DB2 administration, tuning, and monitoring refer to the DB2 Information Center.
db2 -v -f "nonVolatile.db2"
These options allow the optimizer to determine optimal access plans for complex SQL.
A simpler, more convenient technique for computing catalog statistics is:
db2 reorgchk update statistics on table all
Not only does this command count and record some of the same catalog statistics,
it also produces a report that can be reviewed to identify table organization issues.
However, we have found instances where this produces insufficient information for the
optimizer to select an efficient access plan for complex SQL, particularly for queries of
the JCR database. We have determined a technique that has the same convenience of
the reorgchk command and provides the detailed statistics preferred by the optimizer.
db2 -x -r "runstats.db2" "select rtrim(concat(’runstats on table’,
concat(rtrim(tabSchema), concat(’.’,concat(rtrim(tabname),
’ on all columns with distribution on all columns and sampled detailed
indexes all allow write access’))))) from syscat.tables where type=’T’"
db2 -v -f "runstats.db2"
Reorganizing all the tables would be over-kill in a production environment. To determine
which tables might benefit from reorganization, use the command:
db2 reorgchk current statistics on table all > "reorgchk.txt"
The tables that need reorganization are indicated by a ∗ in at least one of the three
columns next to the table name. For those tables that require reorganization, use the
command:
db2 reorg table tableschema.tablename
to reorganize the table based upon its primary key.
8.2 Monitoring
Snapshot monitoring is used to identify the behavior of a database over a period of time.
It is further used for fine-tuning the system and finding problems regarding performance.
For snapshot monitoring to work, you need to active the different monitors first. There
are two ways to do this. You can either configure the database manager to activate
monitoring at instance level, or you can turn on monitoring at a specific time for the
current session.
To turn on default monitoring at instance activation or instance level use the follow-
ing command:
monitor value
Note: Since activated monitors increase the utilisation of the CPU, you should activate
all monitors only when needed.
To get the currently activated monitor switches use the following command:
Another way to monitor a DB2 system is db2top. You can get this utility at:
http://www.alphaworks.ibm.com/tech/db2top
Since there is no SYSIBMADM.BP HITRATIO table in DB2 v8, I’ve written two stored
procedures1 , for calculating the buffer pool hit ratio:
You can download the latest version of the stored procedures at:
http://www.evermeet.cx/cvs/db2scripts/
They are installed (after connecting to a database) with the following command:
1
see Appendix A
In DB2 9, you can either use the two stored procedures, or the following SQL statement
to get the buffer pool hit ratio:
An ideal buffer pool hit ratio is above 96%. It would be well worthwhile to increase the
size of the buffer pool and see if the hit ratio increases. If the hit ratio remains low, you
may need to redesign your logical layout of your table spaces and buffer pools.
The size of the buffer pool can be changed online by the following command:
The only service we tuned differently was the Cache Manager Service. For this ser-
vice we accepted the defaults shipped with WebSphere Portal except for the changes
listed in the following table:
BEGIN
DECLARE res CURSOR WITH RETURN FOR
WITH bp_snap (snapshot_timestamp, database, bufferpool, bp_hr, data_hr,
idx_hr, page_clean_ratio )
AS
(
SELECT snapshot_timestamp, SUBSTR(db_name,1,16), SUBSTR(bp_name,1,32),
CASE
WHEN ((pool_data_p_reads > 0 OR pool_index_p_reads > 0) AND
(pool_data_l_reads > 0 OR pool_index_l_reads > 0))
THEN
DECIMAL( ((1-(double(pool_data_p_reads + pool_index_p_reads)/
DOUBLE(pool_data_l_reads + pool_index_l_reads+1)) )*100.0),3,1 )
ELSE
NULL
END CASE,
CAST( (CAST( pool_data_l_reads - pool_data_p_reads
AS DOUBLE)*100.0)/(pool_data_l_reads+1) AS DECIMAL(3,1)),
CAST( (CAST( pool_index_l_reads - pool_index_p_reads
AS DOUBLE)*100.0)/(pool_index_l_reads+1) AS DECIMAL(3,1)),
CAST( (CAST( pool_async_data_writes + pool_async_index_writes
AS DOUBLE)*100.0)/(pool_data_writes+pool_index_writes+1)
AS DECIMAL(3,1))
FROM TABLE(snapshot_bp(’’,-1)) AS BP
ORDER BY 2,3
)
SELECT snapshot_timestamp, database, bufferpool, bp_hr, data_hr, idx_hr
FROM bp_snap;
OPEN res;
END@
BEGIN
DECLARE res CURSOR WITH RETURN FOR
WITH bp_snap (snapshot_timestamp, database, bufferpool, bp_hr, data_hr,
idx_hr, page_clean_ratio )
AS
(
SELECT snapshot_timestamp, SUBSTR(db_name,1,16), SUBSTR(bp_name,1,32),
CASE
WHEN ((pool_data_p_reads > 0 OR pool_index_p_reads > 0) AND
(pool_data_l_reads > 0 OR pool_index_l_reads > 0))
THEN
DECIMAL( ((1-(double(pool_data_p_reads + pool_index_p_reads)/
DOUBLE(pool_data_l_reads + pool_index_l_reads+1)) )*100.0),3,1 )
ELSE
NULL
END CASE,
CAST( (CAST( pool_data_l_reads - pool_data_p_reads
AS DOUBLE)*100.0)/(pool_data_l_reads+1) AS DECIMAL(3,1)),
CAST( (CAST( pool_index_l_reads - pool_index_p_reads
AS DOUBLE)*100.0)/(pool_index_l_reads+1) AS DECIMAL(3,1)),
CAST( (CAST( pool_async_data_writes + pool_async_index_writes
AS DOUBLE)*100.0)/(pool_data_writes+pool_index_writes+1)
AS DECIMAL(3,1))
FROM TABLE(snapshot_bp(CAST(NULL AS VARCHAR(128)),-1)) AS BP
ORDER BY 2,3
)
SELECT snapshot_timestamp, database, bufferpool, bp_hr, data_hr, idx_hr
FROM bp_snap;
OPEN res;
END@
B References
WebSphere Portal Information Center:
http://www.ibm.com/developerworks/websphere/zones/portal/proddoc.html
IBM WebSphere Portal Version 6.0 Benchmark Results and Tuning Guide is available
by request from the WPLC Performance Team.
IBM WebSphere Portal Version 6.0 Document Manager Benchmark Results and Tuning
Guide is available by request from the WPLC Performance Team.
WebSphere Application Server Development Best Practices for Performance and Scala-
bility:
http://www.ibm.com/software/webservers/appserv/ws_bestpractices.pdf
Diagnosing Performance Problems for WebSphere Portal 5.1 (though this document
was written for WebSphere Portal 5.1, the lessons apply to WebSphere Portal 6.0 as
well):
http://www.ibm.com/support/docview.wss?uid=swg27007059
IBM Developer Kit and Runtime Environment, Java(TM) 2 Technology Edition, Version
1.4.2 Diagnostics Guide
http://www-128.ibm.com/developerworks/java/jdk/diagnosis/142.html
C Credits
Thanks to the following team members of the WPLC Performance Team for contributing
to this document.
Andrew Citron
Susan Hanis
Ruthie Lyle
Denny Pichardo
Martin Presler-Marshall
Evan Thompson
Terence Walker
Laura Yen
c Copyright IBM Corporation 2006-2007
The e-business logo, the eServer logo, IBM, the IBM logo, IBM Directory Server, DB2, Lotus, WebSphere,
POWER4 and POWER5 are trademarks of International Business Machines Corporation in the United States,
other countries or both.
Lotus and Domino are trademarks of Lotus Development Corporation and/or IBM Corporation.
Solaris, Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United
States, other countries or both.
Windows and Windows 2003 Enterprise Server are trademarks of Microsoft Corporation in the United States
and/or other countries
Oracle 10 and all Oracle-based trademarks and logos are trademarks of the Oracle Corporation in the United
States, other countries or both.
Other company, product and service names may be trademarks or service marks of others.
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PAPER ”AS IS” WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain trans-
actions, therefore, this statement may not apply to you.
Information in this paper as to the availability of products (including portlets) was believed accurate as of the
time of publication. IBM cannot guarantee that identified products (including portlets) will continue to be made
available by their suppliers.
This information could include technical inaccuracies or typographical errors. Changes may be made periodi-
cally to the information herein; these changes may be incorporated in subsequent versions of the paper. IBM may
make improvements and/or changes in the product(s) and/or the program(s) described in this paper at any time
without notice.
Any references in this document to non-IBM web sites are provided for convenience only and do not in any
manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the mate-
rials for this IBM product and use of those Web sites is at your own risk.
IBM may have patents or pending patent applications covering subject matter described in this document. The
furnishing of this document does not give you any license to these patents. You can send license inquiries, in
writing, to: