Nirvana Scheduling : Conditional Triggers
Conditional triggers execute tasks when specific conditions occur. Each defined trigger has a number of attributes that can be used as part of the trigger expression and evaluated to determine whether the tasks are executed. For basic information on the grammar for conditional triggers, please read the section on conditional triggers in the writing scripts help file. The conditional triggers are signified by using the 'when' keyword. The expression entered after the keyword represent the trigger object(s) and the values to be checked against.
This section will describe in detail the triggers that are available and how to use them within a trigger expression :
- Trigger Expressions
- Store Triggers
- Interface Triggers
- Memory Triggers
- Realm Triggers
- Cluster Triggers
- Counter Triggers
- Timer Triggers
- Config Triggers
To view examples of scheduling scripts, please click here.
Trigger Expressions
A trigger expression is constructed from the definition of the trigger object(s) to be evaluated and the values that will be used in the comparison. The trigger used in the expression can be either the actual trigger object, or the declared name of the trigger from the declarations section of the script. Multiple triggers can be used in the expression using conditional operators (AND | OR).
For example, the following expression can be used to evaluate when a Realm's Interface accept threads are exhausted 5 times. When this happens, the accept threads will be increased by 10. This schedule will continually monitor the state of the interface and self-manage the accept threads so the realm server is always able to accept connections from clients.
scheduler realmInterfaceSchedule {
declare Interface myNHP ("nhp0");
declare Counter myCounter("myExhaustedThreads");when (myNHP.idleThreads == 0) {
Logger.report("NHP0 Interface has no idles Threads");
myCounter.inc();}
when (myCounter >= 5) {
Logger.report("Increasing the accept thread count on NHP0");
myNHP.threads("+10");
myCounter.reset();}
}
The above schedule will monitor the number of times the accept threads are exhausted and when the counter trigger hits 5 times, the number of threads will be increased by 10.
The next section will describe the available trigger objects and the available triggers on those objects that can be used within
Trigger Objects Table
Store Triggers - Channel / Queue based triggers
Store triggers are declared using the following syntax as an example:
declare Store myChannel("/customer/sales");
The table below lists those triggers that can be evaluated on a Store object, such that the trigger expression will look like :
when (myChannel.connections > 100) {
}
| Trigger Object | Parameters | Description |
| connections | None | Trigger on the number of connections for the channel or queue |
| freeSpace | None | Trigger on the amount of free space available in the store (used space - size of all purged events) |
| usedSpace | Trigger on the amount of used space available in the store (size of all event on disk or memory) | |
| numOfEvents | None | Trigger on the number of events on the channel / queue |
| filter | Valid filter String | Trigger when an event that matches the filter is published to the channel / queue |
Interface Triggers - Nirvana Interface based triggers
Interface triggers are declared using the following syntax as an example:
declare Interface myNHP("nhp0");
The table below lists those triggers that can be evaluated on an Interface object, such that the trigger expression will look like :
when (myNHP.connections > 100) {
}
MemoryManager Triggers - Nirvana JVM Memory Management based triggers
MemoryManager triggers are declared using the following syntax as an example:
declare MemoryManager mem;
The table below lists those triggers that can be evaluated on the memory management object, such that the trigger expression will look like :
when (mem.freeMemory < 1000000) {
}
| Trigger Object | Parameters | Description |
| freeMemory | None | Trigger when the realm server's JVM has a certain amount of free memory |
| totalMemory | None | Trigger when the realm server's JVM has a certain amount of total memory |
| outOfMemory | None | Trigger when the realm server JVM runs out of memory |
Realm Triggers - Nirvana Realm based triggers
Realm triggers are declared using the following syntax as an example:
declare Realm myRealm("productionmaster");
The table below lists those triggers that can be evaluated on the realm object, such that the trigger expression will look like :
when (realm.connections > 1000) {
}
| Trigger Object | Parameters | Description |
| connections | None | Trigger when the realm server current connections reaches a certain number |
| eventsSentPerSecond | None | Trigger when the realm server's events per second sent rate reaches a certain value |
| eventsReceivedPerSecond | None | Trigger when the realm server's events per second sent received reaches a certain value |
Cluster Triggers - Nirvana Cluster based triggers
Cluster triggers are declared using the following syntax as an example, assuming a cluster is made up of 4 realms:
declare Cluster myNode1("realm1");
declare Cluster myNode2("realm2");
declare Cluster myNode3("realm3");
declare Cluster myNode4("realm4");
The table below lists those triggers that can be evaluated on the cluster object, such that the trigger expression will look like :
when ( Cluster.isOnline("realm1") == true ){
}
| Trigger Object | Parameters | Description |
| hasQuorum | None | Trigger when cluster has quorum == true or false |
| isMaster | None | Trigger when a cluster realm is voted master |
| nodeOnline | None | Trigger when a cluster realm is online or offline |
Counter Triggers - Counter value based triggers
Counter triggers allow you to keep a local count of events occurring with the Nirvana scheduler engine. The values of the Counters can be incremented decremented and reset within the tasks section of a trigger declaration. Counter triggers are declared using the following syntax as an example:
declare Counter counter1 ("myCounter");
The counter trigger can be evaluated by referencing the Counter object itself, such that the trigger expression will look like :
when ( counter1 > 5) {
}
Timer Triggers - Timer based triggers
Timer triggers allow you to start a timer that will keep track of how long (in seconds) it has been running and then evaluate the running time within a trigger expression. Time triggers are declared using the following syntax as an example:
declare Timer reportTimer ("myTimer");
The timer trigger can be evaluated by referencing the timer object itself, such that the trigger expression will look like :
when ( reportTimer == 60 ) {
}
Config Triggers -Nirvana configuration triggers
Config triggers refer to any of the configuration values available in the Config panel for a realm. Any configuration value can be used as part of a trigger expression. Config triggers are declared using the following syntax as an example (below example refers to the 'GlobalValues' configuration group:
declare Config myGlobal ("GlobalValues");
The table below lists those triggers that can be evaluated on a Config object, such that the task expression will look like :
when (myGlobal.MaxNoOfConnections == -1) {
}
| Trigger Object | Parameters | Description |
| GlobalValues | ||
| SchedulerPoolSize | None | The number of threads assigned to the scheduler |
| MaxNoOfConnections | None | Sets the maximum concurrent connections to the server, -1 indicates no restriction |
| StatusUpdateTime | None | The number of ms between status events being written to disk |
| StatusBroadcast | None | The number of ms between status events being published |
| fLoggerLevel | None | The server logging level |
| NHPTimeout | None | The number of milliseconds the server will wait for client authentication |
| NHPScanTime | None | The number of milliseconds that the server will wait before scanning for client timeouts |
| HandshakeTimeout | None | The number of milliseconds that the server will wait for the session to be established |
| StampDictionary | None | Place Nirvana details into the dictionary (true/false) |
| ExtendedMessageSelector | None | If true, allows the server to use the extended message selector syntax (true/false) |
| ServerTime | None | Allow the server to send the current time to the clients (true/false) |
| SecureHandshake | None | Performs a security handshake when connecting into a cluster |
| ConnectionDelay | None | When the server has exceeded the connection count, how long to hold on to the connection before disconnecting |
| SupportVersion2Clients | None | Allow the server to support older clients (true/false) |
| SendRealmSummaryStats | None | If true sends the realms status summary updates (true/false) |
| AuditSettings | ||
| RealmMaintenance | None | Log to the audit file any realm maintenance activity |
| InterfaceManagement | None | Log to the audit file any interface management activity |
| ChannelMaintenance | None | Log to the audit file any channel maintenance activity |
| QueueMaintenance | None | Log to the audit file any queue maintenance activity |
| ServiceMaintenance | None | Log to the audit file any service maintenance activity |
| JoinMaintenance | None | Log to the audit file any join maintenance activity |
| RealmSuccess | None | Log to the audit file any successful realm interactions |
| ChannelSuccess | None | Log to the audit file any successful channel interactions |
| QueueSuccess | None | Log to the audit file any successful queue interactions |
| ServiceSuccess | None | Log to the audit file any successful realm interactions |
| JoinSuccess | None | Log to the audit file any successful join interactions |
| RealmFailure | None | Log to the audit file any unsuccessful realm interactions |
| ChannelFailure | None | Log to the audit file any unsuccessful channel interactions |
| QueueFailure | None | Log to the audit file any unsuccessful queue interactions |
| ServiceFailure | None | Log to the audit file any unsuccessful service interactions |
| JoinFailure | None | Log to the audit file any unsuccessful join interactions |
| RealmACL | None | Log to the audit file any unsuccessful realm acl interactions |
| ChannelACL | None | Log to the audit file any unsuccessful channel acl interactions |
| QueueACL | None | Log to the audit file any unsuccessful queue acl interactions |
| ServiceACL | None | Log to the audit file any unsuccessful service acl interactions |
| ClientTimeoutValues | ||
| EventTimeout | None | The amount of ms the client will wait for a response from the server |
| DisconnectWait | None | The maximum amount of time to wait when performing an operation when disconnected before throwing session not connected exception |
| TransactionLifeTime | None | The default amount of time a transaction is valid before being removed from the tx store |
| KaWait | None | The amount of time the client will wait for keep alive interactions between server before acknowledging disconnected state |
| LowWaterMark | None | The low water mark for the connection internal queue. When this value is reached the outbound internal queue will again be ready to push event to the server |
| HighWaterMark | None | The high water mark for the connection internal queue. When this value is reached the internal queue is temporarily suspended and unable to send events to the server. This provides flow control between publisher and server. |
| QueueBlockLimit | None | The maximum number of milliseconds a queue will have reached HWM before notifying listeners |
| QueueAccessWaitLimit | None | The maximum number of milliseconds it should take to gain access to a queue to push events before notifying listeners |
| QueuePushWaitLimit | None | The maximum number of milliseconds it should take to gain access to a queue and to push events before notifying listeners |
| ClusterConfig | ||
| HeartBeatInterval | None | Heart Beat interval in milliseconds |
| SeparateLog | None | Create a separate log file for cluster events |
| EventsOutStanding | None | Number of events outstanding |
| EventStorage | ||
| CacheAge | None | The time in ms that cached events will be kept in memory for |
| ThreadPoolSize | None | The number of threads allocated to perform the management task on the channels |
| ActiveDelay | None | The time in milliseconds that an active channel will delay between scans |
| IdleDelay | None | The time in milliseconds that an idle channel will delay between scans |
| FanoutValues | ||
| ConcurrentUser | None | The number of client threads allowed to execute concurrently in the server |
| KeepAlive | None | The number of milliseconds between the server will wait before sending a heartbeat |
| QueueHighWaterMark | None | The number of events in a client output queue before the server stops sending events |
| QueueLowWaterMark | None | The number of events in the clients queue before the server resumes sending events |
| MaxBufferSize | None | The maximum buffer size that the server will accept |
| OutputBlockSize | None | The size of the output block size |
| PublishDelay | None | How long to delay the publisher when subscribers queue start to fill, in milliseconds |
| RoundRobinDelivery | None | Use a round robin approach to event delivery (true/false) |
| PublishExpiredEvents | None | Publish expired events at server startup (true/false) |
| JVMManagement | ||
| MemoryMonitoring | None | Number of milliseconds between monitoring memory usage on the realm |
| WarningThreshold | None | The memory threshold when the server starts to scan for objects to release |
| EmergencyThreshold | None | The memory threshold when the server starts to aggressively scan for objects to release |
| ExitOnMemoryError | None | If true, the server will exit if it gets an out of memory exception |
| ExitOnDiskIOError | None | If true, the server will exit if it gets a I/O Exception |
| JoinConfig | ||
| MaxEventsPerSchedule | None | Number of events that will be sent to the remote server in one run |
| MaxQueueSizeToUse | None | The maximum events that will be queued on behalf of the remote server |
| ActiveThreadPoolSize | None | The number of threads to be assigned for the join recovery |
| IdleThreadPoolSize | None | The number of threads to manage the idle and reconnection to remote servers |
| RecoveryDaemon | ||
| ThreadPool | None | Number of threads to use for client recovery |
| EventsPerBlock | None | The number of events to send in one block |
| TransactionManager | ||
| MaxTransactionTime | None | Time in milliseconds that a transaction will be kept active |
| MaxEventsPerTransaction | None | The maximum number of events per transaction, a 0 indicates no limit |
| TTLThreshold | None | The minimum time in milliseconds, below which the server will not store the Transaction ID |
