• No results found

Using a Caching Proxy

With any theme, large resources can have a significant impact on end-user performance. The performance impact of these can be minimized by compressing and/or caching them outside the application server.

There are a couple of choices for caching: using a reverse proxy or enabling caching in the HTTP server. In this section we discuss both options.

We suggest having the HTTP server reside on a different server than portal, use in-memory caching on the HTTP server, and don’t bother using a reverse proxy.

Other configurations are viable, but make sure that large resources, such as layerLoader.jsp is cached and compressed. We saw a significant performance improvement by having portal compress the content and have the HTTP server cache it.

The advantage of using a reverse proxy over an HTTP server for caching depends on the topology used. In general it is best to have the caching done on a server that the application

server is not running on. So if the HTTP server is on the same server as the application server, it is good to use a caching reverse proxy that is on a different server.

The disadvantage of using a reverse proxy is the difficulty to configure it so it compresses content, and caches it, and does not send a Vary header to Internet Explorer.

For HTTP-server caching, the advantage of using in-memory caching is that it is faster than on-disk caching. The disadvantage is that in-memory caching could use more main memory.

E N A B L I N G C A C H I N G I N T H E H T T P S E R V E R

For http server caching, there are 2 possibilities: disk caching and in-memory caching. In- memory caching is faster. However, disk caching does not work on Windows. On windows the only option is in-memory caching.

These values are set in the HTTP server’s httpd.conf file:

For in-memory caching use:

LoadModule cache_module modules/mod_cache.so <IfModule mod_cache.c>

LoadModule mem_cache_module modules/mod_mem_cache.so <IfModule mod_mem_cache.c> CacheEnable mem / MCacheSize 102400 MCacheMaxObjectCount 10000 MCacheMinObjectSize 1 MCacheMaxStreamingBuffer 6291456 MCacheMaxObjectSize 6291456 </IfModule> </IfModule>

For caching to disk (not for use on Windows) use the following:

LoadModule cache_module modules/mod_cache.so <IfModule mod_cache.c>

LoadModule disk_cache_module modules/mod_disk_cache.so <IfModule mod_disk_cache.c>

# make sure the path below exists and the http server group has access to it

CacheRoot /usr/IBMIHS7/diskCachetemp/ CacheEnable disk /

Make sure to select either disk or in memory caching, but not both. If a caching reverse proxy is used, there is no need for caching on the http server as well

When using HTTP in-memory server caching on Unix, use the following settings to override those mentioned in base portal HTTP server settings. Unix based HTTP servers cache information in each process. These settings reduce the number of processes and increase the number of threads per process. This reduces the overall memory needed by the HTTP server processes.

Table 22: HTTP server settings for use with HTTP caching

Parameter AIX

POWER5 Additional Information

ThreadsPerChild 150 The higher number of threads per child on

Windows is due to a different process model for IHS on Windows.

StartServers 1

ThreadLimit 150

ServerLimit 25 Set it MaxClient /ThreadsPerChild.

See Web Server Tuning for other HTTP server settings to set proper HTTP headers. Those settings are used whether or not the HTTP server is configured for caching:

E N A B L I N G C A C H I N G I N A R E V E R S E P R O X Y S E R V E R

An alternative to caching in an HTTP server is to cache in a reverse proxy. We used IBM Edge Server Version 6.0.2 plus fixes.

We were unable to get the Edge Server to compress and cache layerLoader.jsp. Therefore we did not get acceptable results having the Edge Server doing the compression. We did get good results having Portal compress the content, HTTP server add caching headers, and the Edge Server cache the results.

Another issue with doing compression in the Edge Server version we used, is that the Edge Server will send a Vary HTTP response header if the reverse proxy compresses the reply. If Internet Explorer (IE) receives a reply with a Vary header, IE will always check to see if the item has been modified the next time that item is requested. That is not the desired behavior as it causes an unnecessary request to be sent instead of using the version that is in the browsers cache without sending a message to the server. Make sure that compressed replies sent to IE do not contain a Vary header.

The following are the settings and tunings specified in the reverse proxy’s ibmproxy.conf file to get the reverse proxy to work with the Page Builder theme. These settings allow caching of responses but allow portal to perform the compression of responses.

Table 23: Reverse Proxy Settings

Parameter Setting Used Additional Information

Proxy /wps/* http://{server-name}/wps/* Proxy for /wps

Proxy /wps_semanticTag*

http://{servername}/wps_semanticTag*

Proxy for /wps_semanticTag

Proxy /searchfeed* http://{server- name}/searchfeed*

Proxy for /searchfeed

Proxy /portal_dojo/* http://{server- name}/portal_dojo/*

Proxy for /portal_dojo

Proxy /PageBuilder2/* http://{server-

name}/PageBuilder2/* Proxy for /PageBuilder2

Proxy /mccenabler/* http://{server- name}/mccenabler/*

Proxy for /mccenabler

ConnThreads 15 ServerConnPool on MaxSocketPerServer 20 CacheTimeMargin 5 seconds CacheFileSizeLimit 2 M flexibleSocks off LimitRequestFieldSize 16384

Web Server Tuning

The following settings allow the HTTP server to put proper caching headers on requests and to have the HTTP server do caching.

# uncommented the following to enable statics to be cached LoadModule expires_module modules/mod_expires.so

LoadModule headers_module modules/mod_headers.so

# from http://www.contentwithstyle.co.uk/blog/147 avoid gzip bug in IE 6 BrowserMatch ^Mozilla/4\.[0678] no-gzip

BrowserMatch \bMSIE\s7 !no-gzip !gzip-only-text/html AllowEncodedSlashes On

ExpiresActive On

<LocationMatch "/mccenabler/js/com/ibm/mm/livetext/.*\.cfg"> header set Cache-Control "public,max-age=86400"

</LocationMatch>

<LocationMatch "/mccbuilder/widget-catalog/.*\.xml"> header set Cache-Control "public,max-age=86400" </LocationMatch>

Related documents