# Percent-Based Rates for Rate-Limit Profiles Overview

Percent-based rate-limit profiles enable you to divide the reference rate as percentages instead of specific values. You can specify the reference rate on each interface and specify these rates in terms of percentage of this reference rate within the rate-limit profile to derive the appropriate rate. This enables you to define rate-limit profiles with rates in terms of percentage and bursts in terms of milliseconds.

You can use percent-based rate-limit profiles to:

- Configure rates in rate-limit profiles based on a percentage of a parameter. You can assign values to these parameters at the time of attachment, which enables you to use the same policy for multiple interfaces with different parameter values.
- Specify burst sizes in milliseconds when you configure percent-based rate-limits.
- Provide a generic way to configure and use policy parameters. You can use parameter names when you create policy objects and defer assigning values to these parameters until policy attachment. This enables you to share policy objects by attaching the same policy at multiple interfaces with different parameter values. You do not have to specify values each time you attach a policy; if you do not specify interface-specific, the system uses the global value.

## Policy Parameter Reference-Rate

You can use a policy parameter reference-rate to derive the rates in rate-limit profiles. You can configure rate-limit profiles as a percentage of this parameter. The system calculates the rate at the time of attachment using the value assigned to this parameter for that interface.

If you do not specify a value for this parameter in Interface Configuration mode, then the Global configuration value is used.

You can modify the value of this parameter in Global Configuration mode or Interface Configuration mode. In Interface Configuration mode, you can change the value using the increase keyword.

If you use the no version of the command in Interface Configuration mode, the parameter value is set to the global default value. The no version of the command with the increase keyword decrements the value. The parameter value cannot have a negative value. The no version of the command in Global Configuration mode deletes the parameter if it is not used anywhere else.

Modified values affect the rates in the rate-limit profiles that are using the reference-rate parameter.

| Note: Beginning with JunosE Release 10.3.x, you cannot modify the policy reference-rate parameter in Interface Configuration mode, if the percent-based rate-limit profile is used in external parent groups. If you attempt to change the reference-rate parameter that is referenced by multiple classification operations using the policy-parameter reference-rate command at the interface level, an error message is displayed in the CLI interface. This restriction exists because multiple interfaces might refer to the same external parent group resource and to prevent such interfaces from losing their reference to the older external parent group resources. However, you can modify the percent-based rate-limit profiles for external parent groups at the hierarchical rate-limit profile level.

## Specifying Rates Within Rate-Limit Profiles

Within a rate-limit profile you can specify the rate either as a percentage or a specific value. In two-rate rate-limit profiles, you can select committed rate and peak rate. You can specify one rate in terms of percentage and another as a specific value. Also, one rate can be a percentage of one parameter and another rate can be a percentage of another parameter.

If the rate in a rate-limit profile is x percent, then the actual rate can be calculated from a parameter value as:

Actual rate (in bits per second) = (parameter value *x)/100

The committed rate can be in the range 0—100 percent of the parameter value. The peak rate can be in the range 0—1000 percent of the parameter value.

The parameter value derives the appropriate rate within the rate-limit profile using a percentage. There are no validations to make the total rate less than or equal to the parameter value.

## Specifying Burst Sizes

Within a rate-limit profile you can specify the burst size in milliseconds or bytes. Because rate-limit profiles have multiple rates and no restrictions, you can specify one burst in terms of milliseconds and another as bytes whether or not the corresponding rate is a percentage.

If the burst size is m milliseconds, it is calculated as:

Burst size in bytes = (rate in bps * m) / (8*1000)

In this example, the burst size can be in the range 0—10000 ms (10 seconds).

The maximum burst size is 4294967295 bytes (32 bit).

If you do not set the burst size, the system sets the default committed burst and peak burst to 100 ms. If the default burst size is less then 8192, the system changes it to 8192.

## Using Service Manager with Merged Policies

When you use the Service Manager, you can attach multiple policies to the same interface point with the merge keyword and these policies are then merged into a new policy. The increase keyword enables you to change the parameter value for the profile.

If you activate the service without the increase keyword, the interface-specific value of the parameter is set to the value specified in the profile. However, if you activate the service with the increase keyword, the interface-specific value of the parameter increases by the value specified in the profile. If there was no interface-specific value at the time of activation of the profile with the increase keyword, then it increases from 0.

If you deactivate the service that used the increase keyword, the value of the parameter decreases. But if the profile did not use the increase keyword, deactivation does not change the current interface-specific value for that parameter. The interface-specific parameter remains until the interface is deleted.

## Policy Parameter Configuration Considerations

The following list describes the rules for using policy parameters:

- Policy parameter names must be unique regardless of its type. If you configure a policy parameter with a reference-rate type, then you cannot configure it with another type until it is deleted.
- You can create policy parameters in Global Configuration mode and in Interface Configuration mode in any order.
- In Global Configuration mode, you can assign a parameter type to a parameter name and assign a default value for this parameter.
- If a parameter is configured in Global Configuration mode, but you do not assign a default value, then the system assigns a default value to the parameter. The system default value for any parameter of type reference-rate is 64K (65536).
- In Interface Configuration mode, you assign a parameter type and value for an interface. Policy parameters configured in Interface Configuration mode that have interface-type IP, IPv6, or L2TP specified with the command associate the command with the respective interface in the stack.
- If a parameter is configured in Interface Configuration mode without configuring it in Global Configuration mode, a global configuration is automatically created for this parameter with the type specified in interface configuration and a system-specified default value.
- A parameter value specified in Interface Configuration mode overrides the value specified in Global Configuration mode.
- If the parameter is not configured in Interface Configuration mode, the value from the global configuration is used. If the global value satisfies most of the interfaces, then you do not have to configure parameters for each interface separately, which reduces the number of configuration steps you need to take.
- When you delete an interface, the interface-specific configuration of the parameter is deleted. However, the global configuration remains until you delete it whether it was created explicitly in Global Configuration mode or automatically created in Interface Configuration mode.

  For example, you can configure policy parameter param1 of type reference-rate in Global Configuration mode with a default value of 100,000 and then configure it as 200,000 in Interface Configuration mode for inf1. If you configure a policy parameter as 500,000 in Interface Configuration mode for interface inf1, the system automatically creates parameter param2 with a 64K (65536) global default value. When you delete interface inf1, the system deletes the interface-specific configuration for param1 and param2, but the global configuration values of 100,000 and 64K (65536) remain until you explicitly delete them.

- You must create policy parameters in either Global Configuration mode or Interface Configuration mode before they can be used or referenced as policy objects. For example. before you define a rate in a rate-limit profile in terms of percentage of a policy parameter param1, you must configure param1 as parameter type reference-rate.
- You can configure multiple policy parameters; there are no restrictions on the number of parameters.
- If you modify a policy parameter value in Interface Configuration mode, it affects all policies attached to that interface. If a parameter value is changed for an interface, only the input, secondary-input, and output policies attached to that interface are affected by this change.
- If you modify a policy parameter value in Global Configuration mode, it affects all policies attached to all interfaces that use the global values. For example, if parameter param1 is used in policies attached to two interfaces, but param1 is only configured for interface i1, when you modify the default value for param1 in Global Configuration mode, it affects only the attachment on the second interface i2.
- You can specify a rate within a rate-limit profile as a percentage of the parameter and burst size in milliseconds. You can use this rate-limit profile in a policy. You can assign values to these parameters for an interface. The actual rate and burst size are calculated at the time of attachment. You can attach the same policy to multiple interfaces with different parameter values.
- A hierarchical rate-limit profile that contains percentage-based parameters can be used in an external parent-group and the global default values can be changed for each external parent group instance. The following restrictions apply:
  - When you attach policies that reference such same external parent group instances to each interface, you must specify the same reference-rate policy-parameter value.
  - You cannot change the reference-rate policy-parameter values at interface level when a policy attachment to the interface exists.