Section Summary: Deploying the Compute Grid; running jobs; creating custom jobs; writing a CLI for executing jobs.
Overview
The Compute Grid infrastructure provides an implementation of the master-worker pattern using space-based commands. The Compute Grid includes ready-made services, with administrative service UI support.
Master-Worker Pattern
Expand this...
In the master-worker pattern, a job represents specific business logic, comprised out of a set of tasks. A job is responsible for creating tasks and collecting results. A task is the smallest unit of work that needs to be executed by the workers.
Master – a master owns a specific job. The master writes tasks using the write() API and waits for a response on those tasks, using the take() API.
Scheduler – an optional service, used to manage execution of tasks in advance. Tasks are routed to scheduler by the master; the scheduler determines which workers should execute them, based on priority, CPU utilization, etc. The scheduler can be implemented as an external server.
Workers – workers represent a compute agent. Workers wait for tasks using the take() API. Once a task has been taken, the worker executes the task using the execute() method on the Task Entry interface. The result of the task is written back to the space as a response Entry. A task ID is used for correlating between between task and response.
To define behavior and state, you can create Task Entry objects – this provides a ready-made dynamic Compute-Grid environment.
Dynamic Scaling of Worker Units
Unlike in dynamic caching scenarios, in a Compute Grid scenario the Service Grid uses space backlog to monitor the load on existing workers and machines.
Expand this...
The backlog in each space provides a very accurate measurement of whether the available workers and machines are sufficient to perform the current task. If the workers are overloaded, the amount of pending tasks increases. Once this amount crosses a certain threshold, the Service Grid starts to dynamically deploy more worker instances.
Section Contents
Creating a Custom Job — How to implement a custom Job, Task, and Result using the relevant classes.
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment