This page is the starting point for learning about the Optimizer service. The following topics are covered:
The Optimizer service is a JAX-RS based service that delivers Dojo Toolkit for JavaScript resources to clients in an optimized form, including content for specific user-agents, compression, and customizable HTTP caching and expiration.
The Optimizer service sets HTTP caching and expiration data based on a ratio of the age of the on-disk resources, and saves compressed representations of resources to serve subsequent compression-aware clients.
The Optimizer service also automatically selects pre-built distributions of Dojo tailored to specific user-agents when available.
Product prerequisite | Version |
---|---|
Java Technology Edition | 5.0 and later |
Java Platform, Enterprise Edition 5 (Java EE) application server and later | WebSphere Application Server Version 8.5 |
Web browser | Any modern web browser, such as: Internet Explorer 7 and later Mozilla Firefox 3.x and later Google Chrome Safari Opera |
The Optimizer service has the Dojo Toolkit for JavaScript from the Web 2.0 and Mobile Toolkit already packaged within the .war file packaged in the appsvcs-optimizer.ear file. The application is immediately installable and deployable. However, if you want to maintain your own Dojo Toolkit for JavaScript elsewhere on the file system of the server on which this application is installed, you can perform the following steps, which are optional:
Dojo Toolkit for JavaScript has a builder that can produce optimized builds. These too can be hosted under the "dojo" directory to which you have configured the Optimizer service to use. For example, you might want to host an older version of Dojo. Therefore, you might also create the directory, "dojo/1.5/".
There is a single special case that Optimizer service currently supports. The Dojo builder supports a webkitMobile flag that produces a Dojo build that is optimized for WebKit-based Web browsers. The Optimizer service will use the User-Agent header of any incoming request to detect if it is a WebKit client, and look for the requested file in a directory named dojo_webkit that is a peer to the dojo directory. Existence of the dojo_webkit directory is entirely optional, but if it exists and contains a Dojo build that used the webkitMobile=true flag, you might achieve slightly better performance on WebKit based clients.
To use the Optimizer service, perform the following steps:
The Optimizer service reads a number of optional ServletConfig parameters that can be configured using the META-INF/web.xml file.
Parameter | Description |
---|---|
com.ibm.ws.mobile.appsvcs.optimizer.srcPath | Identifies the absolute file system path of the dojo build. Default: dojo/ (located under the WAR file) |
com.ibm.ws.mobile.appsvcs.optimizer.cacheDeltaFactor | The Optimizer service sets the HTTP cache expiration time of resources based on a fraction of how old the on-disk representation is. This directive specifies the floating point number that the age will be divided by to determine how long clients will be permitted to cache a file. Values: Floating point literal to divide the age Default: 1000f, .01% of the age of the file |
com.ibm.ws.mobile.appsvcs.optimizer.cacheDeltaMin | When Expires or Cache-Control headers are issued by the service, this setting dictates the minimum number of seconds in the future that the resources remain cacheable. Recently updated files will be cached by clients for at least the amount of time specified in this directive. Attention: When a HTTP client caches a resource, there is no way to invalidate that at a subsequent date; therefore take care in increasing this number. Values: Number of seconds Default: 5 |
com.ibm.ws.mobile.appsvcs.optimizer.cacheDeltaMax | When Expires or Cache-Control headers are issued by the service, this setting dictates the maximum number of seconds in the future that the resources remain cacheable. Files that have not been updated for long periods of time will be cacheable by clients for no longer than the number of seconds specified in this directive. Values: Number of seconds Default: 900 |
com.ibm.ws.mobile.appsvcs.optimizer.sendExpires | Controls whether the Optimizer service sends the HTTP Expires header used by private and shared caches. Values: true or false Default: true |
com.ibm.ws.mobile.appsvcs.optimizer.sendETAG | Controls whether the Optimizer service sends the HTTP ETag header used by private and shared caches. Values: true or false Default: true |
com.ibm.ws.mobile.appsvcs.optimizer.sendCCMaxAge | Controls whether the Optimizer service sends the HTTP Cache-Control header with the max-age parameter, used by private caches. Values: true or false Default: true |
com.ibm.ws.mobile.appsvcs.optimizer.noVary | Controls whether the Optimizer service sends the HTTP Vary header to indicate that the response took into account headers such as User-Agent and Accept-Encoding. Values: true or false Default: false |
This section describes the procedure for installing the Optimizer service on Version 8.5 of the IBM WebSphere Application Server. It is assumed that you are familiar with application installation and administration for the application server.
Locate the Optimizer service enterprise archive (EAR) file that is provided with your product installation. You can find the EAR file in your installation tree where you installed the IBM WebSphere Application Server Web 2.0 and Mobile Toolkit. For example, if you installed the toolkit in the following location:
Platform | Location |
---|---|
Linux and UNIX: | /opt/WebSphere/Web20Mobile |
Windows: | c:\WebSphere\Web20Mobile |
Then you can find the EAR file at:
Platform | Location |
---|---|
Linux and UNIX: | /opt/WebSphere/Web20Mobile/installableApps/application_services/optimizer/appsvcs-optimizer.ear |
Windows: | c:\WebSphere\Web20Mobile\installableApps\application_services\optimizer\appsvcs-optimizer.ear |
Point your web browser to your application server installation: http://<application server hostname>:<port>/appsvcs-optimizer/
The application server host name and port number are specific to your application server installation. An application server default installation web container port is 9080. If you are running your web browser on the same workstation as your application server installation and have taken all the default values, then use the following URL: http://localhost:9080/appsvcs-optimizer/.