Beyond Basic Scheduling John Crespin
Terms of This Presentation This presentation was based on current information and resource allocations as of October 2009 and is subject to change or withdrawal by CA at any time without notice. Notwithstanding anything in this presentation to the contrary, this presentation shall not serve to (i) affect the rights and/or obligations of CA or its licensees under any existing or future written license agreement or services agreement relating to any CA software product; or (ii) amend any product documentation or specifications for any CA software product. The development, release and timing of any features or functionality described in this presentation remain at CA s sole discretion. Notwithstanding anything in this presentation to the contrary, upon the general availability of any future CA product release referenced in this presentation, CA will make such release available (i) for sale to new licensees of such product; and (ii) to existing licensees of such product on a when and if-available basis as part of CA maintenance and support, and in the form of a regularly scheduled major product release. Such releases may be made available to current licensees of such product who are current subscribers to CA maintenance and support on a when and if-available basis. In the event of a conflict between the terms of this paragraph and any other information contained in this presentation, the terms of this paragraph shall govern. 2 August 12, 2009 [Enter presentation title in footer] Copyright 2009 CA
For Informational Purposes Only Certain information in this presentation may outline CA s general product direction. All information in this presentation is for your informational purposes only and may not be incorporated into any contract. CA assumes no responsibility for the accuracy or completeness of the information. To the extent permitted by applicable law, CA provides this document as is without warranty of any kind, including without limitation, any implied warranties or merchantability, fitness for a particular purpose, or non-infringement. In no event will CA be liable for any loss or damage, direct or indirect, from the use of this document, including, without limitation, lost profits, lost investment, business interruption, goodwill, or lost data, even if CA is expressly advised of the possibility of such damages. 3 August 12, 2009 [Enter presentation title in footer] Copyright 2009 CA
ABSTRACT Beyond Basic Scheduling presents advanced concepts and techniques in CA WA schedule development. It shows how CA WA Global Variables, JavaScript and other tools can be used to create a dynamic load balancing solution. The goal is not only to inform, but to stimulate creative use of the CA WA solution. 4 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
AGENDA > Part I: Global Variables: An introduction > Part II: Load Balancing > Part III: Beyond Beyond Basic 5 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Part I: Global Variables: An introduction 6 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Global Variables > Some background Introduced in CA WA 11.1 Store information that can be reused across Applications Each global variable belongs to a context, which is a group of related variables Different than symbolic variables All symbolic variables are stored in built-in JavaScript host objects. Unlike symbolic variables, global variables are not dependent on JavaScript. Instead, global variables are stored in the relational database for CA WA. 7 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Global Variables > Mechanics Create or Set Get setvar('name','value'[,'context']); getvar('name'[,'context']); Other ops deletevar('name'[,'context']); incrementvar('name'[,'context']); decrementvar('name'[,'context']); loadcontext(host_object[,'context']); 8 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Global Variables > Mechanics %VAR runtime substitution When an Event is triggered, the CA WA server tries to substitute the current value of a global variable specified in the %VAR statement. If the variable is not defined at that time, the statement remains unresolved until the job's runtime. At the job's runtime, the server tries to resolve the statement again. If the variable is still undefined, the server submits the job with an unresolved variable. %VAR('name'[,'context']) Example: 9 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Global Variables > Global Variable Dependencies Jobs can have global variable dependencies. variable dependency is a variable expression that must be satisfied before a job is submitted. jobs are submitted when all of the global variable dependencies (and the time, predecessor, and resource dependencies) are met, dropped, or abandoned. If the global variable dependency is not met at job submission time, the job goes into a VARWAIT state 10 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Part II: Load Balancing 11 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
An Advanced Example using Global Variables: Load Balancing > The Challenge: Want to send workload to the least busy Agent system based on CPU usage. Assume we have a group of similar platform Agents (Unix/Linux or Windows) with various CPU configurations. Unix Agents Unix Agents in Topology Agent Selection 12 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > The Monitoring Application 13 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > The Monitor Job Definition Jobs will execute the alert UPDATE_CPU_VALUE which creates or updates the global variable the AGENT_CPU context when there is a change of 5% or greater in available CPU. Agents take 10 seconds between successive scans for any object monitor job that uses the CONTINUOUS operand (CPU_MON and DISK_MON). The default value is 10,000 milliseconds (10sec). A shorter interval puts a greater demand on system resources. (This value can be configured by the objmon.scaninterval=<n milliseconds> in <agentinstalldirectory>/agentparm.txt) 14 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > Alert fires every time CPU change > 5% Our JavaScript parses the status variable which contains the information sent by the agent monitoring job every time the alert fires. 15 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > The Global Variables Hold the current cpu availiblilty and the names of the agents. Each Agent group has a semi-colon separated list of agents and their load factors. Agent groups are global variables defined in the AGENT_GROUP context. Note that agent AGENT has twice the cpu power of agent WINAGENT 16 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > Global variables in the AGENT_CPU context are created or updated when the UPDATE_CPU_VALUE alert fires: > Another alert is set at the Application level which updates the CPU values to -1, if the Agent is down, effectively removing the Agent from the selection pool 17 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > Define the job that carries the workload Note the Agent name field is a symbolic variable which will be determined at run time 18 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing Run time JavaScript is called when job is ready to run. Here the appropriate agent is selected Agent group name= UNIX Specified in tag; other values may also exist 19 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > JavaScript var agent_load_array; var val,load,agent_type,cpu=0; var candidate = 'empty'; var max = 0; var i,j; var tag = WOB._tag.split(" "); // now check for the agents under from the group name specified in the Tag field // to be entered by user. // in the form - agentname1,loadfactor1;agentname2,loadfactor2,... WOB.agent_list = getvar(tag[0],'agent_group'); var agent_array = WOB.agent_list.split(";"); for ( i in agent_array ) { agent_load_array = agent_array[i].split(","); cpu = parseint(getvar(agent_load_array[0],'agent_cpu')); load = parseint(agent_load_array[1]); val = cpu*load; The Basic Algorithm if ( val > max ) { candidate = agent_load_array[0]; max = val; } } // collect the selected agent and the CPU*loadfactor value WOB._agent = candidate; WOB.max_agent = max; 20 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > Agent runtime selection As the cpu changes, values in the global variables are updated.. This guy has the best CPU in the WINDOWS group 21 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing > Agent runtime selection run the workload.. 22 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Load Balancing To summarize: the building blocks 1. CPU Monitoring jobs 2. Alert that updates the CPU availability in a Global Variable 3. List of agents in a global variable representing an agent group 4. JavaScript script which selects the best available agent 23 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Part III: Beyond Beyond Basic 24 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Run Time vs. Trigger Time > JavaScript script referenced in an Application can be run at 'run time' and/or 'trigger time' Event trigger time - when Event is triggered Run time - when job is eligible to run > For variables, decide what you need resolved and when Event trigger time - run frequency, job names, resources, time dependencies, etc. Run time - arguments, script names, agent names, etc. > You can set ESP- and APPL-prefixed variables at trigger time and they will be available at run time OR use a link at the beginning of your Application to set your run-time variables you need throughout your Application 25 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Do not trigger if active Prevents concurrent processing and queuing up of different generations of an Application For example, an Event is scheduled every hour to run an Application but if the previous run isn't complete, don't bring in a new one Different than "Wait for previous generation" which causes one generation to wait for previous generations Event level - Event will not trigger the Application if there is still an active generation of the Application that was triggered by that same Event Application level - Event will not trigger the Application if there is still an active generation of the Application triggered by any Event 26 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Submit Conditionally > A job can be defined with an attribute of "Submit - Conditionally" referred to as a conditional job > A conditional job may or may not be processed > By default, all jobs are non-conditional, which means they must complete before the Application is considered complete > Once all non-conditional jobs are complete, the Application is considered complete 27 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Submit Conditionally > For example, a conditional job could be a recovery job you only want to run if another job has failed Run job A If it fails, run RECOVER and then continue. If it succeeds, continue. RECOVER is a conditional job (released only if job A fails) Also, job A should be defined as a conditional job since it doesn't have to complete successfully for the Application to be considered complete INPUT_READY should be set up to be released when 1 predecessor remains 28 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Name vs. Runtime Name > When you define an Application, you can specify a Name and a Runtime Name > By default, the Runtime name is the Name > Variables can only be used in the Runtime name > For example, a common billing Application could have the names below: > Name is used to store the Application > Run-time name is used for monitoring purposes 29 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Which time and date variables to use? > Built-in time and date variables (e.g. MM, DD, YY, TIME, YEAR, etc.) can have different prefixes: APPL._S* Event scheduled time and date APPL._A* Event actual time and date APPL._R* Application-ready time and date Not in APPLHOLD or APPLWAIT WOB._R* Job ready-to-run time and date > Often, the APPL._S*, APPL._A*, and APPL._R* variables have the same value 30 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Which time and date variables to use? > Example: Event is scheduled for 4 a.m., held until 5 a.m., and then waits for the previous generation until 6 a.m. Last job gets submitted at 10 a.m. APPL._STIME is 04.00.00 APPL._ATIME is 05.00.00 APPL._RTIME is 06.00.00 WOB._RTIME for the last job is 10.00.00 31 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
When is the 5 th Friday also the 1 st Friday? Need to run a job on the 5th Friday of each month but only in months that have 5 Fridays. > If you use "Run 5th Friday of month", CA dseries starts counting from the beginning of the month until it reaches the 5 th Friday > If there are only 4 Fridays in the month, the 5 th Friday will actually be the first Friday of next month > "5th Friday WITHIN month" ensures the job runs only when there are 5 Fridays in the month 32 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
When is the 5 th Friday also the 1 st Friday? > List scheduled events shows the 4 instances this event will trigger over next 52 weeks. 33 January 27-30, 2008 Things that make you go hmmm in CA dseries Copyright 2008 CA
Beyond Beyond Basic Scheduling Challenge 34 October 22, 2009 [Enter presentation title in footer] Copyright 2009 CA
Beyond Basic Scheduling Thank you