Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

GridGain - Why Runtime Metrics Are Important

DZone's Guide to

GridGain - Why Runtime Metrics Are Important

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

Let me ask you - how many grid computing products do you know that provide runtime statistics of of the grid via regular API? I assume not many (if any). Some grid products I know don't even expose their grid topology - they treat cluster as one black box.

Well, in GridGain we have a concept of Node Metrics which provide almost real-time information about activity on every grid node. These metrics include current and average values for CPU utilization, heap, thread stats, job execution time (current and average), number of running/rejected/cancelled jobs, size of waiting queue, job wait time, total number of executed jobs and a lot more useful node runtime information.

So, why do we do that you may ask. The answer is simple - this data is very useful when you really want to have a fine-grained control on how your jobs are distributed across grid nodes. For example, what if you want to segment your grid based on CPU utilization and execute your jobs only on nodes with CPU load under 50%? Or what if you need to adapt to average CPU load or job execution time in order to send more jobs to the nodes that can process your computations faster?

In fact, our Adaptive Load Balancing SPI does just that. On top of providing several out-of-the-box implementations, we allow users to plug any custom adaptive behavior suitable for their applications. Here is how simple it is to implement a policy that adapts to job processing time on top of GridGain and returns a load score for a node in near-real time (note that we use Node Metrics to detect current and average job processing time):

public class GridAdaptiveProcessingTimeLoadProbe
implements GridAdaptiveLoadProbe {
...
/**
* Returns node's load score
* based on job processing time.
*/
public double getLoad(
GridNode node,
int jobsSentSinceLastUpdate) {
// Acquire node metrics.
GridNodeMetrics metrics = node.getMetrics();

if (useAverageMetrics == true) {
// Return score based on average data.
return
metrics.getAverageJobExecuteTime() +
metrics.getAverageJobWaitTime();
}

// Return current metrics score.
return
metrics.getCurrentJobExecuteTime() +
metrics.getCurrentJobWaitTime();
}
...
}

You can download GridGain here. Enjoy grid computing!

Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}