Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Configuring the DB-Engine Processor for the SRC VTA Group (SRC-CLI)

 

The SRC VTA uses the db-engine processor to update database and subscriber accounts. The db-engine processor works as a proxy to the external database. It calculates usage, updates account balances, retrieves account and active session data, and sets initial balances of subscriber accounts. A subscriber account is a record of credit and debit entries in the database that track a subscriber’s use of a particular network resource. You can also use the db-engine processor to dynamically adjust interim accounting intervals based on a service or based on a subscriber’s remaining resources and use of the network for that service. Configuring the db-engine processor involves the following tasks:

Recording Balance Changes and Calculating the Average Usage Rate (SRC CLI)

You can configure the db-engine processor to record account balance changes and calculate the average rate at which the subscriber is consuming volume in units per second, called the averageUsageRate.

The session-history-depth option determines the number of historical service session records that are used to calculate the averageUsageRate for a service. When you configure the interim accounting interval, you can specify the variable averageUsageRate_serviceName. If this variable is specified, the SRC VTA calculates the averageUsageRate for the specified service by querying the history sessions of the service over the most recent X hours, where X is defined by the session-history-depth option.

For more information, see Configuring the Interim Account Interval and Usage Metric of a Service in the External Database (SRC CLI) and Variables Used to Define the Interim Accounting Interval for Services.

Use the following statements to configure the SRC VTA to record balance changes and specify the session history depth:

Note

The CLI editing level must be set to expert to set the session-history-depth option.

To configure the SRC VTA to record balance changes and specify the session history depth:

  1. From configuration mode, access the statement used to configure the db-engine processor. For example, to configure the db-engine processor for the SRC VTA group called vta1:

  2. (Optional) Configure the SRC VTA to record balance changes.

    This option is set or not set. If it is set, every account balance change action is recorded in the database. Not setting this option requires fewer database updates and less database space.

  3. (Optional) Specify the session-history-depth (in hours) used to calculate the averageUsageRate for a service.

Configuring the Initial Balance and Status of a Subscriber Account in the External Database (SRC CLI)

Use the following statements to set the initial balance and status of a subscriber account:

To set the initial balance and status of a subscriber account:

  1. From configuration mode, access the statement used to configure database accounts. For example, to configure an account called BoughtQuota in the SRC VTA group called vta1:

  2. Specify the initial balance for the account.

    Enter the value as an integer in the range -9223372036854775807 through 9223372036854775807.

  3. Specify the initial status for the account.

    Enter the initial status as a text string—for example “active.”

Configuring Scripts That Update Accounts (SRC CLI)

You can set up scripts to update balances in the accounts from which the usage of a service is charged and update accounts by assigning values to variables for the account balances.

Use the following statements to configure scripts that update accounts:

To configure scripts that update accounts:

  1. From configuration mode, access the statement used to configure scripts that update accounts. For example, to configure a script called DebtQuotaUsage in the SRC VTA group called vta1:

  2. Specify the script parameters.

    Enter a JavaScript program that updates a subscriber’s account. The script can refer to the name of any attributes in the event being processed. An account can be updated by assigning values to the following parameters:

    • balance_<accountName>—Values written to this parameter are put in the balance field of the account.

    • status_<accountName>—Values written to this parameter are put in the status field of the account.

    • lastUpdateTime_<accountName>—Values written to this parameter are put in the last_update_time field of the account.

      For example:

Configuring the Interim Account Interval and Usage Metric of a Service in the External Database (SRC CLI)

To configure how the db-engine processor manages services, you need to specify the usage metric and the interim accounting interval options. Both of these options are configured with JavaScript variables.

Use the following statement to configure how the SRC VTA manages services:

Note

The CLI editing level must be set to expert for this task.

To configure how the db-engine processor manages services:

  1. From configuration mode, access the statement that configures the db-engine processor to manage services and specify the name of the service. For example, to configure a service called QuotaLocal in the SRC VTA group vta1:

  2. Specify the JavaScript function that defines the usage metric for the service.

  3. Specify the JavaScript variables that define the interim accounting interval for the service.

Configuring SRC VTA Database Optimization (SRC CLI)

To optimize SRC VTA database operations, you can set the sessions-terminated-frequently option.

Note

Setting the sessions-terminated-frequently option is an irreversible act. You can set this option to true, but you cannot change it back to false.

To use the sessions-terminated-frequently optimization feature with a set of SRC VTAs, you must follow this specific process:

  1. All C Series Controllers running SRC VTAs must be running SRC software release 4.3 or later; otherwise, you must upgrade the system.
  2. Send all SAE events to only one SRC VTA.
  3. Wait until the removed SRC VTAs (from Step 2) have finished processing events in their event queues.
  4. Set the sessions-terminated-frequently option to true.
  5. Wait until all SRC VTAs have reacted to the option being set. The SRC VTA information log displays the following message “DBEngine will assume VTA sessions are terminated frequently.”
  6. Resume distributing SAE events to all SRC VTAs.

Use the following statement to configure SRC VTA database optimization:

To configure SRC VTA database optimization:

  1. From configuration mode, access the statement used to configure the db-engine processor. For example, to set up SRC VTA database optimization for the SRC VTA group called vta1:
  2. Set the sessions-terminated-frequently option.

Variables Used to Define the Interim Accounting Interval for Services

Current Service Variables

Use the variables described in this section to define a formula for the interim accounting interval.

lastInterimTime

  • Last interim time interval.

  • Value—Number of seconds in the range 1–2147483647

sessionLength

  • Length of the current session.

  • Value—Number of seconds in the range 0–2147483647; value is 0 when the SRC VTA is calculating the interim time of start events. For other events, value is set by the PA_SESSION_TIME attribute.

maxUsageRate

  • Maximum rate at which the subscriber can use network resources according to the formula described in Table 49.

  • Value—Integer in the range 0–9223372036854775807

  • Guidelines—This formula corresponds to the usage formula for the same service as the interim formula.

The maxUsageRate variable is calculated for a service by means of the following values for the variables in the corresponding usage formula:

  • upStreamBytes=PA_UPSTREAM_BANDWIDTH

    • downStreamBytes=PA_DOWNSTREAM_BANDWIDTH

    • interimTime=lastInterimTime

    • upStreamPackets=0

    • downStreamPackets=0

If you use the parameters upStreamPackets (PA_IN_PACKETS) and downStreamPackets (PA_OUT_PACKETS) in the usage formula and at the same time maxUsageRate in the interim interval formula, the maxUsageRate is not accurate, because the values for maximum upStreamPackets and downStreamPackets are unknown.

averageUsageRate

  • Average rate at which the subscriber is consuming volume in units per second. The unit can be a value such as dollars, bytes, or packets. The type of unit depends on the value specified in the formula. Measurement begins when the service starts.

  • Value—Integer in the range 0–9223372036854775807; the value is 0 when the SRC VTA is calculating the interim time of start events.

For other events, the value is the usage formula divided by PA_SESSION_TIME. The usage formula is calculated from PA_IN_PACKETS, PA_OUT_PACKETS, PA_OUT_OCTETS, PA_IN_OCTETS, and PA_SESSION_TIME.

latestUsageRate

  • Rate of service usage since the last usage report.

  • Value—Integer in the range 0–9223372036854775807; the value is 0 when the SRC VTA is calculating the interim time of start events.

The value is calculated by using the result of the usage formula divided by the length of the service session since the previous usage report for the same service.

Other Service Variables

Use the variables described in this section to define an interim accounting formula that depends on usage of another service tracked by the SRC VTA.

System requirements to calculate service usage, in the form of the averageUsageRate and the sessionLength variables, can affect system performance. Using a longer interim interval means that there are fewer interim events to process, which requires fewer system resources.

averageUsageRate_<serviceName>

  • Average rate at which the service is consuming volume in units per second. The unit can be a value such as dollars, bytes, or packets. The type of unit depends on the value specified in the interim accounting formula. Measurement begins when the service starts.

  • Value—Integer in the range 0–9223372036854775807; the value is 0 when the SRC VTA is calculating the interim time of start events.

  • Guidelines—Service names can contain alphanumeric characters and dashes (–).

sessionLength_<serviceName>

  • Length of a service session for the service.

  • Value—Integer in the range 0–2147483647; the value is 0 when the SRC VTA is calculating the interim time of start events.

  • Guidelines—Service names can contain alphanumeric characters and dashes (–).

Account Balance Variable

Use the variable described in this section to obtain balance information from each of the subscriber’s accounts.

balance_<accountName>

  • Balance for the specified account before the new usage value is applied.

  • Value—Integer in the range 0–9223372036854775807

  • Example—balance_PeriodicQuota refers to the balance for the PeriodicQuota account.

Sample Formulas for Interim Accounting Interval

Table 49 provides examples of formulas to dynamically adjust the interim accounting interval for a service.

Table 49: Examples of Interim Accounting Interval

Formula

Description

return 900

Accounting interval is fixed at 900 seconds (15 minutes).

return (<balance_Periodic> + <balance_Bought>) /<maxUsageRate>

Minimum time required for the subscriber to empty the periodic and bought accounts.

return <sessionLength> >= 60*15 ? (<balance_Periodic> + <balance_Bought>) /<averageUsageRate>/2 :

(<balance_Periodic> + <balance_Bought>) /<maxUsageRate>

Half the time required for the subscriber to empty the accounts at the current average rate, or the minimum time if the session is shorter than 15 minutes.

Because the average rate may not be representative early in the session, check when the account is half empty.

Variables Used to Define the Usage Metric for Services

A usage metric is a formula that calculates usage based on an accounting event for the specified service. The formula is specified in the form of a JavaScript program and it can specify variables. When you configure a service, you need to specify the interim interval and the usage metric.

For the usage metric, you define a formula that determines the use of network resources for a service. Each service in the SRC VTA can use a different formula. You can configure the SRC VTA software to evaluate this formula for every accounting event it receives from the SAE for each quota service. The SRC VTA can then debit the result from the accounts.

Use the variables described in this section to define the formula. See Sample Formulas for Usage Metrics for the SRC VTA for examples of usage metric formulas.

downStreamBytes

  • Amount of data that the subscriber downloaded from the network since the last accounting event.

  • Value—Number of bytes in the range 0–9223372036854775807

downStreamPackets

  • Number of data packets that the subscriber downloaded from the network since the last accounting event.

  • Value—Integer in the range 0–9223372036854775807

  • Guidelines—Do not use downStreamPackets in a usage formula and maxUsageRate in the interim interval formula for the same service at the same time.

interimTime

  • Time since the last accounting event.

  • Value—Number of seconds in the range 0–2147483647

  • Guidelines—Generally, this value equals the interim accounting interval; however, it may exceed the interim accounting interval if an accounting event is lost. Similarly, the value may be less than the interim accounting interval if a stop event occurs in the middle of an accounting interval.

upStreamBytes

  • Amount of data that the subscriber uploaded to the network since the last accounting event.

  • Value—Number of bytes in the range 0–9223372036854775807

upStreamPackets

  • Number of data packets that the subscriber uploaded to the network since the last accounting event.

  • Value—Integer in the range 0–9223372036854775807

  • Guidelines—Do not use upStreamPackets in a usage formula and maxUsageRate in the interim interval formula for the same service at the same time.

Sample Formulas for Usage Metrics for the SRC VTA

Table 50 provides examples of usage formulas.

Table 50: Examples of Formulas That Calculate Use of Network Resources

Formula

Description

Function

return <upStreamBytes> + <downStreamBytes>

Number of bytes sent and received by the subscriber.

Tracks volume of data that the subscriber transfers.

return 2*<upStreamBytes> + <downStreamBytes>

Twice the number of sent bytes plus the number of received bytes.

Allows higher charges for subscribers who are operating servers.

return <interimTime>

Time the subscriber is connected.

Tracks time that the subscriber connects rather than volume of data transfer.

return <downStreamBytes>/<interimTime>

Rate of downstream data transfer.

Allows higher charges for higher transfer rates.

QuotaInternet formula:

return <upStreamBytes> + <downStreamBytes>– (<upStreamPackets> + <downStreamPackets>)*20

QuotaLocal formula:

return (<upStreamBytes> + <downStreamBytes>– (<upStreamPackets> + <downStreamPackets>)*20)/2

Formulas for separate, complementary services in a single SRC VTA.

The following expression returns the total number of bytes in the IP headers of packets uploaded and downloaded by the service, and as such is not subscriber data. It is not counted as usage.

(<upStreamPackets>+

<downStreamPackets>)*20

Provides support for two services: QuotaInternet for Internet service and QuotaLocal for local service.

Allows higher charges for Internet service than for local service. By allocating a fixed usage limit for both services to each subscriber, the formula encourages subscribers to access local resources due to decreased cost.