This article refers to legacy products, components or features. Therefore, the content in this article is offered "as is" and will no longer be updated. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.
Previously when the users specified in a role were authenticated, the K2 Host Server would use Active Directory directly to do this. When there are a large number of users, the call to Active Directory can take a while, up to 60 seconds if not longer to complete. This may be the cause of performance issues.
A feature enhancement enables the system to cache K2 Roles and the role properties local to the K2 Host Server Database. This article will describe how to add the roles to the database and then configure the refresh rate of the Role Cache.
|Note: The roles specified in this article are K2 roles created in K2 Workspace|
The first step is to create a Role or Roles from within K2 Workspace. Once the role has been created it is visible from within the database table and the newly created role requires configuration. The next step requires SQL skills.
To learn more about K2 Roles, locate the following topic K2 Workspace > K2 Management Console > Workflow Server > Processes > Workflow Server - Processes: Roles in the K2 blackpearl CHM.
Configure Role Cache
Once you have created a role(s) they must be configured. See the steps below:
Configure Database Insertion
Two new database tables are available in the K2 HostServer database and include columns which can be configured by changing their values. The value changes are simple, and include a time interval in seconds and 1 (one) of two Boolean values being set to True, left as Null or set to False.
Steps to configure the Role cache
- Identify the name of the role in the RoleName column
- Set the interval e.g. 300 (equal to 5 minutes)
|Note: This value should be less than the value set in the K2HostConfiguration File|
Set IsCachable = True (If IsDynamic = True then IsCachable is ignored!)
IsDynamic must be false, otherwise the role is ignored for caching. IsDynamic cannot be equal to NULL in the Database.
Illustrated below are the steps described in the list above.
[Figure 1. Database table showing configurable settings]
|Note: If IsDynamic is set to True, this setting takes priority over the IsCachable settings and that particular role would not be cached. The URM service will bypass the cache table for that role and query Active Directory for role authentication and properties.|
K2HostServer Config File Settings
The polling interval must be set as the final configuration step. This setting applies to the entire list of roles that have been enabled as cachable and determines how often the roles cache will be checked for which roles need to be refreshed. The polling interval set in the K2 Host Server configuration file should be a relatively shorter duration than the interval in the database for the individual roles to ensure that the cache for any one particular Role is re cached when it’s interval period has been exceeded.
<add key="addomain" value="MyDomain" />
<add key="applicationdomain" value="MyDomain" />
<add key="dependancyservice" value="SourceCode.Hosting.Services.DependancyService" />
<add key="port" value="5555" />
<add key="sessiontimeout" value="20" />
<add key="useassemblyregistration" value="false" />
<add key="AlwaysUseDefaultLabel" value="true" />
<add key="dbconnretries" value="100"/>
<add key="dbconnretrydelay" value="30000"/>
<add key="RoleCachePollingInterval" value="10" /> <!-- Set time in seconds for Role Cache-->
|Note: Any changes to the K2 Host Server configuration file will require a server restart. This will interupt normal operations for the duration of the restart.|
How often should the cache be refreshed?
The Role Cache feature is intended as a performance enhancement. Refreshing the roles too often would negate the benefits of the enhancement as this would then be the same as a call to Active Directory for each time that a Role Authentication is required.
Which roles to cache?
|Note: The following should be applied liberally as a guideline and not a rule! All systems are different and the effect that the role cache feature may have as an enhacement will differ from system to system. Some expirementation, along with a performance monitoring tool may be required to achieve maximum results.|
- Roles that are used frequently and are more or less static, should be cached with a long interval period
- Roles that change often can be cached with a shorter interval period
This Hotfix is contained within the latest K2 blackpearl 0807 Update. Install the update package to resolve the error.
The latest K2 blackpearl 0807 Update is available as an independent installation package which can be found here: https://portal.k2.com/downloads/bp/default.aspx