Boost performance by 60% with WebSphere Servlet Caching
December 7, 2009 – 11:55 amrks on the topic of Servlet Caching:
Servlet caching
=0A=0A
WebSphere Application Server=E2=80=99s DynaCache pro=
vides a general in-memory=0A caching service for objects and=
page fragments generated by the server.=0A The DistributedMap and DistributedObjectCache interfaces can be used=0A =
within an application to cache and share Java objects by storing=0A =
references to these objects in the cache for later use. Servl=
et caching,=0A on the other hand, enables servlet and JSP re=
sponse fragments to be stored=0A and managed by a customizab=
le set of caching rules.
=0A=0A
In the DayTrade=
r application, a Market Summary is displayed on every access=0A =
of a user’s home page. This summary contains a list of the top five=0A =
gaining and losing stocks, as well as the current stock inde=
x and trading=0A volume. This activity requires the executio=
n of several database lookups=0A and therefore significantly=
delays the loading of the user’s home page.=0A With servlet=
caching, the marketSummary.jsp can be cached, virtually=0A =
eliminating these expensive database queries to improve the response time=
=0A for the user home page. The refresh interval for the cac=
hed object can be=0A configured, and is set to 60 seconds in=
the example shown in Listing 1.=0A Dynacache could also be =
used to cache other servlet/JSP fragments and data=0A within=
DayTrader. This example demonstrates the improvement you can=0A =
achieve through caching to avoid complex server operations.
=0A=0A =
Servlet caching can be enabled in the administrati=
ve console by navigating=0A to Servers =3D> Applicatio=
n servers =3D> server_name=0A =3D> Web cont=
ainer settings =3D> Web container. The URI=0A path to=
the servlet or JSP to be cached must be defined in a cachespec.xml=0A =
file, which is placed inside the Web module’s WEB-INF directory.=
For the=0A marketSummary.jsp in DayTrader, the cachespec.xm=
l looks similar to Listing=0A 1.
=0A=0A=0A =0A=
Listing 1. cachespec.xml=0A =0A
=0A=0A =0A =
Figure 14. Performance benefit of=0A =
servlet caching
=0A
More details, see:
http://www.ibm.com/developerworks/websphere=
/techjournal/0909_blythe/0909_blythe.html
.pw.
=0A=0A
You must be logged in to post a comment.