Performance Tuning

Business Components

  • Make sure to set Row Level Bind Values for View Accessors
    • There is a memory leak in this situation, if your Application Modules are alive for longer duration without being recycled. 
    • You will also notice Performance degradation over time.
  • You can use DBSequence for generated key attributes or you can override create method to programmatically generate key. 
    • Either option works, but if you want to enable JDBC Batching for Performance, you can not use DBSequence.
    • It is best to standardize on one option for entire development team to promote consistency. So i would recommend use of create method to programmatically generate keys.
  • ADF BC State Persistence
    • ADF BC will persist it's state to PS_TXN table. You will need to work with your Database team to tune access to this table, if you run into performance issues. 
    • You must setup at least daily purge for PS_TXN table.
    • Avoid persisting Transient attributes, if their values can be derived from other attributes.
  • View Object tuning
    • You can use Forward Only mode in non UI access of View Object. For example, background processing. Forward Only access is very efficient.
    • You may have to use Query Hint like FIRST_ROWS(1001), to give hint to database optimizer about your intentions that you are only interested in first 1001 rows.
    • Use Retrieve in Batches of Range Size +1. This will allow efficient retrieval of data from database ResultSet.
  • Disconnect Application Module on Release.
    • ADF will not release database connection back to Data Source unless you instruct it to do so.
    • This can lead to high connection usage and it may eventually get in to hung situation if you run out of Data Source connections.
    • Monitor JDBC connection usage using WebLogic Console or EM.
  • Configure Application Module Referenced Pool Size.You can configure Application Module Pool to keep certain number of AM in pool, this will allow for less State passivation & activation, thus improving overall performance of application.

  Faces

  • Tune org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS appropriately.
    • Token based client side state saving is enabled by default. Browser will pass token indicating reference to page state and page state is stored in HTTP Session. You can inspect token value using tool like Fiddler.
    • There are 15 such page state instances maintained in HTTP Session, which can lead to unnecessary memory usage for applications with large number of users.
    • You can not set this value to 1, as you need to allow for use of Back button and Chrome & Firefox share session across all tabs & windows. So if you set this value to 1, Users will be able to launch only 1 tab for that application.
  • Cache static content like .js, .css, .png etc.
    • You can cache static content in your Load Balancer. 
    • Make sure that browser history is also maintained. IE has settings that can clear Browser History on exit. 
    • Default settings of Oracle Access Manger prevents caching of content on Client end, you will need to correct the cache-control header variables in OAM. 
    • Monitor access logs to validate content caching. 
  • Enable Compression as needed.
    • ADF significantly reduces bandwidth requirements over traditional (non AJAX) JSP applications.
    • If you have users connecting over slower connections, you may want to enable compression to reduce communication time.

WebLogic

  • Enable Garbage collection logs.
    • Add -verbose:gc -XverboseTimeStamp to Server Start parameters.
  • Enable Heap dump on Out of Memory.
    • Add -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/dumps/<Server Name> to Server Start parameters. Make sure you have enough space on the mount point and <Server Name> folder is created. Ideally, you should just use a separate mount point specifically for Heap Dumps.
    • You can use Eclipse MAT, which seems to work perfectly for heap analysis. 
  • Add command line parameters to allows for JMX connection from JRockit Mission Control or JConsole.
    •  Add -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=<Port#> to Server Start Parameters.
    • Define a new port for each Server for this purpose.
    • You can also run Profiling using JRockit Mission Control, to monitor time spent in specific methods. This is unique feature of JRMC that is not yet available in JConsole. 
  • Print time spent in access logs. 
    • Use Extended format for HTTP Logs with c-ip date time cs-method cs-uri sc-status bytes time-taken
    • If you have Apache or OHS in front of WebLogic server, make sure to update it's log format to print time spent at the end. 
  • Use <statement-timeout>100</statement-timeout> for your Data Sources to time out long running queries. This example is set for 100 seconds timeout, you can tune it as per your needs. 
    • You can customize the Exception Handler to provide proper message to user for such timeout situations. 

1 comment:

  1. Hi Chandresh,

    Nice article, Very useful

    Good to see you

    Ravi Polishetty

    ReplyDelete