Example - changing the Canister safety limits

About this task

In Release 7.2 and earlier, the Canister safety limits were controlled by three settings for the Canister. These settings defined limits for:

  • Maximum number of hits in a session
  • Maximum total bytes in a session
  • Maximum total time in seconds in a session

In Release 8.0 and later, these limits are managed through Canister Safety Limits [BB], a Discover Standard Event that accesses three Discover session attributes.

Through Advanced Mode in the Event Manager, you can edit the JavaScript definition of the Canister Safety Limits event. Below is the default definition.


// Canister Safety Limits [BB]
function PALI$E_SAFETY_LIMITS()
{
  //Default: 2048 Hits
  if ($S.NumberOfHits > 2048)
    TLCloseSession.CloseForSafetyHits();

  //Default: 5242880 Bytes (5MB)
  if (($S.TotalREQBytes + $S.TotalRSPBytes) > 5242880)
    TLCloseSession.CloseForSafetySize();

  //Default: 3600 Seconds (60 minutes)
  if ($S.TotalTime> 3600)
    TLCloseSession.CloseForSafetyTime();
}

Procedure

  1. Edit the event for the canister safety limits.
    Note: You should verify the other settings in the event before switching to Advanced Mode. After you switch to Advanced Mode, returning to Basic Mode removes all JavaScript changes you made during the current edit.
  2. When you finished editing the basic properties of the event, click Advanced Mode.
  3. In the table below, you can review the canister safety limits, which are session attribute variables that are maintained by the Discover Canister. If any of these values are exceeded, then the active session is automatically closed by the Canister and written to disk. Subsequent hits that are collected by the Canister for the same visitor session are assigned to a new Discover session identifier.
    Table 1. Example - Changing the Canister safety limits
    JavaScript Variable Default Value Description
    $S.Number OfHits 2048 Maximum number of hits that are allowed in a single session.
    $S.Number OfHits + $S.Total RSPBytes 5242880 Total number of bytes allowed in all requests and responses of a single session. Default value is 5 MB.
    Note: If DOM capture is enabled (EnbableDomCapture=1), you might need to increase the byte size from the default value. DOM Capture can incur additional processing and network transmission cost - increasing the byte size accommodates the additional costs and can prevent the session from splitting too early. Consult Discover Professional services to determine if your DOM Capture solution requires you to increase the byte size.
    $S.Total Time 3600 Maximum time in seconds allowed in a single session. Default value is 1 hour.
  4. To change the values, enter a new value where you see the default value in the JavaScript.
  5. When you changed all values as needed, click Save Draft.
  6. The JavaScript is validated for you before saving.
  7. After you h saved your session, you should test it in the Event Tester, where you can load a session that exceeds one of your defined limits. See Event Tester.
  8. After you tested the event, save it to the server.
  9. The new canister safety limits are applied to all subsequent sessions.

Results

Note: This event references a set of session attributes that are also sources for the following Discover building block events:
  • Costly Session - Too Long
  • Costly Session - Too Many Hits
  • Costly Session - Too Big

After you modified the Canister Safety Limit event, the above events continue to fire and cannot be disabled, which may cause confusion for some users. However, you can clear the Display in Portal option for these events to limit user interaction with them. You might also consider changing the description to include NOT_USED or similar, as well as adding them to a special event label.