WLDF supports actions for policies to be triggered according to a calendar schedule at a specific time, after a duration of time, or at timed intervals. Calendar-based scaling executes a scaling action based on a defined schedule.
Calendar-based rule schedules are only supported for Harvester
rules that utilize the Java Expression Language (EL) as the expression language. The following policy types support calendar-based rule schedules:
Calendar-based
Smart rule-based
Collected metrics
To configure calendar-based scaling, you create a policy and define the policy's schedule, then create and assign a scaling action to that policy.
Policy schedules can be set to set to execute based on the following:
Every N seconds
Every N minutes
Every N hours
Specific days of the week (at a specific time)
Specific days of the month (at a specific time)
Policy schedules are based on the WLDFScheduleBean
. Table 6-1 lists the attributes used for setting policy schedules.
Table 6-1 WLDFScheduleBean Attributes
Attribute | Default Value | Allowable Values |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
* (every month) |
|
|
|
|
|
n/a |
|
|
|
|
These attributes can be specified in several ways using the following syntax . This syntax is supported by the EJB ScheduleExpression
class. See the ScheduleExpression
documentation for full details about this syntax.
As a single value. For example:
second = "10" month = "Oct"
Using a wild card (*), which represents all of the attribute's allowable values. For example, to specify every day of the week:
dayOfWeek = "*"
As a range, which constrains the attribute to an inclusive range of values. You specify the two ends of the range, separated by a dash (-). For example:
second = "1-10" dayOfWeek = "Mon-Fri"
As an increment, which constrains the attribute based on a starting point and an interval, using a slash (/) to separate the two values. The use of increments is supported only for specifying second
, minute
, and hour
attributes. For example:
minute = "*/5"
specifies every five minutes. This syntax is equivalent to minute = "0,5,10,15,20,25,30,35,40,45,50,55"
second = "30/10"
specifies every 10 seconds within the minute starting at second 30. This syntax is equivalent to second = "30,40,50"
Note:
When the maximum value for an attribute is reached, the incrementing stops. That is, it will not exceed the maximum allowable value.
As a list, which constrains the attribute to two or more allowable values, or range of values, using a comma-separated list. Each list item must be a value or range; list items cannot be wild cards, lists, or increments. For example:
second = "10,20,30" dayOfWeek = "Mon,Wed,Fri" minute = "0-10,30,40"
Note:
Before you configure calendar-based scaling in your domain, make sure that you have created a dynamic cluster and completed the prerequisite tasks that are described in Requirements for Configuring Elasticity.
Calendar-based scaling policies must be configured in a domain-wide diagnostic system module that is targeted to the Administration Server.
To configure calendar-based scaling using the WebLogic Server Administration Console:
Create and enable a policy that supports calendar-based rules. See the following topics in the Oracle WebLogic Server Administration Console Online Help:
Create calendar based policies for a diagnostic system module
Create smart rule based policies for a diagnostic system module
Create collected metrics policies for a diagnostic system module
Note:
When creating a calendar-based policy using the WebLogic Server Administration Console, you can specify the schedule for the policy, and also create a scaling action and assign it to the policy. If you choose not to specify the policy schedule and scaling action at the time you're creating the policy itself, you can use the following steps to complete the configuration at a later time.
Set or update the schedule for your policy:
In the left pane of the Administration Console, expand Diagnostics and select Diagnostic Modules.
Select the diagnostic module containing the policy you want to configure.
Select Configuration > Policies and Actions > Policies and click the name of the policy you want to configure.
Select the Schedule page and define the desired schedule settings for your policy.
Click Save.
Create and enable a scaling action. See the following topics in the Oracle WebLogic Server Administration Console Online Help:
Assign a scaling action to your policy:
Note:
You can assign only one scaling action to a given policy.
In the left pane of the Administration Console, expand Diagnostics and select Diagnostic Modules.
Select the diagnostic system module containing the policy you want to configure.
Select Configuration > Policies and Actions > Policies and click the name of the policy you want to configure.
Select the Actions page.
In the Scaling Actions section, select either Scale Up Action or Scale Down Action and choose the scale up or scale down action you want to assign to this policy. Alternatively, you can click New Scale Up Action or New Scale Down Action to create a new scaling action for this policy.
Click Save.
To configure calendar-based scaling using Fusion Middleware Control:
Create and enable a policy that supports calendar-based rules. See Create a new policy in Administering Oracle WebLogic Server with Fusion Middleware Control.
Note:
While creating a policy in Fusion Middleware Control, you can specify the schedule for the policy and also create and assign a scaling action to the policy. If you choose not to specify the schedule and scaling action for a policy during creation, you can use the following steps to complete the necessary configuration.
Set or update the schedule for your policy:
From the WebLogic Domain dropdown menu, select Diagnostics, then select Diagnostic Modules.
In the Diagnostic Modules table, select the diagnostic system module containing the policy you want to configure.
Select Configuration > Policies and Actions > Policies and click the name of the policy you want to configure.
Select the Schedule page and define the desired schedule settings for your policy.
Click Apply.
Create and enable a scaling action. See Create a scale up or scale down action in Administering Oracle WebLogic Server with Fusion Middleware Control.
Assign a scaling action to your policy:
Note:
You can assign only one scaling action to a given policy.
From the WebLogic Domain dropdown menu, select Diagnostics, then select Diagnostic Modules.
In the Diagnostic Modules table, select the diagnostic system module containing the policy you want to configure.
Select Configuration > Policies and Actions > Policies and click the name of the policy you want to configure.
Select the Actions page.
In the Scaling Actions section, select either Scale Up Action or Scale Down Action and choose the desired scaling action from the list. Optionally, click Create Scale Up Action or Create Scale Down Action to create a new scaling action for this policy.
Click Apply.
The following examples show how to use WLST to create and configure calendar-based policies that scale a dynamic cluster at a certain time on a certain date. Example 6-1 shows the commands to configure a calendar-based policy that executes a scale up action at 3:00 a.m. on December 26. Example 6-2 shows the commands to configure a calendar-based policy that executes a scale down action at midnight on January 15.
Example 6-1 Calendar-Based Policy With a Scale Up Action
calendarScaleUp=wn.createWatch('ChristmasReturnsScaleUpWatch') calendarScaleUp.setExpressionLanguage('EL') calendarScaleUp.getSchedule().setHour('3') calendarScaleUp.getSchedule().setMinute('0') calendarScaleUp.getSchedule().setSecond('0') calendarScaleUp.getSchedule().setDayOfMonth('26') calendarScaleUp.getSchedule().setMonth('Dec') calendarScaleUp.setEnabled(false) calendarScaleUp.addNotification(scaleUp)
Example 6-2 Calendar-Based Policy With a Scale Down Action
calendarScaleDown=wn.createWatch('PostChristmasReturnsScaleDownWatch') calendarScaleDown.setExpressionLanguage('EL') calendarScaleDown.getSchedule().setHour('0') calendarScaleDown.getSchedule().setMinute('0') calendarScaleDown.getSchedule().setSecond('0') calendarScaleDown.getSchedule().setDayOfMonth('15') calendarScaleDown.getSchedule().setMonth('Jan') calendarScaleDown.setEnabled(false) calendarScaleDown.addNotification(scaleDown)