Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In the context of memory profile analsysis we are documenting the current bahavior of some caches in UserIstance class.

Abstract:

A cache is a repository used to store previously fetched resources, also known as objects. Caching provides two main benefits to a web application

  • Your web application will be more responsive to the user because the interpreter will get access to your content more quickly. A responsive application is a key facet to increased customer satisfaction.
  • The load on your Web servers is theoretically reduced at least in terms of CPU utilization. It might put more pressure on the memory utilization.

Caching Strategy:

To implement a successful caching mechanism a very well planned caching strategy is a key factor. The key issues that needs to be resolved are as follows

  • Which pages should be cached
  • Cache whole pages or page fragments
  • Where caching should take place
  • How to invalidate the cached data

UserInstance Cache:

Two member variables of UserInstance class are used to maintain this cache implementation (a home grown cache implementation).
1- systemCache (see UP-1145)
2- systemCharacterCache

...

  1. If user clicks on any channel to minimize, it will be cache miss.
  2. If user clicks on same channel to restore it to its original size, it will be cache miss.
  3. If user interacts with one channel within the tab then it is a character cache hit.
  4. Channel that tends to go in focus mode (e.g email) will have cache miss.
  5. After that if you interact with the channel it will be cache hit. Eg. If you navigate through pages of the channels it will be cache hit.

Cache key dissection

The following is a dissection of the cache key.
An example key:

...

<ulayout-mgr-cache-key>: 7885417921252830597

How each value is obtained:

1. <person-id>: 399820

  • an integer identifier - obtained from the UserInstance instance:
    getPerson().getID()

...

  • defined in SimpleUserLayoutManager.getCacheKey() - it is a random long

Notes

I believe there are thread contention issues with these two variables (systemCache UP-1145 and systemCharacterCache) since both are not synchronized and reads and updates are not made within the synchronized blocks either.

Example systemCharacterCache markup.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en"><head><title>myRutgers</title><meta content="text/html; charset=iso-8859-1" http-equiv="content-type" /><link type="image/x-icon" href="favicon.ico" rel="Shortcut Icon" /><link type="text/css" href="media/edu/rutgers/acs/portal/layout/tab-column/rutgers-theme/myrutgers1/skin/myrutgers1.css" rel="stylesheet" /></head><body><div id="portal-page-header"><div id="logo"><img alt="myRutgers Logo" src="media/edu/rutgers/acs/portal/layout/tab-column/rutgers-theme/myrutgers1/institutional/uportal_logo_grid.gif" height="60" width="255" /></div>

...