1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service...

44
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Transcript of 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service...

Page 1: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 2: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF - Real World Performance Tuning

2 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Duncan Mills – Architect, ADF Product Development

V1.0 / Oct 2011

Page 3: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Program Agenda

• Before we beginPl tf t i• Platform tuning

• ADF BC Service tuning• UI / Controller Tuning

3 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 4: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

“We should forget about small efficiencies, say about 97% f th ti t ti i ti i th t f ll97% of the time: premature optimization is the root of all evil.”

Structured Programming with go to StatementsComputing Surveys, Vol 6, No 4, 1974; Donald Knuth

4 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 5: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Preparing Your Baseline

• Performance needs to be measured objectively and realisticallyrealistically

• A bad testing regime can skew results vastlyNot unusual for results to be out by a factor of 10x ++– Not unusual for results to be out by a factor of 10x ++

– So get your testing right!– Paper: Techniques for Testing Performance/Scalability and Stress

Testing ADF Applications • http://otn.oracle.com/developer-tools/adf/learnmore/adfloadstresstesting-354067.pdf

5 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 6: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Preparing Your Baseline

• Establish your goals– Concentrate on the user experiencep– Think “average” rather than min/max

• Define a representative workload• Test continuously

– It’s simpler to identify the cause of a performance problem at the ti it i i t d dtime it is introduced

– Test for both atomic performance and performance under stress• How confident are you that the performance after a restart and

6 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

How confident are you that the performance after a restart and performance after 5 days running will be the same?

Page 7: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Example Goal“The application must accommodate for long periods of pp g ptime 300 simultaneously active users with response timeaverage not to exceed 2 seconds. The application must

d k l d f 600 i f haccommodate a peak load of 600 active users for shortdurations of time with response time average not to exceed 7 seconds”exceed 7 seconds

From: Techniques for Testing Performance/Scalability and Stress Testing ADF ApplicationsMarch 2011

7 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 8: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Testing Should…

• Recognize that real users are not computers– Define think time (can be used to scale tests)( )– Use a sensible iteration time

• Define a representative workload– Length / nature of task– Data distribution / records contention

Numbers of users (aim high not low)– Numbers of users (aim high not low)

• Be based on production parameters E g Session timeout

8 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

– E.g. Session timeout

Page 9: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

A Handy Tool For DevelopersADF Logger• Where does a request

spend all of it’s time?

ADF Logger

spend all of it s time? • The ADF Logger can help

tinyurl com/adf-loggingtinyurl.com/adf-logging

9 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 10: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Key Documentation

Fusion Middleware Performance and Tuning GuideS ti 8 O l ADF P fSection 8 – Oracle ADF Performance

Tuning

10 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 11: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Program Agenda

• Before we beginPl tf t i• Platform tuning

• ADF BC Service tuning• UI / Controller Tuning

11 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 12: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Platform Tuning

Java EEServer

JVM Web Server

12 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

OID

Page 13: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Platform Tuning Java EE server O/S• Your mileage will vary based on machine size and

application size

Java EE server O/S

application size.• Key Factors

HugePages– HugePages• WLS installation guide is not as picky as the Oracle DB install • The default page size can need a lot of housekeeping

– File Descriptors• Somewhat dependent on nature of the app• If you run out you may be doing something else wrong (see later)

13 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

If you run out you may be doing something else wrong (see later)

Page 14: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Platform TuningOID / LDAP• Dependent on your user population

Tune the WebLogic Authentication Provider (WLS

OID / LDAP

• Tune the WebLogic Authentication Provider (WLS console)

• For example:• For example:– MaxGroupHierachiesInCache > no. groups in directory– CacheSize = 15360 (for 10,000 user population)( , p p )– CacheTTL = 600 (seconds)– ConnectionPoolSize = number of concurrent users on the system

14 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

• Article: http://fusionsecurity.blogspot.com/2011/08/tuning-weblogic-ldap-authentication.html

Page 15: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Platform TuningJVM Tuning (JRockit)• Run in server mode: -server

E bl H P

JVM Tuning (JRockit)

• Enable HugePages:-XlargePages:exitOnFailure=true

G b ll ti• Garbage collection– Generational parallel gc strategy is recommended to maximize

throughput: -Xgc:genparg p g g p

• Heap size (for managed servers!)– Set (–Xms –Xmx) as large as possible within available physical

15 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

memory

Page 16: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Platform TuningOther Considerations• Logging

Switch to SEVERE at the WLS / EM level

Other Considerations

– Switch to SEVERE at the WLS / EM level

• Admin server – start with a lower heap size (e.g. 512m)HTTP Server• HTTP Server– Enough processes and threads to support concurrent client

population p p

16 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 17: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Program Agenda

• Before we beginPl tf t i• Platform tuning

• ADF BC Service tuning• UI / Controller Tuning

17 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 18: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF BC Service TuningFocus Areas• General design principles

Vi Obj t t i

Focus Areas

• View Object tuning • Application Module pooling

18 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 19: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF BC TuningGeneral Design Principles• Take advantage of shared AMs

– Monitor hit rates in EM to further tune

General Design Principles

– Monitor hit rates in EM to further tune

• Use read-only VOs where update not needed– But still use EO based rather than SQL basedBut still use EO based rather than SQL based– Consider programmatic / static VOs when suitable– Avoid VOs created at runtime if you can

• Set locking mode to optimistic (now default in 11.1.2)– Saves additional rollbacks, reduces unnecessary lock statements

19 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

• Use Oracle SQL rather than SQL92 (if you can)

Page 20: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF BC Service TuningView Object Tuning• VOs define the queries so this is a key area

Th f i t t it th SQL ll (E t

View Object Tuning

• The preference is to not write the SQL manually (Expert Mode). You can loose out on optimizations M k b t t• Many knobs to turn– The defaults are probably not what you need– Consider the use case for each VO & build additional VOs ifConsider the use case for each VO & build additional VOs if

necessary– Rangesize / Batch Size are key

20 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 21: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF BC Service TuningView Object TuningView Object Tuning

21 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 22: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF BC Service TuningApplication Module PoolingApplication Module Pooling

• Stop and read the documentation!documentation!

• Excellent coverage in Fusion Developers GuideFusion Developers Guide – Chapter 44 in 11.1.2 version“Tuning Application Module

Pools and Connection Pools”

22 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 23: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF BC Service TuningApplication Module Pooling• Use pooling of course (jbo.doconnectionpooling)

Configuration based on user population

Application Module Pooling

– Configuration based on user population• initpoolsize – take the hit at server startup• Maxavailablesize – to your projected average peak

• Aim to avoid passivation / activation costs– Set recyclethreshold to maxavailablesize– Bump up maxinactiveage– Set timetolive = -1

– Could save to up to 30% on response time

23 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

– Could save to up to 30% on response time

Page 24: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Program Agenda

• Before we beginPl tf t i• Platform tuning

• ADF BC Service tuning• UI / Controller Tuning

24 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 25: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Before We Begin – What You get for Free Today• Smart streaming content – tables and menus

O ti i d PPR

Today

• Optimized screen PPR• Optimized roundtrips• Client side caching (auto-suggest)• JS Partitioning

25 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 26: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

What You (will) get for Free In the Future (Maybe)• Reduced page / script download size

Even smarter optimization and compression

In the Future… (Maybe)

– Even smarter optimization and compression

• More client side caching – As browsers become more capable– As browsers become more capable

• More optimal implementations – For example HTML5 replacing Flash for chartsFor example HTML5 replacing Flash for charts

• “Lighter” options where you don’t need the “full fat” component – e.g, Tables

26 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

p g,

Page 27: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Pre-Deployment TasksThe switches you need to flip• Switch off “development mode” web.xml parameters

Well documented in Tables 8 1 / 8 2 in the Oracle Fusion

The switches you need to flip

– Well documented in Tables 8-1 / 8-2 in the Oracle Fusion Middleware Performance and Tuning Guidee.g. set

l df i i horacle.adf.view.rich.CHECK_FILE_MODIFICATIONto false

– In most cases these options are OFF by default so you’ll only p y y yneed to override those you have used

27 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 28: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF Faces OptionsThings you didn’t know you were remembering• View State cache – how much page state history do we

remember (for the back button)

Things you didn t know you were remembering…

remember (for the back button)– In web.xml:<contextparam><contextparam><contextparam>

<paramname>org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS

</paramname><paramvalue>2</paramvalue>

<contextparam><paramname>

org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS</paramname><paramvalue>2</paramvalue>

– Default value is 16 (15 old versions retained)

paramvalue 2 /paramvalue</contextparam>

paramvalue 2 /paramvalue</contextparam>

28 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Default value is 16 (15 old versions retained)

Page 29: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF Faces OptionsAnd Squeeze• Compress the View State cache

Trades memory for CPU

And Squeeze…

– Trades memory for CPU

<contextparam><paramname>

<contextparam><paramname>

org.apache.myfaces.trinidad.COMPRESS_VIEW_STATE</paramname><paramvalue>true</paramvalue>

</contextparam>

org.apache.myfaces.trinidad.COMPRESS_VIEW_STATE</paramname><paramvalue>true</paramvalue>

</contextparam>

– Example customer application:• Live memory reduced by 13% at a cost of 4.5% increase in CPU

29 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Live memory reduced by 13% at a cost of 4.5% increase in CPU

Page 30: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF Faces OptionsEnable Resource CachingEnable Resource Caching

30 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 31: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF Faces OptionsEnable Resource Caching• Use WebCache, ADF auto-configures it for you

C fi JS d I t th l t

Enable Resource Caching

• Configure JS and Images to use the resource servlet– Sets cache header & reduces server file handle usage– e g In web xml:– e.g. In web.xml:<servletmapping><servletname>resources</servletname><urlpattern>/images/*</urlpattern>

<servletmapping><servletname>resources</servletname><urlpattern>/images/*</urlpattern>

</servletmapping><servletmapping><servletname>resources</servletname><urlpattern>/js/*</urlpattern>

</servletmapping><servletmapping><servletname>resources</servletname><urlpattern>/js/*</urlpattern>

31 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

</servletmapping></servletmapping>

Page 32: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

ADF Faces OptionsOptimize JSP ServletOptimize JSP Servlet

• Again in web.xml<initparam><paramname>load_description_from_tlds</paramname><paramvalue>false</paramvalue>

<initparam><paramname>load_description_from_tlds</paramname><paramvalue>false</paramvalue>

</initparam><initparam><paramname>jsp_timeout</paramname><paramvalue>600</paramvalue>

</initparam><initparam><paramname>jsp_timeout</paramname><paramvalue>600</paramvalue>

</initparam><initparam><paramname>debug_mode</paramname><paramvalue>false</paramvalue>

</initparam><initparam><paramname>debug_mode</paramname><paramvalue>false</paramvalue>

32 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

</initparam></initparam>

Page 33: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Controller Specific Configuration

• Be aware of the implications of (not) sharing data controlscontrols

• Regions: convenience / reuse vs. costEach taskflow has an overhead– Each taskflow has an overhead

• Enable HA and CustomizationsCustomizationsonly if needed in adf-config.xml

33 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 34: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

UI Code ChangesYou Certainly Should Make• Don’t hold on to component references in pageflow /

session scope

You Certainly Should Make…

session scope– Breaks high availability and hogs memory– One customer application – accounted for 18% of memory usagepp y g

• Defer loading for popups and regions in popups where possible– childCreation=“deferred” for popups– Activation=“conditional” for regions – switch on popupFetch event

(defined in pageDef)

34 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

(defined in pageDef)

Page 35: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Possible UI Code ChangesIf You Really need To• Reduce component ID lengths

And avoid <f:subview>

If You Really need To…

– And avoid <f:subview>

• Combine custom images into image strips – Apply the images via styles in the skin or attached CSS– Apply the images via styles in the skin or attached CSS– Smaller files (overall), fewer downloads, fewer server file handles– Potentially significant savings: e.g. 24% reduction in cold load

• Serve content from multiple servers – May be beneficial on some browsers

35 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 36: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Final Thoughts

• The tuning described here can have a dramatic effect– Do it first– Do it first

• Don’t try and outsmart the framework on performance– Some of the worst (and hardest to track) performanceSome of the worst (and hardest to track) performance

problems we’ve seen come from customer “overrides”– But by all means let us know if you see something good to do

• Accept that sometimes there is a tradeoff – Hand coded may be more optimal but is it worth the cost?

P f t ti i kill t th i i36 Copyright © 2011, Oracle and/or its affiliates. All rights

reserved.

• Performance testing is a skill-set worth acquiring

Page 37: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

“If you optimize everything you will always be unhappy ”If you optimize everything you will always be unhappy.Donald Knuth

37 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 38: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Join the JDeveloper/ADF Community

Twittertwitter.com/JDeveloper

Facebookfacebook.com/JDeveloper

Oracle’s JDeveloper PM blogblogs.oracle.com/ JDeveloperpm

oracle.com/technetwork/jdev

38 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 39: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

39 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 40: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

For More Information

• www.oracle.com/technetwork/jdevT t i l• Tutorials

• Demos• Software• Discussions• Blogs• And more…

40 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 41: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may

t b i t d i t t t It i t it t tnot be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development,upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

41 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 42: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

Q&AQ&

42 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 43: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

43 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

Page 44: 1 Copyright © 2011, Oracle and/or its affiliates. All ... · PDF fileADF BC Service Tuning Application Module Pooling ... Configuration based on user population Application Module

44 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.