![]() |
Development Lifecycle »
Design and Architecture »
Frameworks
Intermediate
License: The Code Project Open License (CPOL)
Distributed Programming FrameworkBy Yang YuBuild distributed programs without worry about distribution implementation. |
C# (C#1.0, C#2.0, C#3.0), .NET (.NET2.0, .NET3.0, .NET3.5, .NET4.0), Architect, DBA, Dev, Design
|
||||||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
The
robustness and scalability of Software depends heavily on the separation of
procedural, logical, functional, and physical components, and also the seperation of tiers within each component.
This
article will introduce a method for abstracting sequential code by
identifying and managing functional seperations and constructing a
framework for writing distributed computer programs without worry about
its distribution and execution implementation.
Part 1 of the article will focus on the theories behind this framework, while Part 2 will focus on the implementation of the pattern.
It is probably a good idea to read about:
n-tiered architecture
distributed computing
Event Driven Architecture
Service Oriented Architecture
Threading
Procedural programming language (C#)
Distributed Shared Memory (DSM)
Distribution of tasks requires a clear understanding from its micro level and also its macro level. The process of abstraction to form higher order tasks demands this understanding. By abstracting tasks, one can not only effectively manage the performance with introducing division of labour, but also introduce parallelism through identifying its inner associativities and dependencies.
![]()
In the simplest form, we could use a simple Data Structure
such as LinkedList<Action<I>> that stores a sequence of code blocks
with the only relationship being their order of execution. We could then execute this list of actions by
iterating through that LinkedList from the first Action<I> to the last. Assuming there are no dependencies, this is the same as an ThreadPool. If this is procedural actions, then then it is exactly what procedural
programming is. Trivial and not interesting.
A slightly more interesting case is to pipeline functions with
a LinkedList<Func<I,O>> where the output of one particular function
is pipelined to the next functions input. The precondition for this scenario is
that all functions have single input parameter (Sort of like ML or F#). Again, this case fails to leverage any kind of
gains over the traditional approach.
What we really want is to leverage a distributed architecture through the usage of Asynchronize execution, multithreaded execution, and parallel execution on multiple processors. As we all know, coding in these areas can be extremely difficult in all aspects. And Furthermore, being able to not worry about these architectures, and just write good code.
To implement this concept, our Data Structure can no longer
be a LinkedList, which implied the order of execution, but rather we need to
explicitly define dependencies on each Function to gain more flexibility and
management.
Dependencies among functions can be understood as this rule: Given functions A and B, A is related to B if and only if either A depends on B, or B depends on A.
We can write this relationship using sets as {A, B, C | dp(B,A) ^ dp(B,C)}. This means given a set of functions {A, B}, B depends on A and C.
Examples:
By definition, Procedural Groups functions independently. Thus, allowing us to create seperate threads/processors/computers per group. This seperation translates into a distributed n-tiered architecture, executable simontainously to increase over all performance dramatically. Given we utilize the proper communication techniques.

Coordinator
- Distribute_Group
Message:Group
Description: The coordinators issues out the next group in the stack.Agents
- Request_Group
Message:null
Description: The Agent is not working on any groups so it sends out a group request.- Processed_FunctionMessage:
FunctionDescription: An Agent finished processing of a Group.
IDictionary<int,Function> GenerateID(IEnumerable<Function>)IEnumerable<Group> DistributeFunctions(IDictionary<int,Functions>) IDictionary<int,Group> GenerateID(IEnumerable<Group>)


The main assembly consisting of the set of functional and relationships is deployed on the Coordinator. Once deployed, the coordinator will takecare of the rest.
As more and more agents join the service bus, the faster the overall performance will become.
Inorder for the Agents to execute the Functions recieved from the Coordinator, each Group needs to be its own assembly. This way the Agents themselves not need to contain any code at the start, but rather recieve different code at runtime. We will explorer this in more depth in Part 2 of this article.
Once we have a clear seperation of functions, its dependencies, procedural groups, communication, we can put together a program that actually works, distributively!
Part 1 of this article covers the abstract of the framework. The next part will cover its implementation.
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 1 Mar 2010 Editor: |
Copyright 2009 by Yang Yu Everything else Copyright © CodeProject, 1999-2010 Web18 | Advertise on the Code Project |