Oracle UCM: Web Site Performance Tuning


Published on

A talk on how to optimize the Oracle Content Management System, and Site Studio in particular, for faster pages.

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Oracle UCM: Web Site Performance Tuning

  1. 1. Site Studio Performance Tuning Brian “Bex” Huff Chief Software Architect
  2. 2. Agenda <ul><li>General web-site tuning tips </li></ul><ul><ul><li>The complex basics </li></ul></ul><ul><li>High-performance architecture </li></ul><ul><ul><li>Tune your system, network, and servers </li></ul></ul><ul><li>Tuning Site Studio pages </li></ul><ul><ul><li>Oracle UCM specific tips </li></ul></ul>
  3. 3. Philosophy of Performance Tuning <ul><li>“ We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil ” </li></ul><ul><li>-- Donald Knuth </li></ul><ul><li>Need a holistic view of your systems and processes </li></ul><ul><ul><li>Use data-flow analysis and diagrams </li></ul></ul>
  4. 4. Why Are Network Applications Slow? <ul><li>Not enough CPU </li></ul><ul><ul><li>Needed for text processing, number crunching, cryptography </li></ul></ul><ul><li>Not enough memory </li></ul><ul><ul><li>Needed to cache temporary data for faster processing </li></ul></ul><ul><li>Not enough bandwidth </li></ul><ul><ul><li>Needed to support large data transfers, large user bases </li></ul></ul><ul><li>Too much latency </li></ul><ul><ul><li>Multiple round-trips to servers makes any single request slow </li></ul></ul><ul><li>Most web applications are slow because of bandwidth/latency </li></ul><ul><ul><li>extra CPU and memory help, but usually are not enough </li></ul></ul>
  5. 5. Bandwidth and Latency in Real Life <ul><li>48 inches wide </li></ul><ul><li>Bandwidth: </li></ul><ul><ul><li>2,000,000 barrels per day! </li></ul></ul><ul><li>800 miles long </li></ul><ul><li>Latency: </li></ul><ul><ul><li>15.8 days! </li></ul></ul>
  6. 6. Bandwidth and Latency On The Web <ul><li>Bandwidth: </li></ul><ul><ul><li>Number Of Simultaneous Requests You Can Support </li></ul></ul><ul><li>Latency: </li></ul><ul><ul><li>Time Added To Each Request Due To Network and Distance </li></ul></ul><ul><li>A web page with 50 images means 51 HTTP requests ! </li></ul><ul><li>High bandwidth and high latency? Pages “feel” slow </li></ul><ul><li>80-90% of response time spent in downloading web resources </li></ul><ul><ul><li>Images, CSS files, JS files, AJAX requests </li></ul></ul><ul><ul><li>Source: http:// </li></ul></ul>
  7. 7. Analyze The Flow Of Data <ul><li>How does the data get to the client? </li></ul><ul><li>How many applications are involved? </li></ul><ul><li>Where is the bottleneck? </li></ul><ul><ul><li>Latency: ping , traceroute , or tracert </li></ul></ul><ul><ul><li>Bandwidth: mrtg, wget , or ask your ISP/IT department </li></ul></ul><ul><ul><li>CPU and Memory: top or taskmanager </li></ul></ul><ul><li>On the web, latency is usually a bigger problem than bandwidth </li></ul><ul><ul><li>Distance and network health between web client and web server </li></ul></ul><ul><ul><li>Assume New York to San Francisco latency is ~100 ms </li></ul></ul><ul><ul><li>if your page has 100 images, that's 10 seconds for just latency! </li></ul></ul><ul><li>In practice, browser caching and multiple downloads help </li></ul>
  8. 8. UCM Data Flow Diagram <ul><li>How do the actual bytes flow from client, to server, and back? </li></ul>
  9. 9. Reduce CPU Needs of Web Pages <ul><li>General tip: simplify your web pages so they render faster </li></ul><ul><li>Use fewer DOM elements </li></ul><ul><ul><li>tables within tables within tables </li></ul></ul><ul><li>Put CSS at the top, and JS at the bottom </li></ul><ul><ul><li>CSS is rendered immediately </li></ul></ul><ul><ul><li>JS must be 100% loaded before it executes </li></ul></ul><ul><li>Avoid complex CSS </li></ul><ul><ul><li>AlphaImageLoader filter </li></ul></ul><ul><ul><li>CSS expressions </li></ul></ul>
  10. 10. Reduce Bandwidth Needs of Web Pages <ul><li>General tip: use smaller web resources </li></ul><ul><li>Compress your HTML, CSS, and JS files </li></ul><ul><ul><li>minimize their size in general </li></ul></ul><ul><ul><li>inline GZIP compression works well </li></ul></ul><ul><li>Use small, web-optimized images </li></ul><ul><ul><li>avoid scaling them in HTML </li></ul></ul><ul><li>Use GET for AJAX </li></ul><ul><li>Reduce use and complexity of cookies </li></ul><ul><ul><li>cookie state is sent with every request </li></ul></ul>
  11. 11. Reduce Latency Of Web Pages <ul><li>General tip: use fewer web resources </li></ul><ul><ul><li>eliminate images when CSS works just as well </li></ul></ul><ul><ul><li>consolidate CSS and JS into fewer files </li></ul></ul><ul><ul><li>correct any 404 error for missing images </li></ul></ul><ul><li>Use CSS SPRITES </li></ul><ul><ul><li>Like Google does </li></ul></ul>
  12. 12. Reduce Latency Of Web Pages (cont.) <ul><li>Make fewer network requests </li></ul><ul><ul><li>Avoid multiple DNS lookups on the same page </li></ul></ul><ul><ul><li>Minimize URL redirects </li></ul></ul><ul><li>Serve static files from multiple servers </li></ul><ul><ul><li>Browsers download 2 web resources at a time from one domain </li></ul></ul><ul><ul><li>So, make more domains: img1, img2 </li></ul></ul><ul><li>Use content delivery network </li></ul><ul><ul><li>Amazon Cloudfront : cheap, but mainly North American </li></ul></ul><ul><ul><li>Akamai : expensive, but global </li></ul></ul><ul><li>Make content “ cacheable ” </li></ul>
  13. 13. High-Performance Architecture <ul><li>Web Page Cache / Reverse Proxy </li></ul><ul><ul><li>Cache rendered web pages to take load off of Site Studio </li></ul></ul><ul><ul><li>make sure it understands cookies and GZIP compression </li></ul></ul><ul><li>Contribution / consumption environment </li></ul><ul><ul><li>Optimize contribution for read/write </li></ul></ul><ul><ul><li>Optimize consumption for read (mostly) </li></ul></ul><ul><li>Use a dedicated server for each Oracle UCM instance </li></ul><ul><ul><li>Do not share with other applications </li></ul></ul><ul><li>Schedule resource-intensive behavior in the off-hours </li></ul><ul><ul><li>Virus scanners and web spiders </li></ul></ul><ul><ul><li>Backups, archives, batchloads </li></ul></ul>
  14. 14. High-Performance Architecture (cont.) <ul><li>Create a cluster </li></ul><ul><ul><li>in most cases with 10gr3, significantly improves performance </li></ul></ul><ul><ul><li>general best practice for failover, high reliability, and uptime </li></ul></ul><ul><li>Minimize latency in local network </li></ul><ul><ul><li>keep database, LDAP, and other resources on same subnet </li></ul></ul><ul><ul><li>keep filesystem speedy: attached storage, SAN, NAS </li></ul></ul><ul><li>Monitor CPU and Memory usage </li></ul><ul><ul><li>bandwidth, and latency are usually the culprits </li></ul></ul><ul><ul><li>CPU and memory can be a bottleneck for heavy consumption servers </li></ul></ul><ul><li>If you use UCM 7.5 with Verity search, CPU can be an issue </li></ul><ul><ul><li>if you use database search, database CPU may be an issue </li></ul></ul>
  15. 15. Sample High-Performance Architecture
  16. 16. Make Static Content Cacheable <ul><li>Web caches will store static content (JS, CSS, images) </li></ul><ul><ul><li>Modest performance gains by keeping them in-memory </li></ul></ul><ul><ul><li>Caching dynamic content is better, but harder… </li></ul></ul><ul><li>Add Expires or MaxAge HTTP header to content </li></ul><ul><ul><li>allows a cache to know how long to store content </li></ul></ul><ul><ul><li>for static content, set this in the web server </li></ul></ul><ul><ul><li>for dynamic content, set it in Site Studio </li></ul></ul><ul><li>Properly configure ETag HTTP headers on clusters </li></ul><ul><ul><li>If you're not using them, just remove them </li></ul></ul>
  17. 17. Make Dynamic Content Cacheable <ul><li>Dynamic HTML pages might be different per user </li></ul><ul><ul><li>Multi-step forms and personalization are cache-killers </li></ul></ul><ul><ul><ul><li>Different users see different things at the same URL! </li></ul></ul></ul><ul><ul><li>Not all caches work when cookies are present </li></ul></ul><ul><ul><li>Need smart caches, and smart personalization </li></ul></ul><ul><li>Drive customization with static CSS and JS files </li></ul><ul><ul><li>Read cookies from JS, use AJAX to alter pages </li></ul></ul><ul><ul><li>Configure cache to ignore cookies, or </li></ul></ul><ul><ul><li>Configure web server to omit cookie header </li></ul></ul><ul><li>Security checks can be slow </li></ul><ul><ul><li>How far away is your user database? </li></ul></ul><ul><ul><li>Is it cached locally, or do we need to check ActiveDirectory or LDAP? </li></ul></ul>
  18. 18. Site Studio Specifics <ul><li>UCM performance rule-of-thumb </li></ul><ul><ul><li>20 read-only service calls per second per GHz CPU </li></ul></ul><ul><ul><li>5 read/write service calls per second per GHz CPU </li></ul></ul><ul><li>Problem: some Site Studio pages are multiple service calls! </li></ul><ul><ul><li>Each calls at least the SS_GET_PAGE service </li></ul></ul><ul><ul><li>Many fragments and templates call GET_SEARCH_RESULTS </li></ul></ul><ul><ul><li>Many also call DOC_INFO </li></ul></ul><ul><li>Not uncommon for one page to have 4 UCM service calls! </li></ul><ul><ul><li>Reduces performance to 5 page views per second per GHz CPU </li></ul></ul>
  19. 19. UCM Specifics <ul><li>Minimize number of queries per page </li></ul><ul><ul><li>Use static lists instead of dynamic lists when possible </li></ul></ul><ul><li>Optimize search queries </li></ul><ul><ul><li>Use <matches> or <contains> instead of <substring> </li></ul></ul><ul><ul><li>Note: <contains> only works in &quot;zone indexed&quot; metadata fields </li></ul></ul><ul><ul><li>Avoid time stamps in queries </li></ul></ul><ul><li>Tune Java VM to have as much memory as you can give it </li></ul><ul><ul><li>JAVA_MAX_HEAP_SIZE=1024 </li></ul></ul><ul><li>Optimize the Oracle Database </li></ul><ul><ul><li>Install the OracleQueryOptimizer component </li></ul></ul><ul><ul><li>Cursor_Sharing=SIMILAR </li></ul></ul><ul><ul><li>optimizer_mode=first_rows </li></ul></ul>
  20. 20. Finding Slow Pages: Passive <ul><li>Configure web server logs to measure page creation time </li></ul><ul><ul><li>Apache: use mod_log_config and the LogFormat directive </li></ul></ul><ul><ul><li>IIS: use W3C extended log file format, and the &quot;Time Taken&quot; field </li></ul></ul><ul><li>Enable UCM System Audit Information flags </li></ul><ul><ul><li>requestaudit </li></ul></ul><ul><ul><li>pagecreation </li></ul></ul><ul><ul><li>searchquery </li></ul></ul><ul><ul><li>systemdatabase </li></ul></ul><ul><li>Parse log files to find slow pages and slow queries </li></ul>
  21. 21. Finding Slow Pages: Active <ul><li>Run a web spider on your system </li></ul><ul><ul><li>Caution: this can crash your server! </li></ul></ul><ul><ul><li>Use web logs or spider logs to find slow pages </li></ul></ul><ul><li>Test slow pages once with auditing turned on </li></ul><ul><ul><li>You may be surprised how many database calls there are! </li></ul></ul><ul><li>Test slow pages with a load tester </li></ul><ul><ul><li>How many users can do this simultaneously? </li></ul></ul>
  22. 22. Finding Slow Pages: Active (cont.) <ul><li>Bandwidth: </li></ul><ul><ul><li>How fast can you download a static 1MB HTML file? </li></ul></ul><ul><ul><li>How many users can do this simultaneously? </li></ul></ul><ul><li>Latency: </li></ul><ul><ul><li>How fast can you download a 1k HTML file with a hundred 10k JS files? </li></ul></ul><ul><ul><li>How many users can do this simultaneously? </li></ul></ul><ul><li>Keep excellent notes! </li></ul><ul><ul><li>Only way to measure performance improvement </li></ul></ul>
  23. 23. Making Pages Faster <ul><li>Reduce number of service calls </li></ul><ul><li>Reduce number of database calls </li></ul><ul><li>Optimize IdocScript </li></ul><ul><ul><li>Minimize eval and executeService calls </li></ul></ul><ul><ul><li>Instead use setValue , setResourceInclude </li></ul></ul><ul><ul><li>Eliminate all IdocScript errors: these are performance drags </li></ul></ul><ul><ul><li>Use cacheInclude for slow sections of pages </li></ul></ul><ul><li>Optimize JSP/ASP/Java code </li></ul><ul><ul><li>In general, same rules apply </li></ul></ul><ul><ul><li>Reduce complexity, reduce number of service calls </li></ul></ul>
  24. 24. Making Pages Faster (cont.) <ul><li>Consolidate JS and CSS files </li></ul><ul><ul><li>Place them into a global fragment, or global region template </li></ul></ul><ul><ul><li>Standard best-practice for maintainable code </li></ul></ul><ul><li>Set flags to cache pages </li></ul><ul><ul><li>Built-in with the custom section property &quot;ssMaxAge&quot; </li></ul></ul><ul><ul><li>Passes the cache control header </li></ul></ul><ul><ul><li>Watch out for cookies! </li></ul></ul><ul><li>Disable unnecessary JavaScript files </li></ul><ul><ul><li>Requires custom component </li></ul></ul><ul><ul><li>On consumption environment, disable contributor JS files </li></ul></ul><ul><ul><li>Most sites don't need the JS files that contain navigation </li></ul></ul>
  25. 25. Review <ul><li>General web site performance tuning is critical </li></ul><ul><li>Data flow diagrams can highlight bottlenecks </li></ul><ul><li>Some architectures scale better than others </li></ul><ul><ul><li>Size CPU and Memory appropriately </li></ul></ul><ul><ul><li>Cluster your servers </li></ul></ul><ul><ul><li>Include a reverse proxy </li></ul></ul><ul><ul><li>Keep network resources close, and fast! </li></ul></ul><ul><li>Understand why specific Site Studio pages are slow </li></ul><ul><ul><li>Reduce number of service requests per page </li></ul></ul><ul><ul><li>Focus on making “cacheable” content </li></ul></ul>
  26. 26. Useful Tools and References <ul><li>Yahoo YSlow plug-in to Firefox: a must have! </li></ul><ul><ul><li>http:// / </li></ul></ul><ul><li>JMeter load tester </li></ul><ul><ul><li>http:// / </li></ul></ul><ul><li>Heritrix web crawler </li></ul><ul><ul><li>http:// / </li></ul></ul><ul><li>Varnish HTTP Accelerator </li></ul><ul><ul><li>http:// / </li></ul></ul><ul><li>Yahoo web site performance tuning best practices </li></ul><ul><ul><li>http:// </li></ul></ul><ul><li>Oracle UCM performance tuning guide: </li></ul><ul><ul><li> </li></ul></ul>
  27. 27. Now Available…
  28. 28. <ul><li>My Company: http:// </li></ul><ul><li>My Blog: http:// </li></ul><ul><li>My Self: [email_address] </li></ul>Questions?