Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
2nd Level Cache Cluster
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > The OpenAccess ORM Object Lifecycle > 2nd Level Cache Cluster

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.
This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

Overview

When deployment scenarios exist with more than one application using the L2 cache for the same database (like an application server farm), then the various caches for the same database must be synchronized. This is done in such a way, that every modifying transaction sends its eviction requests to all participants in the L2 cache cluster. This communication is done in an asynchronous fashion: There is a time window, in which one L2 cache (process A) is already evicted but another L2 cache (process B) is not yet evicted. The size of the time window depends on the cache cluster implementation chosen.

Implementation

The L2 cache cluster implementation uses MSMQ for transporting eviction messages. This implementation was chosen as MSMQ (starting with version 3) supports multicast addressing, which is perfect for a cluster of unknown size.

This implementation therefore, requires that MSMQ (version 3) is available on all participating machines. MSMQ is an optional component of Windows. In order to install MSMQ on a Windows XP system, please go to Control Panel —> Add or Remove Programs —>Add/Remove Windows Components and install Message Queuing:

On Windows Vista this component can be installed by using Control Panel —> Programs and Features —> Turn Windows features on or off and install MSMQ-Multicast Support:

The MSMQ message service installs the required code for the underlying PGM protocol. By default, this protocol is limited to a safe sending performance in a WAN environment with slow links. This affects the number of messages the messaging service needs to cache (until expiration) as well as the speed the sender can achieve.

In order to improve the sending performance for LAN environments, the following registry entry needs to be altered:

Copy Code
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\MulticastRateKbitsPerSec

This is a DWORD entry and has the default value of 560 kiloBits per second. A value of 0xffff is recommended for OpenAccess ORM usage in a LAN environment.

To limit the amount of memory MSMQ needs, the registry entry:

Copy Code
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\MessageCleanupInterval

must be set to a more reasonable value in milliseconds; the installed default is for 90 days. A recommended value is around 4000 milliseconds, as the default expiration for time-to-reach-queue is 2000 milliseconds.

Configuration

To enable the usage of the L2 cache, the Caching settings must be added within <backendconfigurations> section of the application configuration file.

To enable the usage of the L2 cache cluster, the following settings must be additionally be made in the backend configuration:

Copy Code
<backendconfigurations>
<backendconfiguration id="mssqlConfiguration" backend="mssql">
 
<mappingname>mssqlMapping</mappingname>
 
<l2CacheClusterTransport>MSMQ</l2CacheClusterTransport>
 
<l2CacheClusterTransport.multicastaddr>224.1.1.1:666</l2CacheClusterTransport.multicastaddr>
</backendconfiguration>
</
backendconfigurations>

The <l2CacheClusterTransport> setting defines the transport implementation to be used. If nothing is specified, no L2 cache cluster will be created. MSMQ is the only allowed value here at the moment.

The MSMQ cluster transport supports the following settings:

Name Description

multicastaddr

Required string value.

Controls the multi cast address and the port to use. For a list of reserved multicast addresses please see http://www.iana.org/assignments/multicast-addresses.

It is recommended to use a unique setting per database.

useTracing

Optional boolean value.

Controls MSMQ tracing facilities; messages are send with the UseTracing property when enabled. This can be used for debugging purposes.

localpath

Optional string value.

Defines the name of the receiving message queue. If nothing is specified, a default name is created by using the multicastaddr and the process id.

Since the receiving message queue is recreated during the startup of the L2 cache cluster, specifying a name for it can be handy to automatically remove a message queue left over from an aborted process.

expiration

Optional integer value.

Defines the number of milliseconds the message has time to be received. The default value is 2000.

app

Optional integer value.

Defines the app value on the message, which can be used to filter messages in external tracing clients. All participants in a L2 cache cluster must use the same value. The default value is zero.

If unknown settings are made on the MSMQ cache transport, an exception is raised.

In order to control the behaviour of the L2 cache or L2 cache cluster, various performance counters are available, which have been described in Level 2 Cache and Level 2 Cache Cluster Metrics.