Sie sind auf Seite 1von 19

webMethods 9.

7 Terracotta Integation - Exercises

TABLE OF CONTENTS
Exercise 1: Service Caching with Terracotta ....................................................... 3
Exercise 2: Caching with Big Memory ................................................................ 9
Exercise 3: Handling big XML Documents ......................................................... 14

4BS Solutions

www.4bs-solutions.com

webMethods 9.7 Terracotta Integation - Exercises

Exercise 1:
Service Caching with Terracotta
Ov er v ie w
In this exercise you test service caching and how it works with the new terracotta cache

Ta sk
1. Enable the package V97TrainingESBSupport using the Integration Server package
management on your VM before starting the first Exercise. Use IS Administration Web UI at
http://localhost:5555
2. Create a new package called V97TrainingESB with a child folder called V97TrainingESB.
3. Within the folder V97TrainingESB, create a folder called caching.In the upcoming steps you
will create a service that is used as cached service candidate
4. In order to test caching, we need a service that we are going to cache. This will be a service
called fak computing n! = 1 * 2 * 3 * * n for a given value of n. To simplify affairs, a java
prototype called javaFak already exists for you. Besides computing the n! function, it also
keeps track how often it was invoked. This counter can be read by invoking the
getAndWipeCalls service, which resets the call counter as well.
5. Create a Flow service called fak as shown below:

4BS Solutions

www.4bs-solutions.com

Note: The input array for preserve in step 2 contains one entry, fak (3 letters, no quotes).
6. Create a test service
Next create a test Flow service called testCaching as shown below. This service invokes fak
with the arguments {1,1}; {1,2,2,1}; {1,2,3,3,2,1} up to {1, 2,, 9, 10, 10, 9, , 2. 1} and tests
the number of invocations after every call. To construct the argument sequences, another
service,called constructArgumentArray is provided.

7. Verify Open the ServiceResults cache in the IS Administration UI (http://localhost:5555).


This is where the cache can be configured. Some fields are greyed out because they cannot
be changed with the Cache Manager running (there is a service in WmRoot to get around
this). You will notice that Maximum Elements in Memory and Maximum Elements on Disk
have been set to 5 so that the service results caching can be properly demonstrated. These
are not meant to be recommended values for a typical ServiceResults cache on the
Integration Server. You do not have to make any changes for this exercise:

webMethods 9.7 Terracotta Integation - Exercises

8. Run the service testCaching without enabling caching in the fak service (Cache results
property set to False). Verify it produces the following result in the server log:

4BS Solutions

www.4bs-solutions.com

Note the number of calls to fak is 2 * N, just as expected. This proves that the results are
not cached.Run the Flow service V97TrainingESBSupport.support.caching:dumpServiceCache
to display the content of the service cache. You will notice that there are no keys stored.
Note that this service is not suitable for caches containing a lot of keys. The service is shown
here:

webMethods 9.7 Terracotta Integation - Exercises

9. Set Cache Results to True in the fak service and run the service testCaching again:

4BS Solutions

www.4bs-solutions.com

Hint: Task 27.

webMethods 9.7 Terracotta Integation - Exercises

Exercise 2:
Caching with Big Memory
Ov er v ie w
In this exercise you will create a new Cache Manager and Cache that uses BigMemory. You will
then create and test a service that uses this cache.

Ta sk
1. Form 1. To use BigMemory with the Integration Server (and Ehcache) you must have the
appropriate license. To verify a license includes BigMemory, open the IS Administration Web
UI and navigate to Settings > License > License Details:
BigMemory should = yes.
2. Set the amount of memory that you want to allocate to BigMemory. To do this, change
MaxDirectMemorySize to 500M in ${InstallDir}\IntegrationServer\bin\setenv.bat

3. Start the Server


4. Create a new Cache Manager called TestCacheManager and a cache called Data that is
configured to use BigMemory. Use IS Administration Web UI and the following screen shots to
do this:

4BS Solutions

www.4bs-solutions.com

After completing this step, you have a cache called Data managed by a cache manager called
TestCacheManager that can hold 10 MB of data in BigMemory. These are not realistic values
for BigMemory but they get the point across. BigMemory can be used to have off heap storage in
hundreds of GIGAbytes!
Save your changes, and then start the Cache Manager (this will enable the cache).

webMethods 9.7 Terracotta Integation - Exercises

Now you will write a service to fill the cache with data.
5. To fill the cache, you need to create a few objects on IS. First create the following
document type:
V97TrainingESB.fillCache:cacheData:

Note: randomData is of type Object List with Java wrapper type set to java.lang.Byte
6. Finally, create a Flow service called filler in the fillCache folder to store random data in the
cache as shown below. Set the Repeat on property to SUCCESS

4BS Solutions

www.4bs-solutions.com

webMethods 9.7 Terracotta Integation - Exercises

Now start the filler service and look how it slowly fills your cache with data. From a command

window, you can use the ${CourseDir}\ListCache.bat procedure to inspect the content of your
cache. Make sure you run env.bat first in ${CourseDir}.
You will notice the service generateRandomData will keep running and running and running
(because of the Repeat on Success). You can cancel it using the IS Administration Web UI (Server
> Statistics > System Threads). Click the yellow checkmark beside the service to cancel it.

4BS Solutions

www.4bs-solutions.com

Exercise 3:
Handling big XML Documents
Ov er v ie w
In this exercise you learn how the Terracotta cache and Big Memory are used to load big XML
Documents.

Ta sk
1. Setup environment
2. Start a command prompt window, execute Env.bat
3. Copy BigXML folder to
${InstallDir}\IntegrationServer\packages\V97TrainingESBSupport\pub\BigXML
4. Try to load a small (800KB) XML document from the server by typing the following command
in the command prompt:
curl -u Administrator:manage
http://localhost:5555/V97TrainingESBSupport/BigXML/rfclistSmall.xml
5. Create Flow service called loadBigXML to load an XML document as shown below:

6. Run this service. The file rfclistSmall.xml should load successfully.


7. Now change the url to load the file rfclist.xml (about 220 MB) in the same folder. Your load
operation will fail with an error similar to the one below:

webMethods 9.7 Terracotta Integation - Exercises

8. Configure IS to handle big XML documents.


Allocate a bit more than 1 GB Direct Memory to handle big XML. Remember we used some
Direct Memory in the exercises before this exercise.

Restart Integration Server.


9. Create a service Flow service called loadBigXMLEx to load big XML files as shown below:

4BS Solutions

www.4bs-solutions.com

10. Next configure the IS to use Enhanced XML Parsing so that it uses Caching and BigMemory.
In the IS Administration Web UI go to: Settings > Enhanced XML Parsing Edit the settings
using the screenshot below as guidance. Save your changes and then enable Caching and Big
Memory Caching.

11. Now run the service loadBigXMLEx to load your big document. The load process takes about
40-60 seconds, depending on your machine. Look at the Performance information in Task
Manager and then the Peak Usage Statistics in the IS Administration Web UI. The Peak Usage
stats will show you how much Big Memory was used. Note: you will have to refresh the IS
Admin web page to see the updated Peak Usage stats.

webMethods 9.7 Terracotta Integation - Exercises

4BS Solutions

www.4bs-solutions.com

12. Once you successfully loaded the document, create a Flow service called queryXML to query
your loaded document as shown below:

webMethods 9.7 Terracotta Integation - Exercises

This page intentionally left blank.

4BS Solutions

www.4bs-solutions.com

Das könnte Ihnen auch gefallen