Using Oracle Fusion Middleware to Create Fast and Scalable Applications Stevan Malesevic, Scott Oaks, Kim Lichong Oracle, Performance team September 29, 2014 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not 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, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle Product Stack Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda 1 Java HotSpot tuning 2 WebLogic Application Server 3 Application Development Framework 4 SOA Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda 1 Java HotSpot tuning 2 WebLogic Application Server 3 Application Development Framework 4 SOA Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle Java (HotSpot) Tuning • JVM performance is critical to the overall performance of ADF/WLS applications • WLS 12c now uses HotSpot by default instead of jRockit –JDK 7u40 is recommended; JDK 8 is supported starting in 12.1.4 –Many important performance-related fixes for Fusion Middleware available in JDK 7u40 –Emphasis on reducing the amount of tuning required Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | What to tune in Java 7 • TieredCompilation – enable with –XX:+TieredCompilation – On by default in Java 8 – Faster Startup – Slightly faster runtime performance – Increased native memory usage, though still small (~256M) • Heap Sizes – For JavaEE apps, best to set –Xmx == -Xms • One exception: WLS admin servers should have a small Xms • GC Algorithms – Maximize Throughput or Minimize Pauses Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | GC Algorithms for FMW: Throughput • Throughput (Parallel) GC will usually give better overall throughput • Long pauses may lead to unusual results • Dependent on amount of data left in heap • 4GB for FMW is a usual inflection point Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | GC Algorithms for FMW: G1 • G1 eliminates long pauses by concurrently collecting the heap • Optimizes memory collection at the expense of CPU • Recommended for heaps >4GB • Particularly when lots of live data is left Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | HotSpot Tuning Resources • Java Performance by Charlie Hunt and Binu John –Systemic Approach to tuning Java Apps • Java Performance Tuning: The Definitive Guide by Scott Oaks –Lower-level JVM tuning details Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda 1 Java HotSpot tuning 2 WebLogic Application Server 3 Application Development Framework 4 SOA Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Oracle WebLogic Server Foundation Runtime for Oracle Fusion Middleware Products Java EE/ISV Apps SOA Suite WebCenter Suite Content Management Suite Identity Management Suite Business Intelligence Suite Admin and Operations HotSpot High Performance JVM Proven to Outperform Development Tools Java EE: Reliability, Availability, Scalability & Performance JDeveloper/Eclipse Enterprise Manager WebLogic Server Best for Oracle Portfolio Lowest Cost of Operations Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | WebLogic Server Tuning Overview • WebLogic Server provides good out-of-the-box default tuning for a large range of applications, as well as autotuning features (e.g. auto-tuned thread pool) • For optimal performance on a given application, additional application-specific tuning can help • Large number of tuning options available – we’ll review some of the most important. – Wealth of additional information in “Oracle Fusion Middleware Performance and Tuning for Oracle WebLogic Server”. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | JavaServer Pages (JSP) • Pre-compile JSPs – The weblogic.appc compiler generates and compiles the classes needed to deploy EJBs and JSPs to WebLogic Server. – Alternatively JSPs can be pre-compiled during deployment time (in weblogic.xml) <jsp-descriptor> <precompile>true</precompile> </jsp-descriptor> • Prevent JSP pages to timeout <param-name>jsp_timeout</param-name> <param-value>600</param-value> Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | JDBC Connection Pooling Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Tuning JDBC • Pool Sizes – Initial Capacity = Number of connections created when pool is initialized – Minimum Capacity – Should be tuned for light load – Maximum Capacity – Should be tuned for peak DB throughput – Shrink Frequency = Reduces connections to current average need – Tune sizes based on DataSource statistics. Ensure connection wait time is not high. • Use Logging Last Resource (LLR) optimization instead of XA to minimize cost of two-phase commit • Use connection test (Test Connections on Reserve) with care Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Prepared Statement Cache • Keeps compiled SQL statements in memory – Avoid round-trip to DB if reused – Carefully tune for memory intensive applications • Oracle DB Driver – Use Driver Statement Cache – Overall memory footprint smaller than WebLogic Statement Cache – Data Source properties: oracle.jdbc.implicitStatementCacheSize= oracle.jdbc.maxCachedBufferSize= • Non-Oracle JDBC Driver – Use WebLogic Statement Cache – Monitor DB parsers and app server memory to tune cache size Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Work Managers Socket Readers Priority Based Queue Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Self-Tuning Thread Pool Parallel Muxer Work Manager Program Agenda 1 Java HotSpot tuning 2 WebLogic Application Server 3 Application Development Framework 4 SOA Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF BC – Application module configuration • General AM Pool Configurations –(jbo.dofailover) Specifies if failover for http replication is enabled or not. By default it is disabled –(jbo.locking.mode) Specifies the locking mode. The default is pessimistic. Web applications should set the locking mode to optimistic to avoid creating the row-level locks. –(jbo.ampool.maxpoolsize) Chose max pool size to satisfy peak load and prevent overload Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF BC – Application module configuration • General AM Pool Configurations –(jbo.recyclethreshold) Chose recycle threshold to satisfy average user load. –(jbo.ampool.timetolive) Chose time AM can live. In case of no leaks set to unlimited (-1) –AM will hold onto db connection by default. If number of db connections is a issue switch to db connection pooling (Djbo.doconnectionpooling=true -Djbo.txn.disconnect_level=1) –(jbo.load.components.lazily=true) Enable AM lazy loading reduce memory usage Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF Config • Most of high level config goes to web.xml file and by default properties are configured for best performance –org.apache.myfaces.trinidad.COMPRESS_VIEW_STATE –compresses view state to save live memory and reduces size of replicated session. CPU usage is a tradeoff –org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS: –Specifies how many view tokens should be stored Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF Config • Session time-out is important for live memory <session-config> <session-timeout>15</session-timeout> </session-config> • Cache resource. –By default ADF makes static resources (css, js, png,..) cacheable on browser. –Custom apps should mark their resources for caching as well –Map resources to trinidad caching servlet Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF Config <servlet> <servlet-name>resources</servlet-name> <servlet class> org.apache.myfaces.trinidad.webapp.ResourceServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>resources</servlet-name> <url-pattern>/your_app/*</url-pattern> </servlet-mapping> Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF Config • Use partial page navigation feature – Partial Page Navigation is a feature of the ADF Faces framework that enables navigating from one ADF Faces page to another without a full page transition in the browser. The new page is sent to the client using Partial Page Rendering (PPR)/Ajax channel. – The main advantage of partial page navigation over traditional full page navigation is improved performance: the browser no longer re-interprets and re-executes Javascript libraries, and does not spend time for cleanup/initialization of the full page • Enable PPR navigation in web.xml – oracle.adf.view.rich.pprNavigation.OPTIONS set to onWithForcePPR Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF Config • Profiling – oracle.adf.view.rich.profiler.ENABLED: Specifies whether or not to use the automated profiler instrumentation code provided with the JavaScript Profiler. The default is false. Set to true to enable the JavaScript profile. When the profiler is enabled, an extra roundtrip is needed on each page to fetch the profiler data. By default, JDeveloper uses the /WEBINF/profiler.xml configuration file. To override the location of the profiler.xml file, use the ROOT_FILE context parameter, as described next. You may also want to set DEBUG_JAVASCRIPT to true, to turn off JavaScript obfuscation. You also must set the LOGGER_LEVEL to at least INFO. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | ADF Config • Check for default values – javax.faces.STATE_SAVING_METHOD value client – org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION value false – oracle.adf.view.rich.LOGGER_LEVEL value OFF – oracle.adf.view.rich.ASSERT_ENABLED value false – org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT value false – org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION value false – org.apache.myfaces.trinidad.resource.DEBUG value false – oracle.adf.view.rich.automation.ENABLED value false Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Program Agenda 1 Java HotSpot tuning 2 WebLogic Application Server 3 Application Development Framework 4 SOA Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SOA Architecture Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SOA Work Managers – new in 12c Work Manager Name Description Responsible Work Areas SOA_Default_WM Default for all SOA services that do not access soa data source. No max_thread constraint defined. CaseManagement SOA_Request_WM Handles SOA synchronous requests Associated with SOA database size based max thread constraints "SOAIncomingRequest_maxThreads". Facade invocation, WebService client, Direct/ADF/Rest requests, B2B SOA_DataSourceBound_WM Handles all SOA backend processing services that access soa data source. Constrained with a max thread constraint that is based on SOA database max capacity "SOAInternalProcessing_maxThreads". Workflow EJBs SOA_EDN_WM Used by EDN framework EDN Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SOA Enterprise Manager – Tuning SOA components Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SOA Enterprise Manager – Tuning SOA components via MBean Browser Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Tunings – Overview SOA Component Level SOA Infrastructure Generic •BPEL/BPMN •AuditLevel •AuditLevel •OneWay DeliveryPolicy •InMemoryOptimization •MaxRecoverAttempt •ADF tuning for BPMN worklist/workspace •OSB •Poll_interval/Read_limit •Weblogic Application Server •Work Managers •JVM •Lazy Loading •Database •DB profiles •Execution/Message Tracing •Proxy/Result Caching •Payload Validation + •Auto Purge + •Adapters •ThreadsCount •MaxRaiseSize •MaxTransactionSize •UseBatchDestroy •DistributedPolling •EDN •NumOfThreads *Majority of the parameters can be configured via EM Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Key DB Parameters Parameter Name Audit_trail plsql_code_type Nls_sort • Consult with DBA • Avoid performance testing with out of the box settings Open_cursors Session_cached_cursors Processes Sga_target Pga_aggregated_target Memory_target Disk_asynch_io Filesystem_options Secure_file * Not a comprehensive list Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SOA Purge Has one of the biggest performance impacts on a SOA business application ● Impacts performance of runtime SQL queries ● Slows down console access when querying for auditing data ● Very large overhead when purging data – longer cycles required, defragmentation of DB, maintenance window ● If retention periods are long, larger disk space is required – BLOB column tables grow taking up bigger chunk of the DB ● Retention period dependent on customer policies/requirements ● Auto purge is default in 12c. ● Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Tunings – Database DB CPU ●Log file sync ●enq: HW – contention ●enq: TX – index contention ●enq: SQ - contention ● Optimizer statistics collection: ensure optimal execution plan being generated. ● Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Performance Tunings – Database •When investigating slow sql, use sql trace or capture execution plan for detailed analysis, for example, check if the sub-optimal operation is related to stale/unrepresentative stats •Sometimes, SQL performance suffer from change in execution plan due to state statistics, change in data volume or bind peeking. • Goal of SQL plan baselines is to preserve the performance of corresponding SQL statements, regardless of changes in the database. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | SOA Performance Resources Session ID: CON8388 Session Title: Simplified Performance Tuning for Oracle SOA Suite 12c Venue / Room: Moscone South - 236 Date and Time: 10/2/14, 14:30 - 15:15 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Additional Performance Tuning Resources • 11g and 12c Tuning Guides (available on OTN) –Oracle Fusion Middleware Performance and Tuning Guide 11g / 12c –Oracle Fusion Middleware Performance and Tuning for Oracle WebLogic Server 11g / 12c • 11g and 12c ADF Developer Guides (available on OTN) Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |
© Copyright 2024