This blog we will see what are the best practices needs to follow for Oracle ADF UI layer
on performance perspective.
1. Cache Results for ADF Iterator Property should be true.
2. Use partial submit to true while refreshing the part of
the page (individual component).
3. Avoid inline HTML tags inside Pages/Page Fragments.
4. Don't hard code human readable text inside Pages/Page
Fragments.
5. Only one root component per page/page fragment.
6. Avoid long Ids for UI components (Should be less than 7
character).
7. As JavaScript and CSS are cached by the browser when the
files are external files. We should remove all the java script and CSS code
from JSFF and JSPX.
8. Avoid mixing JSF/ADF Faces and Java Server Pages Standard
Tag Library (JSTL) tags.
9. Set clientComponent to true only if you need to access
the component on the client side using JavaScript else don't set
clientComponent for any component.
10. If you need to hide UI components conditionally on a
page, try achieving this with rendered property of the component instead of
using visible property.
11. Use appropriate content delivery mode for af:table,
af:treeTable, af:tree, af:iterator, af:forEach.- If the page contains only the table context or the number of rows displayed are low use immediate delivery.
- You can use lazy delivery when the page contains a number of components other than a table or if the number of rows filled is on the higher side.
12. Use suitable fetch size for
af:table, af:treeTable, af:tree, af:iterator, af:forEach.
- The attribute fetchSize decides the number of rows needs to be retrieved during each server round trip.
13. select the proper components as per your business
requirement.
- Both af:inputListOfValues and af:inputComboboxListOfValues are smart enough to load the list of values on demand(lazy loading) where as af:selectOneChoice reads the entire list and populates the same when the page renders(greedy loading). You need to me be aware of the performance cost associated with each of these components. As a rule of thumb, consider af:selectOneChoice to display the list of values if the number of elements is less (say 15 or less) . In all other cases consider using either af:inputListOfValues or af:inputComboboxListOfValues, which loads list on demand.
- animation-enabled = false
15. Don't use columnStretching and frozen(frozen=true)
components. if you will add columnStretching or frozen, it will impact the
performance. These components adds extra overhead on the client side at
runtime. When the table is a complex one with large number of columns and rows,
this becomes very expensive operation.
16. Avoid repetitive coding by improving the reusability.
Try to use the below components- ADF Taskflows
- Page fragments
- Page templates
- Declarative components.
18. Don't write complex logic inside getter and setter
method of component inside managed bean.
19. Bean should be serializable.(should implement
java.io.Serializable)
20. Log your debugging messages with ADFLogger(recommended
to use oracle.adf.share.logging and Levels, ADF Logger , Check for Guard
Conditions).
21. Don't write System.out.println().
22. Speed up your web application by caching static contents
- Caching static contents such as images, JavaScript, css etc. improves performance of the system.
- ADF Faces is packaged with oracle.adf.view.rich.webapp.AdfFacesCachingFilter (servlet filter) which marks the application resources for caching at external Web Cache and/or user-agents (browsers).
- ADF Faces comes with set of default rules for caching static contents; however developers can override the default caching behavior with application's adf-config.xml file.
- This file is located under your web application's WEB-INF folder. Following diagram shows the syntax for defining caching rules in adf-config.xml.
<adf-config
xmlns="http://xmlns.oracle.com/adf/config"
xmlns:adf="http://xmlns.oracle.com/adf/config/properties"
xmlns:sec="http://xmlns.oracle.com/adf/security/config">
<adf-faces-config xmlns="http://xmlns.oracle.com/adf/faces/config">
<caching-rules>
<caching-rule
id="cache js">
<cache>true</cache>
<compress>true</compress>
<duration>99999</duration>
<agent-caching>true</agent-caching>
<cache-key-pattern>*.js</cache-key-pattern>
</caching-rule>
<caching-rule
id="cache jpeg">
<cache>true</cache>
<compress>false</compress>
<duration>99999</duration>
<agent-caching>true</agent-caching>
<cache-key-pattern>*.jpeg</cache-key-pattern>
</caching-rule>
</caching-rules>
</adf-faces-config>
</adf-config>
|
23. Use lazy loading for pop-up components at the page
24. Do not use any of the following ADF packages within your
Java code as Oracle does not guarantee to change the implementation in the
future:
- oracle.adfinternal
- oracle.adf.controller.internal
- org.apache.myfaces.trinidadinternal
- oracle.webcenter.internal
- oracle.webcenter.*.internal"
25. Ensure that the following context parameters are set for a production environment:
oracle.adf.view.rich.automation.ENABLE=false
[default value]
oracle.adf.view.rich.ASSERT_ENABLED=false
[default value]
org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION=false
[default value]
org.apache.myfaces.trinidad.COMPRESS_VIEW_STATES=true
org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT=false
org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION=false
[default value]
oracle.adf.view.rich.libraryPartitioning.DISABLED=false
[default value]
oracle.adf.view.rich.LOGGER_LEVEL=false
[default value]
javax.faces.STATE_SAVING_METHOD=client
|
26. Set the debug-output element to FALSE, or if necessary,
remove it completely from the trinidad-config.xml file.
27. Avoid the af:panelStretchLayout where topHeight, bottomHeight,
startWidth, endWidth is set to auto.
Thanks..
thanks for the tips. how many % of performance improvement (page load timing) we can get by doing these best practices? Thanks.
ReplyDelete