frank houweling (amis, the netherlands) odtug kscope13 improve your adf fusion application's...

46
Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Upload: brennen-slemmons

Post on 29-Mar-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13

Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent

1

Page 2: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Customers do not accept slow applications anymore

Page 3: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Things are happening….

Too Soon

Too Often

Too Slowly

Too Little

Too Big

Page 4: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Things are happening….

Too Slowly

Page 5: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Slow database executions

• Many bottlenecks are simply caused by slow ViewObject queries, PL-SQL calls or EntityObject DML operations

• Often hard to track which queries are slow• Some queries are only slow for certain bind parameters• Some queries are not slow during in development environment but slow in

production environment (that has much more data)

RDBMS

Page 6: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

start

stop

select *from employeesorder by name

Database

Quick and simple way: Override executeQueryForCollection() method in project base ViewObject class to log executed database queries

Measure execution time of ViewObject queries

Page 7: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Other ways to detect slow database executions (1)

• Oracle ADF Logger diagnostic tool in JDeveloper

• Disadvantage: (too) much overhead for use in test- or production environment

Page 8: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Other ways to detect slow database executions (2)

• Set up a database trace-Queries from database perspective-Disadvantage: database executions not from ADF application’s perspective, often not easy to relate database trace to ADF executions

Page 9: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Things are happening….

Too Often

Page 10: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too many (mini) queries

Node 1

Node 1.1

Node 1.2

Node 1.1.1

Node 1.1.2

Node 1.2.1

Node 1.2.2

1 Query

Another 2 queries

Another 4 queries

Page 11: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too often executed ViewObject mini-queries (1)

• Applies to a lot of hierarchical structures

– Master detail (.. Detail, …. Detail)– Default implementation of af:table, af:treeTable and af:tree with

associations and viewlinks– ViewAccessor’s queries that are used for lookup items in af:table,

af:treeTable and af:tree components– Custom ADFBC overrides and programmatically executed iterators– Nested <af:iterators> in a page

Page 12: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Solution

Page

ViewObject

ViewObject

Managed bean

Database Database

Page(Def)

Page(Def)

Page 13: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Unintentionally left iterators in PageDefs

Page (UI)

PageDef (Bindings)

Page 14: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too Many Database roundtrips (1)

Database tables

ViewObject

Fetch size is set too low

Page 15: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too many database roundtrips (2)

• The ViewObject fetch mode and fetch size properties (ViewObject General Tab - Tuning section) controls how many rows will be returned in each round-trip to and from the database

Page 16: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too Many Database roundtrips (3)

Database tables

ViewObject

Fetch size is set correctly

Page 17: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too many HTTP Requests (1)

• The iterator binding rangesize property represents the current set of objects to be displayed on the page

• Rule of thumb: for af:tables, af:treetable and af:tree components set the rangesize to the max number of records that you can display in the browser, not more (usually not more than 50)

Page 18: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too many HTTP Requests (2)

• Make use of the powerful ADF AJAX capabilities• Set where possible on all af:command<xxx> components (buttons, links,

menu-items, etc) partialSubmit="true“

HTTP Requests

Page 19: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Demo

• World’s most inefficient HR application !

Page 20: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too much data in ADFBC memory (1)

• Try to avoid loading more database rows than you need

• Be careful if you really do need to load a proportional number of database rows

Page 21: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too much data in ADFBC memory (2)

• If you query a proportional number of database rowsmany database rows memory consumption can be high

• Use accessmode=Range Paging if you have to display +- more than 250 records in an af:table, af:treeTable or af:tree

• Query resource intensive data only on demand (BLOBS, CLOBS, etc.)• Limit the ViewObject query result rows by bind parameters where possible• Use read-only ViewObjects where update is not needed (if EO based:

deselect the updatable checkbox

Page 22: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Demo ViewObject Range Paging

Page 23: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too frequent ‘expensive’ ApplicationModule passivation & activation

ApplicatAM 1 AM 2 AM 3 AM 4 AM 5

Application Module pool

Database/File

Page 24: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

• Often during development the AM pooling settings are not considered important and left at their default.

• On a production environment, not setting these parameters correct (and leaving them at the default values) can be very inefficient and may cause many unneeded passivations and activations

• Carefully read the documentation in the ADF Fusion developers Guide (Ch. 44 of the 11gR2 Fusion Developer Guide)

Too frequent ApplicationModule passivation & activation (2)

Page 25: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

ApplicationModule pooling guidelines (1)

Recommended by Oracle Fusion Guide:Oracle’s rule of thumb for setting the AM pool size is to set the maxavailablesize and the recyclethreshold parameters to the expected number of peak concurrent users that perform operations with short think times:

• jbo.ampool.maxavailablesize = jbo.recyclethreshold• jbo.ampool.minavailablesize = 80 % of jbo.ampool.maxavailablesize• jbo.ampool.doampooling=true (default)• jbo.doconnectionpooling=false (default)

This avoids application module instantiation time when load increases - the hit is taken at server startup. This also avoids recycling (passivation cycle) of AM under normal load.

Page 26: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

ApplicationModule pooling guidelines (2)

Recommended by Duncan Mills:• Increase jbo.ampool.maxinactiveage• Set jbo.ampool.timetolive = -1

Results in more available AMs and avoid passivation/ activation costs

Recommended by Oracle Fusion Guide:• If your highest concern and priority is to limit the number of database

connections, set jbo.doconnectionpooling=true (in combination with jbo.txn.disconnect_level=1), otherwise leave it at false (default)

• Option for ADF applications with proportionally many root AMs, many users and many database connections for each user

Page 27: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too much logging on

• Switch to SEVERE at the WLS / EM level

Page 28: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Things are happening….

Too Soon

Page 29: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Executed too soon (1)

• Example: af:panelTabbed component with in each af: showDetailItem an af:region that starts a taskflow execution

Page 30: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Executed too soon (2)

.jsff page: PageDefinition:

Page 31: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Executed too soon (3)

• Use childCreation="lazyUncached“ or childCreation="lazy“ to defer taskflow execution of all tabs until the tab is opened

• For popups, use childCreation="deferred”

• For tasklows in regions, use activation="conditional" and a RefreshCondition on the taskflow executable

Page 32: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Instantiated too soon

• Defer the runtime instantiation of ViewObject and nested ApplicationModule instances until the time they are used

Page 33: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Loaded too soonImmediate versus lazy

Important to consider for the following components:

• af:table, af:treeTable, af:tree• af:popup• af:menu• dvt<xxx> (graphs)

• Lazy delivery should be used for tables, or other stamped components, which are known to have a slow fetch time (when they show many records, or the query is slow)

Page 34: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Design your pages smart

• Do not display too much data on a page, keep your page design simple if possible

• Some organizations do still have old browsers (IE7) that can handle limited amounts of HTML and JavaScript

• Do not unnecessarily query data that is not immediately needed (unopened tree nodes, inactive tabs, invisible popups, unopened dropdown lists, etc.)

Page 35: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Example bad practice ADF10g app

?15%

30%

35%15%

5%

Page 36: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Things are happening….

Too Little

Page 37: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too little Caching

• Use a shared application module to group view instances when you want to reuse lists of static data across the application

Page 38: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too little JVM Heap size

Recommended by Duncan Mills:• Set (–Xms–Xmx) as large as possible within available physical memory

• Generational parallel garbage collection strategy is recommended to maximize throughput: -Xgc:genpar (JRockit)

Page 39: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Things are happening….

Too Big

Page 40: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too big scope for managed beans

• Use as small memory scopes as possible

Page 41: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too much HTML to the browser (1)

Make IDs of the following ADF faces container components as small as possible (max 2 characters):

• af:pageTemplate • af:region • af:panelCollection• af:table• af:treetable• af:tree• af:iterator

Page 42: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too much HTML to the browser (2)

• Monitor HTTP traffic in browser (for example firebug)• Look for big files

HTML

Page 43: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Too much HTML to the browser (3)

• Make the container component IDs as small as possible, for example:<af:pageTemplate id="t“ > <af:panelCollection id="c“ ><af:treeTable id=”utt” ><af:region id="r4“ >

HTML

Page 44: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Demo ADF Performance Monitor

Page 45: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Summary ADF Performance Tips

1. Smart application design - do not unnecessarily query data that is not immediately needed (unopened tree nodes, inactive tabs, invisible popups, unopened dropdown lists, etc.)

2. Detect and avoid multiple unnecessary ViewObject query executions3. Detect and tune ViewObject slow queries4. Set efficient ViewObject fetchsizes5. Set efficient PageDefinition Iterator rangesizes6. Use partialSubmit=true where possible on: af:commandButton,

af:commandImageLink, af:commandLink, af:commandMenuItem, af:commandNavigationItem, af:commandToolbarButton.

7. If you are working with more than 500 records in tables, set the ViewObject property accessmode to ‘Range paging’

8. Make IDs of ADF faces container components (af:pageTemplate, af:region, af:panelCollection, af:table, af:treetable, af:tree) as small as possible

9. Last but not least: Learn about (and try out) the most efficient Application Module pooling settings for your specific situation – it can save 30% of your performance

Page 46: Frank Houweling (AMIS, The Netherlands) ODTUG Kscope13 Improve Your ADF Fusion Application's Response Time by as Much as 70 Percent 1

Resources

• Fusion Middleware Performance and tuning guide• AMIS technology blog• Blogs by Duncan Mills• Blogs by Andrejus Baranovskis