The Administrator's two main tasks are to confirm the cache application.ProgramThe initial deployment of a block is planned and manageable, and it is confirmed that subsequent deployment updates only have the least impact on the existing applications that use the application block. This topic addresses these issues and the following management tasks:
Deploy cache application blocks
Update cache application blocks
Measure cache application block
Deploy cache application blocks
The cache application block consists of multiple sets. The file names of each Assembly that belongs to the cache application block are
Microsoft. Practices. enterpriselibrary. caching
Start. In addition, application blocks depend on usable datasets.Objectbuilder
Subsystem, depending on the configuration file of the application that uses the Application Block. It may also require data access to application block assembly, Security Application Block, and encryption application block assembly. Applications that use cached application blocks can be deployed in one of the following configurations:
Deploy the cache application block as a private assembly
If the application does not need services cached by the global assembly, the cached application block can be deployed in the directory structure of the application. This simplifies the deployment because you can use
Xcopy
Command to install the entire application on the target machine, including the cache application block. If multiple applications on the same machine use cached application blocks, you can install a copy of the block set at the folder level of each application. In this way, the Assembly copies of each application can be updated independently.
Deploy the cache application block as a shared assembly
You can add a strong name to the cache application block, Visual Studio. NET and. NET Framework SDK.
The corresponding tools are included. After the Assembly is strongly named, it can be deployed in a shared location and used by multiple applications. You can select to deploy the Assembly to any file system location and add
<Codebase>
Element to specify the location of the Assembly. For Enterprise Library
For more information on Strong names, see strongly-named Enterprise Library assembly.
A better scenario is to deploy the shared assembly to the Global Assembly Cache. In this scenario, all applications on the machine can use an assembly without any other configuration. Global Assembly Cache also supports component services (such as transaction management) and version management. You can install the assembly to the Global Assembly Cache using one of the following methods:
Use the installer, such as Microsoft Windows Installer 2.
Use the Global Assembly Cache command line utility (gacutil.exe ).
Use the. NET Framework Configuration tool (mscorcfg. MSC ).
Move the assembly to the folder of the global assembly.
Update cache application blocks
If there is an available cache application block update, you can install the update so that all applications can use the updated version. However, if the updated version causes compatibility issues for specific applications, install the updated version to the Global Assembly Cache and configure some applications to use the updated version, others continue to use earlier versions.
Update private assembly
If the cached application block assembly is deployed as a private assembly, you can use the updated DLL to replace the DLL of earlier versions in the application folder hierarchy.
To deploy updates.
Note:
Replicas of earlier versions must be retained to use earlier versions for recovery if compatibility issues occur with the updated assembly.
Update shared assembly
The easiest way to update the cache application block assembly in the shared configuration is to update the updated DLL
Install it in the global assembly cache. By default, the general language runtime will try to load the application build using the same primary and secondary version number, while building and modifying the latest Assembly version number. Therefore, if the primary and secondary version numbers do not change, all applications that reference the cached application block assembly will be automatically updated after the updated version is added to the Global Assembly Cache.
If the primary or secondary version number has been increased, or if the updated version causes compatibility issues with existing applications, You can override the default version policy. To specify a specific version of the assembly to be used, edit<Bindingpolicy>
(Used for separate applications) or machine policy files. Another option is to distribute the updated assembly version together with a publisher policy file to redirect the Assembly request to the updated version.
Measure (Instrumentation) cache application block
There are some configuration sections in the application configuration file for enabling/disabling metrics. They are optional, but they must both exist or do not exist. If you ignore them, it is equivalent
False.<Configsections>
Section is specified
System. Configuration
How to read the actual configuration data from the database, while the actual data is stored in
<Instrumentationconfiguration>
Section. Set the value to true to enable measurement. Set the value
False. Three types of measurements are performance counters, event logs, and Windows management instrument (Wmi)
Event. The configuration section for measurement is as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<Configuration>
<Configsections>
<Section name = "instrumentationconfiguration"
Type = "Microsoft. Practices. enterpriselibrary. Common. instrumentation. configuration. instrumentationconfigurationsection,
Microsoft. Practices. enterpriselibrary. Common, version = 3.1.0.0, culture = neutral, publickeytoken = NULL "/>
</Configsections>
<Instrumentationconfiguration performancecountersenabled = "true" eventloggingenabled = "true" wmienabled = "true"/>
</Configuration>
Cache application block performance counters
Table 1 describes the performance counters of cached application blocks.
Table 7.5. cache application block performance counters
Performance counters |
Description |
Cache expiries/sec |
The expiration rate of the cached entry. |
Cache hit ratio |
Cache hit rate. Cache hit occurs when the request is cached. |
Cache hits/sec |
The speed at which the cache receives the request containing the entries. |
Cache misses/sec |
The rate of requests received by the cache for items not included. |
Cache scavenged items/sec |
The speed of clearing entries from the cache. |
Total cache entries |
The number of entries in the cache. |
Total # of cache access attempts |
Total number of reads from the cache. |
Updated entries/sec |
The speed of updating entries in the cache. The update can beAdd OrRemove . |
The rate counter shows the increase in the number of events over time, and regularly separates the changed values to display the activity rate. For more information about performance counters, see msdn.
Performancecountertype In the. NET Framework class library
Enumeration.
Cache Application Block Event Log entity
Table 1 lists the entity of cached Application Block Event Logs. The listener column contains the trigger event class, the event column contains the event name, the exception column contains the exception Boolean value, and the main error message in the main message column, all available additional information is contained in other columns.
Table 7.6. cache application block Event Log entities
Listener |
Event |
Exception |
Main message |
Others |
Cachinginstrumentationlistener |
Cachefailed |
True |
When using an instanceInstance name An error occurred. |
Failed to start the refresh action for a specific application. |
Cachinginstrumentationlistener |
Cachecallbackfailed |
True |
Run for instanceInstance name Key in Key An error occurred while removing the callback. |
Not applicable. |
Defaultcachingeventlogger |
Configuration Error |
True |
Get for instanceInstance name Configuration error. |
Not applicable. |
Configurationchangewatcher |
An error is reported, indicating a change in the configuration. |
Not applicable |
This is a message that triggers the watcher type full nameexception. . |
|
Cache Application Block WMI events
You can use the following windows management instrument
(Wmi) Events measure cache application blocks:
The following table describes the attributes of each WMI event.
Table 1 describesCachefailureevent
The properties of the WMI event.
Table 7.7. cachefailureevent attributes
WMI attributes |
Description |
Errormessage |
Error message Describing failed cache activity. |
Predictionmessage |
A message that is used to trigger an exception when the cache activity fails. |
InstanceName |
The ID of the failed cache manager is the name specified in the configuration file. |
Utctimestamp |
The time when the cache activity fails. |
Table 2 describesCachecallbackfailureevent
WMI
Event attributes.
Table 7.8. cachecallbackfailureevent attributes
WMI attributes |
Description |
Key |
The key of the expired entry. |
Predictionmessage |
The exception message triggered when the callback of the notification application entry expires. |
InstanceName |
The ID of the failed cache manager is the name specified in the configuration file. |
Utctimestamp |
The time when the callback fails. |
Table 3 describesCachescavengedevent
The properties of the WMI event.
Table 7.9. cachescavengedevent attributes
WMI attributes |
Description |
Itemsscavenged |
The number of items to be cleared from the cache. |
InstanceName |
The ID of the cache manager to which the entry will be cleared is the name specified in the configuration file. |
Utctimestamp |
Time when the event is cleared. |
Table 4 describesCacheconfigurationfailureevent
WMI
Event attributes.
Table 7.10. cacheconfigurationfailureevent attributes
WMI attributes |
description |
predictionmessage |
An exception message that is triggered when a cache manager fails to be created or configured. |
InstanceName |
the ID of the cache manager that cannot be created or configured is the name specified in the configuration file. |
utctimestamp |
the time when the configuration change occurred. |