Samples Tutorial

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Enabling Fine Grained Caching

Fine-grained caching lets you cache a data subset, such as information that does not frequently change. Fine-grained caching is at the function level, because a function's role is to retrieve specific information.

 


Objectives

After completing this lesson, you will be able to:

 


Overview

ALDSP provides a flexible caching mechanism to manage caching of data service functions. In Part 1, you learned how to cache a function in a logical data service. However, there are situations where you may want to cache only a sub-set of information available in a particular logical data service. For example, the CustomerProfile data service includes information about each customer's profile and order information. The profile information does not change often, whereas order information constantly changes. In this situation users would like to cache the profile information for a given customer but retrieve the most recent order information from the operational system.

By defining different caching policies for the underlying customer and order physical data services, you can cache only the CUSTOMER physical data service. As a result, any request made to the logical CustomerProfile data service will be partly answered from the ALDSP Cache for customer information and partly answered from the operational system for order information.

 


29.1 Enabling Function-Level Caching for a Physical Data Service

Caching of a function in an underlying data service provides you with the ability to cache a sub-set of data within a data service function.

Objectives

In this exercise, you will:

Instructions

  1. Login to the ALDSP Console (http://localhost:7001/ldconsole/), using the following credentials:
    • User Name = weblogic
    • Password = weblogic
  2. Using the + icon, expand the ldplatform directory.
  3. Note: If you click the ldplatform name, the Application List page opens. This is not the page you want for this lesson.
  4. Click Evaluation. The Administration Control's General page opens.
  5. In the Data Cache section, select Enable Data Cache.
  6. Select cgDataSource from the Data Cache data source name drop-down list.
  7. Enter WSCACHE in the Data Cache table name field.
  8. Click Apply.

Figure 29-1 Enable Caching

Enable Caching

  1. Expand the Evaluation folder and navigate to getCreditRatingResponse.ds, located in DataServices\WebServices folder.
  2. For the getCreditRating() function, set a caching policy by completing the following steps:
    1. Select Enable Data Cache.
    2. Enter 300 in the TTL field.
    3. Click Apply.
    4. Figure 29-2 Enable Function-Level Caching


      Enable Function-Level Caching

 


29.2 Testing the Caching Policy

You are now ready to test your new fine-grained caching policy.

Objectives

In this exercise, you will:

Instructions

  1. In WebLogic Workshop, execute a test query by completing the following steps:
    1. Open CustomerProfile.ds in Test View. The file is located in the CustomerManagement folder.
    2. Select getCustomerProfile(CustomerID) from the function drop-down list.
    3. Enter CUSTOMER3 in the Parameter field.
    4. Click Execute.
    5. In the Output window, note the number of invocations and the times for the NewLookupCreditResponse and getCreditRatingResponse data sources.
  2. In the PointBase Console, check whether the cache database table was populated by completing the following steps:
    1. Start the PointBase Console, using the following command in a command prompt window:
    2. <beahome>\weblogic81\common\bin\startPointBaseConsole.cmd
    3. Use the following configuration to connect to your local PointBase database:
    • Driver: com.pointbase.jdbc.jdbcUniversalDriver
    • URL: jdbc:pointbase:server://localhost:9093/workshop
    • User: weblogic
    • Password: weblogic
    1. Click OK.
    2. Enter the SQL command: SELECT * FROM WSCACHE
    3. Click Execute to check whether the cache was populated.
    4. Figure 29-3 PointBase Console Cache Information


      PointBase Console Cache Information

 


29.3 Testing Performance Impact

The next step is to determine whether the caching policy improves query performance.

Objectives

In this exercise, you will:

Instructions

  1. In WebLogic Workshop, execute a test query by completing the following steps:
    1. Open CustomerProfile.ds in Test View. (The file is located in the CustomerManagement folder.)
    2. Select getCustomerProfile() from the function drop-down list.
    3. Enter CUSTOMER3 in the Parameter field.
    4. Click Execute.
  2. Confirm the following performance results in the Output window:
    1. Confirm that the slow Web service (NewLookupCreditRatingResponse) was never invoked due to alternate path execution.
    2. Determine whether caching the Web service helped to reduce the query execution time.

 


Lesson Summary

In this lesson, you learned how to:


  Back to Top       Previous  Next