440 likes | 628 Views
Using Oracle Fusion Middleware to Create Fast and Scalable Applications. Stevan Malesevic & Nathan Reynolds Software Architects, Oracle.
E N D
Using Oracle Fusion Middleware to Create Fast and Scalable Applications StevanMalesevic & Nathan ReynoldsSoftware Architects, Oracle
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.
Agenda • WebLogic Application Server • Application Development Framework
Oracle Fusion Middleware Business Innovation Platform for the Enterprise and Cloud • Complete and Integrated • Best-in-class • Open standards • On-premise and Cloud • Foundation for Oracle Fusion Applications and Oracle Cloud Web Social Mobile User Engagement Business Process Management Content Management Business Intelligence Service Integration Data Integration Identity Management Development Tools Cloud Application Foundation Enterprise Management
Oracle WebLogic Server 12c The #1 Application Server Across Conventional & Cloud Environments Cloud Application Foundation High Performance Platform for Mission Critical Cloud Applications Deep Integration with Oracle Database 12c - Multitenant and RAC Real-time data processing through GoldenGate HotCache & Live Events Built-in support for HTML5 and WebSockets for rich mobile and cloud applications Oracle Database 12c
Oracle WebLogic Server Foundation Runtime for Oracle Fusion Middleware Products Content Management Suite Identity Management Suite Business Intelligence Suite SOA Suite WebCenterSuite Java EE/ISVApps WebLogic Server Java EE: Reliability, Availability, Scalability & Performance Enterprise Manager Development Tools JDeveloper/Eclipse Admin and Operations HotSpot High Performance JVM Proven toOutperform Best forOracle Portfolio Lowest Cost of Operations
WebLogic Server Tuning Overview • WebLogic Server provides good out-of-the-box default tuning for a large range of applications, as well as auto-tuning 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”.
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>
HTTP Session State • Minimize session state • Aggregate data to minimize distinct session attributes • Separate frequently updated attributes from infrequently updated/read-only attributes. • Choose appropriate session persistence mechanism based on session characteristics and failover requirements • Set session time (web.xml) <session-config> <session-timeout>15</session-timeout> </session-config>
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
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
GridLink Data Source • Event-based data source that adapts to performance changes in an Oracle RAC instance • Fast Connection Failover • Responds to RAC events using ONS • Ensures valid connections (including reserved connections) without polling or testing • Runtime Connection Load Balancing • Adjust the distribution of work based on back end node capacities such as availability, CPU, response time vs round-robin for MultiDataSource • React to changes in topology • Manages pooled connections for high performance and scalability.
Enterprise JavaBeans (EJB) – Session Beans • Tune pool size for Stateless Session Bean (weblogic.xml) • initial-beans-in-free-pool – high value will impact startup time. Low value will incur runtime impact • max-beans-in-free-pool – set equal to number of threads expected to invoke EJB concurrently • Tune cache for Stateful Session Beans • Avoid using replication (handle at web tier)
Enterprise JavaBeans (EJB) • For Entity Beans • Use eager-relationship-caching • Choose concurrency strategy carefully • Use read-only or optimistic concurrency where possible • Consider call-by-reference instead of call-by-value semantics • Method parameters are not modified • If parameters are modified, the changes are invisible to the caller
Standard Socket MuxerMulti-core, memory and I/O bottlenecks Single Muxer Single Muxer WebLogic WebLogic • Single muxer increases latency to process incoming packets • Best to have 1 socket reader to avoid lock performance
Parallel Socket Muxer60% higher throughput, ½ latency Parallel Muxer Parallel Muxer WebLogic WebLogic • Parallel muxerallows for faster reaction to each incoming packet • Carefully tune number of socket readers • -Dweblogic.SocketReaders=
Work Manager Self-Tuning Thread Pool Work Managers Parallel Muxer Socket Readers Priority Based Queue
Miscellaneous • Pool and/or cache JMS resources whenever possible • Avoid creating new connections, sessions, producers, consumers on a per message basis • Chunk Pool (Networking Buffers) • Tune number of chunks • Tune size of chunks • Default of 4 KB is sufficient for most applications • For very large requests, larger chunks helpful • Use production mode in production • Don’t use development mode
Agenda • WebLogic Application Server • Application Development Framework
ADF Swing Office JSF ADF Faces JSP JSF/ADFc Struts Java BPEL Portlet ADFbc BAM XML BI EJB Web Services Toplink Relational Data Legacy Data XML Data Packaged Apps ADF Architecture Browser-Based Desktop View Controller Metadata Services (MDS) ADFm (JSR 227) Model Business Services Data Services
ADF BC – Application module configuration • Application module (AM) pooling enables multiple users to share several application module instances. • The configurations for the AM pool vary depending on the expected usage of the application. • AM parameters can be set at the system level by specifying JVM parameters (-Dproperty=value)
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, which means that a pending transaction state can be created on the database with row-level locks. With pessimistic locking mode, each time an AM is recycled, a rollback is issued in the JDBC connection. Web applications should set the locking mode to optimistic to avoid creating the row-level locks.
ADF BC – Application module configuration • General AM Pool Configurations • (jbo.ampool.minavailablesize) Chose min available size that the pool holds after cleanup. Avoid setting to 0 as cleanup will remove the pool • (jbo.ampool.maxpoolsize) Chose max pool size to satisfy peak load and prevent overload • (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)
ADF BC – Application module configuration • General AM Pool Configurations • 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
ADF BC – Application module - continue • AM can be passivated to db or file system • To reduce cost of passivation: • Make sure AM uses lazy loading • Keep number of root AMs per page low • Do not use / checkout AM instance when not needed • Avoid passivating transient attributes in VOs if they are calculated based on other VO attributes
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
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 • Option 1: Map resources to trinidad caching servlet
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>
ADF Config • Option 2: Map resources to adf lib caching servlet <servlet> <servlet-name>adflibResources</servlet-name> <servlet-class>oracle.adf.library.webapp.ResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>adflibResources</servlet-name> <url-pattern>/adflib/*</url-pattern> </servlet-mapping>
ADF Config • Use library partitioning • Ensure that the library partitioning is on by validating the oracle.adf.view.rich.libraryPartitioning.DISABLED property is set to false in the web.xml file. • Refer to dev guide how to configure custom library partitions
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
ADF Config • Use HTML5 for DVT • oracle.adf.view.rich.dvt.DEFAULT_IMAGE_FORMAT value of HTML5 • Since PS6 Graph and Gauge now support HTML5 output format. This context parameter, oracle.adf.view.rich.dvt.DEFAULT_IMAGE_FORMAT, will automatically be added to new applications. Applications that have this context parameter and haven't specified image format, would automatically default to HTML5. Valid values are HTML5 and FLASH. For the applications that do not have this context parameter, the default rendering for Graph and Gauge would be Flash.HTML5 is recommended on all modern browsers
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 /WEB-INF/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.
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
ADF Config • Disable debug output • The debug-output element in the trinidad-config.xml file specifies whether output should be more verbose to help with debugging. To improve performance by reducing the output size, you should disable the debug output mode in production environments. • Disable animation • Certain ADF Faces components use animation when rendering • Set animation-enabled to false in trinidad-config.xml to optimze performance
Additional Performance Tuning Resources • 11gR1 Tuning Guides (available on OTN) • Oracle Fusion Middleware Performance and Tuning Guide 11gR1 • Oracle Fusion Middleware Performance and Tuning for Oracle WebLogic Server 11gR1 • 11gR1 ADF Developer Guides (available on OTN)
For More Information Twitter Facebook Blogs LinkedIn YouTube Visit: www.oracle.com/middleware