Top Banner
JBoss Enterprise Portal Platform 4.3 Tuning Guide A guide to tuning the performance of JBoss Enterprise Portal Platform 4.3. Red Hat Publication date: Jan, 2009
22

JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Sep 19, 2014

Download

Documents

saviosampaio
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

JBoss EnterprisePortal Platform 4.3

Tuning GuideA guide to tuning the performance ofJBoss Enterprise Portal Platform 4.3.

Red HatPublication date: Jan, 2009

Page 2: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Tuning Guide

JBoss Enterprise Portal Platform 4.3 Tuning GuideA guide to tuning the performance of JBoss Enterprise PortalPlatform 4.3.Edition 1

Author Red HatCopyright © 2011 Red Hat, Inc

Copyright © 2011 Red Hat, Inc.

The text of and illustrations in this document are licensed by Red Hat under a Creative CommonsAttribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is availableat http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute thisdocument or an adaptation of it, you must provide the URL for the original version.

Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.

Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the InfinityLogo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.

Linux® is the registered trademark of Linus Torvalds in the United States and other countries.

Java® is a registered trademark of Oracle and/or its affiliates.

XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United Statesand/or other countries.

MySQL® is a registered trademark of MySQL AB in the United States, the European Union and othercountries.

All other trademarks are the property of their respective owners.

This Installation Guide documents tuning of JBoss Enterprise Portal Platform

Page 3: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

iii

Preface v1. Document Conventions ................................................................................................... v

1.1. Typographic Conventions ...................................................................................... v1.2. Pull-quote Conventions ........................................................................................ vi1.3. Notes and Warnings ............................................................................................ vii

2. Give us Feedback ......................................................................................................... vii

1. Overview 11.1. Overview ..................................................................................................................... 1

2. JBoss Web Tuning 32.1. HTTP/AJP connector threads ....................................................................................... 32.2. Global Session Timeout .............................................................................................. 3

3. Hibernate Tuning 53.1. Enable/Disable Lazy Loading ........................................................................................ 53.2. Enable/Disable Query Cache ........................................................................................ 5

4. Identity 74.1. Cache Login Credentials .............................................................................................. 7

5. Clustering Tuning 95.1. Enable Buddy Replication for Portal and Portlet Session Clustering ................................. 95.2. Hibernate and JBoss Cache Configuration ..................................................................... 95.3. Optimistic Locking (OL) ................................................................................................ 95.4. Pessimistic Locking (PL) ............................................................................................... 95.5. Cache Eviction Policy ................................................................................................... 9

6. JVM Tuning 116.1. Use Large Pages ....................................................................................................... 116.2. Garbage Collection (GC) Tuning ................................................................................. 11

A. Revision History 13

Page 4: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

iv

Page 5: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

v

Preface

1. Document ConventionsThis manual uses several conventions to highlight certain words and phrases and draw attention tospecific pieces of information.

In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts1 set. TheLiberation Fonts set is also used in HTML editions if the set is installed on your system. If not,alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includesthe Liberation Fonts set by default.

1.1. Typographic ConventionsFour typographic conventions are used to call attention to specific words and phrases. Theseconventions, and the circumstances they apply to, are as follows.

Mono-spaced Bold

Used to highlight system input, including shell commands, file names and paths. Also used to highlightkeycaps and key combinations. For example:

To see the contents of the file my_next_bestselling_novel in your currentworking directory, enter the cat my_next_bestselling_novel command at theshell prompt and press Enter to execute the command.

The above includes a file name, a shell command and a keycap, all presented in mono-spaced boldand all distinguishable thanks to context.

Key combinations can be distinguished from keycaps by the hyphen connecting each part of a keycombination. For example:

Press Enter to execute the command.

Press Ctrl+Alt+F2 to switch to the first virtual terminal. Press Ctrl+Alt+F1 toreturn to your X-Windows session.

The first paragraph highlights the particular keycap to press. The second highlights two keycombinations (each a set of three keycaps with each set pressed simultaneously).

If source code is discussed, class names, methods, functions, variable names and returned valuesmentioned within a paragraph will be presented as above, in mono-spaced bold. For example:

File-related classes include filesystem for file systems, file for files, and dir fordirectories. Each class has its own associated set of permissions.

Proportional Bold

This denotes words or phrases encountered on a system, including application names; dialog box text;labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:

Choose System → Preferences → Mouse from the main menu bar to launch MousePreferences. In the Buttons tab, click the Left-handed mouse check box and click

1 https://fedorahosted.org/liberation-fonts/

Page 6: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Preface

vi

Close to switch the primary mouse button from the left to the right (making the mousesuitable for use in the left hand).

To insert a special character into a gedit file, choose Applications → Accessories→ Character Map from the main menu bar. Next, choose Search → Find… from theCharacter Map menu bar, type the name of the character in the Search field and clickNext. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the

Copy button. Now switch back to your document and choose Edit → Paste from thegedit menu bar.

The above text includes application names; system-wide menu names and items; application-specificmenu names; and buttons and text found within a GUI interface, all presented in proportional bold andall distinguishable by context.

Mono-spaced Bold Italic or Proportional Bold Italic

Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable orvariable text. Italics denotes text you do not input literally or displayed text that changes depending oncircumstance. For example:

To connect to a remote machine using ssh, type ssh [email protected] ata shell prompt. If the remote machine is example.com and your username on thatmachine is john, type ssh [email protected].

The mount -o remount file-system command remounts the named filesystem. For example, to remount the /home file system, the command is mount -oremount /home.

To see the version of a currently installed package, use the rpm -q packagecommand. It will return a result as follows: package-version-release.

Note the words in bold italics above — username, domain.name, file-system, package, version andrelease. Each word is a placeholder, either for text you enter when issuing a command or for textdisplayed by the system.

Aside from standard usage for presenting the title of a work, italics denotes the first use of a new andimportant term. For example:

Publican is a DocBook publishing system.

1.2. Pull-quote ConventionsTerminal output and source code listings are set off visually from the surrounding text.

Output sent to a terminal is set in mono-spaced roman and presented thus:

books Desktop documentation drafts mss photos stuff svnbooks_tests Desktop1 downloads images notes scripts svgs

Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows:

package org.jboss.book.jca.ex1;

import javax.naming.InitialContext;

Page 7: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Notes and Warnings

vii

public class ExClient{ public static void main(String args[]) throws Exception { InitialContext iniCtx = new InitialContext(); Object ref = iniCtx.lookup("EchoBean"); EchoHome home = (EchoHome) ref; Echo echo = home.create();

System.out.println("Created Echo");

System.out.println("Echo.echo('Hello') = " + echo.echo("Hello")); }}

1.3. Notes and WarningsFinally, we use three visual styles to draw attention to information that might otherwise be overlooked.

Note

Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note shouldhave no negative consequences, but you might miss out on a trick that makes your life easier.

Important

Important boxes detail things that are easily missed: configuration changes that only apply tothe current session, or services that need restarting before an update will apply. Ignoring a boxlabeled 'Important' will not cause data loss but may cause irritation and frustration.

Warning

Warnings should not be ignored. Ignoring warnings will most likely cause data loss.

2. Give us FeedbackIf you find a typographical error, or know how this guide can be improved, we would love tohear from you. Submit a report in Bugzilla against the JBoss Enterprise Portal Platform ReleaseNotes. The following link will take you to bug report for JBoss Enterprise Portal Platform https://bugzilla.redhat.com/2.

Select the document name and version number relevant to the document you found the error in fromthe available lists then complete the description with as much detail as you can provide.

Be sure to give us your name so that you can receive full credit for reporting the issue.

2 https://bugzilla.redhat.com/enter_bug.cgi?product=JBoss%20Enterprise%20Portal%20Platform

Page 8: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

viii

Page 9: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 1.

1

Overview

1.1. OverviewSince JBoss Enterprise Portal Platform (EPP) uses many services of JBoss Enterprise ApplicationPlatform (EAP), all tunings and configurations that are recommended for EAP apply to EPP as wellhence most of those tunings will not be covered here. Following is a guideline that may help achievebest out of EPP.

This document is intended for Portlet Developers, Portal administrators, and those wishing toimplement/extend the JBoss Portal framework.

Page 10: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

2

Page 11: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 2.

3

JBoss Web Tuning

2.1. HTTP/AJP connector threadsIncrease number of HTTP/AJP connector threads. It's recommended to set this value to 250 * n where n is number of CPU in your server. Depending on nature of your application, this can be sethigher or lower. Modify value of maxThreads in in deploy/jboss-web.deployer/server.xml

<Connector port="8009" address="${jboss.bind.address}"protocol="AJP/1.3" emptySessionPath="true" enableLookups="false"redirectPort="8443" maxThreads="1500" />

2.2. Global Session TimeoutReduce global session timeout to your need. The default value of 30 min is too high for most usecases. A lower session timeout results into a more consistent memory footprint and more consistentthroughput. Modify deploy/jboss-web.deployer/conf/web.xml

<session-config> <session-timeout>15</session-timeout></session-config>

Page 12: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

4

Page 13: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 3.

5

Hibernate Tuning

3.1. Enable/Disable Lazy LoadingEPP assumes that number of portal pages and portlets window will be large and hence does notcache these objects. As a result, there could be many direct DB connection. But depending onuse case, lazy loading should be turned on and off partially or in its entirety. Modify deploy/jboss-portal[-ha].sar/conf/hibernate/*/domain.hbm.xml and change lazy=”extra” tolazy=”true” or lazy=”false”I. Modify attribute for the class org.jboss.portal.core.impl.model.portal.ObjectNode

<map name="children" inverse="true" cascade="none" fetch="select" lazy="true"> <cache usage="transactional" /> //[“read-write” in non clustered] <key column="PARENT_KEY" /> <map-key type="org.jboss.portal.jems.hibernate.MagicString" column="NAME" /> <one-to-many class="org.jboss.portal.core.impl.model.portal.ObjectNode" /></map>

II. Enable caching for displayNames for the classorg.jboss.portal.core.impl.model.portal.PortalObjectImpl

<map name="displayNames" cascade="none" fetch="select" lazy="true" table="JBP_PORTAL_OBJECT_DNAMES"> <cache usage="transactional" />// [“read-write” in non clustered] <key column="INSTANCE_PK" /> <map-key type="locale" column="LOCALE" /> <element type="string" column="TEXT" /></map>

III. Same as above for hibernate/instance/domain.hbm.xml for displayNames map.

IV. Enable/disable lazy loading for set “users” in hibernate/user/domain.hbm.xml

V. Disabling lazy loading implies there will be many objects in memory. You can control how manyobjects would need to reside in memory at a time and for how long before they are evicted bymodifying values at conf/hibernate/*/ehcache.xml in non clustered configuration. Theseparameters would need to be changed as per the use case. For clustered configuration, see thechapter on Chapter 5, Clustering Tuning

3.2. Enable/Disable Query CacheEPP no longer uses query cache. Unless EPP is customized to use query cache, it should be disabledby turning the value of property "cache.use_query_cache" to false in following files:• hibernate/instance/hibernate.cfg.xml

• hibernate/portal/hibernate.cfg.xml

• hibernate/portlet/hibernate.cfg.xml

• hibernate/user/hibernate.cfg.xml

Disabling query cache also allows to useINVALIDATION_SYNC as CACHE_MODE when usingoptimistic locking with JBoss Cache and Hibernate as explained in the clustering section.

Page 14: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

6

Page 15: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 4.

7

Identity

4.1. Cache Login CredentialsEPP uses JaasSecurityManagerService to obtain current users roles that are cached by JAAS duringauthentication. So altering cache invalidation can affect performance. Please see the details at 1.

1 http://wiki.jboss.org/wiki/CachingLoginCredentials

Page 16: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

8

Page 17: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 5.

9

Clustering Tuning

5.1. Enable Buddy Replication for Portal and PortletSession ClusteringPortal and Portlet Session are merely wrappers around HttpSession so most of HTTP sessionclustering optimization applies to JBPP as well. EPP uses clustering configuration of JBoss Web sochanges go to jboss-web-cluster.sar/META-INF/jboss-service.xml . To enable buddyreplication, change the value of buddyReplicationEnabled to true.

5.2. Hibernate and JBoss Cache ConfigurationEPP uses JBoss Cache as a second level cache for Hibernate and this configuration is not definedin JBoss Cache definition used for Portal and Portlet Session. Instead the configuration is defined at jboss-portal-ha.sar/META-INF/jboss-service.xml

5.3. Optimistic Locking (OL)Our tests have shown that optimistic locking performs better under heavy load and it scales(horizontally) better as well. However, your use case may not show the same behavior and for youpessimistic locking may be a better configuration. To enable optimistic locking, modify TreeCachembean definition as follows:

<attribute name="NodeLockingScheme">OPTIMISTIC</attribute><attribute name="CacheMode">INVALIDATION_SYNC</attribute>

Note

If you have not disabled query cache, then you should not use INVALIATION_SYNC asCACHE_MODE. Use REPL_SYNC instead.

5.4. Pessimistic Locking (PL)When using Pessimistic Locking (PL), change isolation level to READ_COMMITTED (RC). Please seehttp://lists.jboss.org/pipermail/jbosscache-dev/2008-July/002401.html to see why it is okay to relax theisolation level from REPEATABLE_READ (RR). As expected, RC has better performance than RR.

5.5. Cache Eviction PolicyIf you disabled lazy loading, then you can control number of objects and time they can reside inmemory by configuring EvictionPolicyConfig attribute of TreeCache at jboss-portal- ha.sar/META-INF/jboss-service.xml

<attribute name="EvictionPolicyConfig"> <config> <attribute name="wakeUpIntervalSeconds">5</attribute> <region name="/_default_"> <attribute name="maxNodes">5000</attribute> <attribute name="timeToLiveSeconds">1000</attribute> </region> </config>

Page 18: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 5. Clustering Tuning

10

</attribute>

Page 19: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

Chapter 6.

11

JVM Tuning

6.1. Use Large PagesWhen using 64 bit Linux systems , use Linux's large memory page support. Without large pagesupport, increasing heap size may not increase your performance. Modify JAVA_OPTS under$JBOSS_HOME/bin/run.conf to add -XX:+ UseLargePages. Please see EAP tuning guide or thedescription at 1 for the details.

6.2. Garbage Collection (GC) TuningDepending on nature of your application, adding XX:+UseConcMarkSweepGC -XX:+UseParNewGC may optimize GC collection behavior.

1 http://jbossworld.com/downloads/pdf/thursday/JBOSS_10-1050am_JBoss_Enterprise_Application_Platform_Tuning_v2_Andy_Miller.pdf

Page 20: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

12

Page 21: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

13

Appendix A. Revision HistoryRevision 1-1.4 Fri Apr 08 2011 Scott Mumford [email protected]

Updated with Bugzilla feedback link.

Revision 1-1.3 Tue Oct 26 2010 Scott Mumford [email protected] for new Publican version features.

Revision 1-1.2 Thu 21 Oct 2010 Scott Mumford [email protected] syntax highlighting and updated for new Publican version.

Revision 1-1.0 Thu 22 Jan 2009Initial creation of book in Publican.

Page 22: JBoss Enterprise Portal Platform 4.3 Tuning Guide en US

14