In the 1th part of this series, we introduce a design model for grid computing on Azure. In this article, we will use C # to develop a grid application to implement this pattern, and in the 3rd part we will run the application locally and then run it in the cloud. To implement these functions, we need the accessibility features provided by the Grid computing framework.
Role of the grid framework
Unless you're prepared to write a lot of underlying software, you should choose a framework for your grid application to eliminate the heavy work and focus your application code. While Azure implements many of the services you want in the grid computing infrastructure, you still need to add some grid-specific functionality between Azure and grid applications. A good grid computing framework should do the following for you:
Provide the ability to schedule and control work operations
Retrieves input data from the underlying store.
Generate a task for the grid executor to perform
Distribute tasks to available actuators
Track the status of a task while the grid is executing the application
Collecting results from the executor
Store the results in the underlying storage
The following figure shows how the framework combines the grid application with the Azure platform. Application developers simply write application-specific code to load input data, build tasks, perform tasks, and save result data. This framework provides all the required functionality-these features make a significant use of the features of the Azure platform.
In this article, we'll take advantage of the azure grid, a community version of the Neudesic grid Computing framework. Azure Grid provides 4 software components to achieve all of the features listed below:
Loader, which allows you to add your own code to extract input data from the underlying resources and generate tasks.
The executor role allows you to add your own code to perform the application tasks.
Aggregator, so you can add your own code to store the results back to the underlying resources.
Grid Manager allows you to start your work and monitor their implementation.
Azure Grid uses cloud resources only during the execution of your grid application, making your expenses as low as possible. The underlying store maintains a tracking database of input data, results, and azure grid. Cloud storage is used for parameter transfer and result collection with the actuator communication process, and is emptied when your grid application executes. Once your grid application is done, you can suspend the Run-time instance of the grid executor in your spare time, so you do not have to pay for the constant cost of storing and calculating times.
Application: Fraud Check
The application we are going to encode is a fictitious fraud check (fraud check) program that uses certain rules to compute the data of the applicant in order to obtain a fraudulent probability score. The records for each requester are processed as a grid task. The requester record has this structure:
By applying business rules to the applicant record, the fraud check program calculates a fraud probability score between 0 and 1000, while 0 indicates the worst possible score. If the score is less than 500, then the application may be rejected.
Designing a Grid Application
When you design a grid application, you need to identify the best way to divide your work into separate tasks that can be executed in parallel. You first need to consider 2 key issues:
Based on what basis do you divide the work into tasks?
How many different kinds of tasks are there?
In the case of fraud check, it makes sense to create separate tasks for each requester record: it is an atomic operation to make a fraud score for each record, and it doesn't matter what the order is after all the records have been processed.
For fraud check, only one task type is required, which we name as "Fraudscore". The Fraudscore task is to calculate the fraud score for the applicant's record.
These tasks require reading input data and generating result data. The Fraudscore input data is also the requester record, and the result data is a cheat score plus a text field to explain the reason for the score. Fraudscore the required parameters and return results, along with their name, shown below.