X

Best Practices from Oracle Development's A‑Team

Improving WebCenter Performance

Introduction

Tuning is quite a long and complex subject to be discussed in a single article. This first post will cover 2 basic strategies to make your Oracle WebCenter installation faster by tweaking the browser caching and adding content compression. By the end of this article your WebCenter pages should be rendering in less than 2 seconds – obviously depending on your environment – and with fewer requests.

This post is based on WebCenter Spaces version 11.1.1.4.0

Main Article

BROWSER CACHING

Your browser has a folder in which certain items that have been downloaded are stored for future access. Images, stylesheets, javascripts, and even entire web pages are examples of cached items. When accessing a website, your browser will check its cache folder first to see if it already has those images and, if so, it won't take the time to download them again.
There are two main reasons that web caches are used:

  1. To reduce latency — Because the request is satisfied from the cache instead of the web server itself, it takes less time for the representation to render in the browser.
  2. To reduce network traffic — Since there are less items to be downloaded from a web site, it reduces the amount of bandwidth used by a client.

Like in any other application, WebCenter Portal have static resources that need to be cached by the browser in order to reduce subsequent download access. The trick here is to setup OHS to rewrite the HTTP header of some specific virtual paths related to static resources in WebCenter.
We will use max-age instead of Expire. The max-age directive specifies the maximum amount of time that a representation – or file - will be considered fresh. From my perspective, the big advantage of this directive is that it’s relative to the time of the request, rather than absolute. max-age also seems to behave better with IE in general. I haven’t checked that in IE 9 so far. For this exercise, we’ve setup max-age to 2592000 seconds (30 days).

Header unset Last-Modified Header unset Expires Header set Cache-Control "max-age=2592000, public" Header set Surrogate-Control "max-age=2592000"

CONTENT COMPRESSION

To do content compression in OHS you need to configure mod_deflate. It should already be installed in your OHS under $MIDDLEWARE_HOME/Oracle_WT1/ohs/modules/mod_deflate.so. But it might not be loaded.

 LoadModule deflate_module "${ORACLE_HOME}/ohs/modules/mod_deflate.so"

With mod_deflate, you can compress HTML, text or XML files to approx. 20 - 30% of their original sizes, thus saving you server traffic. However, compressing files causes a slightly higher load on the server, but again, clients' connection times to your server decrease a lot.
mod_deflate requires you to specify which type files are going to be compressed.

AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/atom_xml AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE text/html

Images are supposed to be in a compressed format, and therefore are bypassed by mod_deflate.

SetOutputFilter DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

QUICK SETUP

To have all those changes applied to your environment, please download webcenter_conf and replace the variables listed below accordingly.

  • [wc_spaces host]
  • [wc_spaces port]
  • [wc_services host]
  • [wc_services port]
  • [ses host]
  • [ses host]

If you already have portlets being consumed by your application, don’t forget to add the proper mod_wl entries.

#Portlets #Insert your portlet mapping here <Location /[portlet path]> SetHandler weblogic-handler WeblogicHost [wc_portlet host] WeblogicPort [wc_portlet port] </Location>

And if you have already separate the static assets from your application into a different directory, you might want to set the same configuration:

Alias /[virtual path for static files] [physical path for static files] <Location /[virtual path for static files]/> Header unset Last-Modified Header unset ExpiresHeader set Cache-Control "max-age=2592000, public" Header set Surrogate-Control "max-age=2592000" </Location>

After doing the proper setup you can drop the webcenter_conf file into $MIDDLEWARE_HOME/Oracle_WT1/instances/instance1/config/OHS/ohs1/moduleconf. You MUST restart OHS for the changes to take effect.

TESTING

Now let’s access WebCenter to see how fast it is. The first access any WebCenter Spaces page should be faster since we’re using content compression, but it should still bring lots of resources such as js files, images, css, etc.

1st Access

improving_webcenter_performance_1
Activities page renders in approximately 7.5 secs with 91 requests.

2nd Access

improving_webcenter_performance_2
A subsequent access to the same page takes less than half a second and only requires a single request. All other static assets are cached by the browser and don’t need to be downloaded again.

Others

Any other request to pages that haven’t been accessed before should take less requests to render, since most of the WebCenter resources have been downloaded previously.
improving_webcenter_performance_3
Spaces page takes 1.1 seconds and 7 requests to render. Blazing fast, my friends!

IIS Addendum

You might be wondering if you can achieve a similar performance with a different Web Server such as Microsoft Information Server. In this article I’ll describe the steps you need to follow to have IIS not only applying content compression, but also rewriting the expiration data in the HTTP header.

STEPS

Open the Internet Information Services Manager, right-click on the Default Web Site option and select Properties.

improving_webcenter_performance_4

The window below should show up. Check the “Expire after” option and set it to 1,193 Hour(s). It will change the HTTP header Cache-control parameter from Expire to max-age in all local static resources, which solves the Internet Explorer caching issue.

improving_webcenter_performance_5

Click on the MIME Types button and add the following ones:

improving_webcenter_performance_6

Select the ISAPI Filters tab and check where the WebLogic ISAPI plug-in (wlFilter) is installed. The plug-in allows a smooth integration of WebLogic's HTTP functionality into Microsoft IIS.

improving_webcenter_performance_7

Under the iisforward.dll’s directory you should find iisproxy.ini. Open the ini file and add the FileCaching=ONproperty as shown below. It will add another level of buffer to IIS and force it to add Content-Length property to the HTTP Header.

WebLogicHost=<WebCenter / Load Balancer host> WebLogicPort=<WebCenter / Load Balancer port> ConnectTimeoutSecs=20 ConnectRetrySecs=2 WlForwardPath=/webcenter,/rest Debug=OFF FileCaching=ON

Make sure content compression is still setup. Right-click on Web Sites and choose properties

improving_webcenter_performance_8

Select the Service tab. The “Compress static files” option must be checked.

improving_webcenter_performance_9

Don’t forget to restart IIS after the changes.

 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Recent Content