Dynamic Scheduling and Load Balancing in Distributed Java Applications

Preview:

DESCRIPTION

Dynamic Scheduling and Load Balancing in Distributed Java Applications. M. Muztaba Fuad Masters in Computer Science Department of Computer Science Adelaide University. Supervised By Dr. Michael J. Oudshoorn Associate Professor Department of Computer Science. Overview. Motivation. - PowerPoint PPT Presentation

Citation preview

M. Muztaba FuadM. Muztaba FuadMasters in Computer ScienceMasters in Computer Science

Department of Computer ScienceDepartment of Computer ScienceAdelaide UniversityAdelaide University

Supervised ByDr. Michael J. Oudshoorn

Associate ProfessorDepartment of Computer Science

Dynamic Scheduling and Dynamic Scheduling and Load Balancing in Distributed Load Balancing in Distributed

Java ApplicationsJava Applications

OverviewOverview

• Motivation.• Other systems.• Goals.• Contribution.• Program structure.• System components.• Evaluation.• Conclusion.

MotivationMotivation

• Most of the world’s PCs are idle most of the

time.

• By using this resource pool, an individual

computation may be completed in a fraction of

time.

• A multi-threaded program can be distributed

over a number of machines.

MotivationMotivation

• A huge gap exists between a multi-threaded and a

distributed Java application that forbids simple

code transformation in order to build distributed

applications from multi-threaded applications.

• Distributing a program over a number of machines

proves to be a tedious and difficult job.

Other SystemsOther Systems

• New distributed programming environment– Java Party, Ajents.

• Attempts to improve the underlying communication mechanism – ARMI, RRMI, Manta.

• Only implement migration for load balancing– Mole, Aglets,D’Agents.

• Take a completely different approach– Java/DSM.

Other SystemsOther Systems

Project GoalsProject Goals• Automatic distribution of user program.

• Less programmer involvement for distribution of application across a network.

• Identify situation of heavy load and migrate the application as necessary.

• User should create distributed objects as local objects and distributed objects should behave as a local object.

• 100% Java based system to support heterogeneous platforms.

ContributionContribution

• AdJava provides a system that makes it easy for programmers to convert a multi-threaded parallel program into distributable one.

• The programmer does not need to worry about the distribution of the resulting program; AdJava deals with everything related to distribution on behalf of the programmer.

ContributionContribution

• AdJava provides transparent migration of

objects to balance the load of the system.

• AdJava provides support for remote input

from files and output to console and files.

• All this is provided without modifying the

Java Virtual Machine.

System Architecture

Program Structure & Pre-Program Structure & Pre-processorprocessor

• Using AdJava, programmers can easily turn a multi-threaded Java program in to a distributed program by identifying those objects that should be spread across the distributed environment.

foo aObject = new foo (…);

class foo extends Thread

distribute foo aObject = new foo (…);

Program Structure & Pre-processorProgram Structure & Pre-processor…// Create five forks

Fork f1= new Fork(1); Fork f2= new Fork(2); Fork f3= new Fork(3); Fork f4= new Fork(4); Fork f5= new Fork(5); // Assign Philosophers in proper places

distribute Philosopher ph1 = new Philosopher(1,f1,f2);distribute Philosopher ph2 = new Philosopher(2,f2,f3);distribute Philosopher ph3 = new Philosopher(3,f3,f4);distribute Philosopher ph4 = new Philosopher(4,f4,f5);distribute Philosopher ph5 = new Philosopher(5,f5,f1);

// Let them goph1.start();ph2.start();ph3.start();ph4.start(); ph5.start();…class Philosopher extends Thread {……}… class Fork {……}…

…// Create five forks

Fork f1= new Fork(1); Fork f2= new Fork(2); Fork f3= new Fork(3); Fork f4= new Fork(4); Fork f5= new Fork(5); // Assign Philosophers in proper places

distribute Philosopher ph1 = new Philosopher(1,f1,f2);distribute Philosopher ph2 = new Philosopher(2,f2,f3);distribute Philosopher ph3 = new Philosopher(3,f3,f4);distribute Philosopher ph4 = new Philosopher(4,f4,f5);distribute Philosopher ph5 = new Philosopher(5,f5,f1);

// Let them goph1.start();ph2.start();ph3.start();ph4.start(); ph5.start();…class Philosopher extends Thread {……}… class Fork {……}…

Local Objects

Remote method invocation

Distributed Objects

Program Structure & Pre-processorProgram Structure & Pre-processor

… // Create five forks Fork f1= new Fork(1); Fork f2= new Fork(2); Fork f3= new Fork(3); Fork f4= new Fork(4); Fork f5= new Fork(5); // Assign Philosophers in proper places PhilosopherInterface ph1 = (PhilosopherInterface) Naming.lookup(host[0]); PhilosopherInterface ph2 = (PhilosopherInterface) Naming.lookup(host[1]); PhilosopherInterface ph3 = (PhilosopherInterface) Naming.lookup(host[2]); PhilosopherInterface ph4 = (PhilosopherInterface) Naming.lookup(host[3]); PhilosopherInterface ph5 = (PhilosopherInterface) Naming.lookup(host[4]);

// Let them goph1.init(1,f1,f2);ph1.init(2,f2,f3);ph1.init(3,f3,f4);ph1.init(4,f4,f5);ph1.init(5,f5,f1);…class Philosopher extends Thread implements PhilosopherInterface {… …}…class Fork implements ForkInterface {… …}…

… // Create five forks Fork f1= new Fork(1); Fork f2= new Fork(2); Fork f3= new Fork(3); Fork f4= new Fork(4); Fork f5= new Fork(5); // Assign Philosophers in proper places PhilosopherInterface ph1 = (PhilosopherInterface) Naming.lookup(host[0]); PhilosopherInterface ph2 = (PhilosopherInterface) Naming.lookup(host[1]); PhilosopherInterface ph3 = (PhilosopherInterface) Naming.lookup(host[2]); PhilosopherInterface ph4 = (PhilosopherInterface) Naming.lookup(host[3]); PhilosopherInterface ph5 = (PhilosopherInterface) Naming.lookup(host[4]);

// Let them goph1.init(1,f1,f2);ph1.init(2,f2,f3);ph1.init(3,f3,f4);ph1.init(4,f4,f5);ph1.init(5,f5,f1);…class Philosopher extends Thread implements PhilosopherInterface {… …}…class Fork implements ForkInterface {… …}…

Root ServerRoot Server• The root server has a well-

known fixed address.• The root server executes the root

daemon, which is responsible to setup and run the whole system.

• The root daemon has two major threads that perform all background work once the system starts running.

User program

Pre-processor

Handshake withevery agents

Upload properstubs and skeletons

Distribute and invokeremote object

Root registrykeeper

Remote I/O

User program

Pre-processor

Handshake withevery agents

Upload properstubs and skeletons

Distribute and invokeremote object

Root registrykeeper

Remote I/O

Object DistributionObject Distribution

• Distribution of objects depends on:– Number of objects.

– Number of hosts.

– Load in each host.

• Every host will have at least one object.

Root Server

Object 1

Object 1 argon:6001/obj1

argon:6001/obj1

Object 2

Object 2 radon:6002/obj2

radon:6002/obj2

Object 3

Object 3 sage:6003/obj3

sage:6003/obj3

Object 4

Object 4 argon:6004/obj4

argon:6004/obj4

Object 5

Object 5 sage:6005/obj5

sage:6005/obj5

Current load = 30 %

argon

Current load = 90 %

radon

Current load = 20 %

sage

AgentsAgents

• The agent is designed as a multi-threaded application where each of the threads has a specific job.

• The agent monitors:– System load.– Communication from

other agents.– Remote I/O.– Reference updating.

Agent Daemon

RMI Daemon Migration Daemon

Remote I/O Daemon

Communication Daemon

Migration port

Remote Output port

Communication port

MigrationMigration

• Java does not support access to the program stack and the program counter.

• AdJava resumes threads only within the run method and not within other methods.

• AdJava instruments its own program counter in the run method.

• Suspend Serialize Transfer Resume.

• Proxy objects are used for reference updating.

Remote I/ORemote I/O

• From the perspective of the user on the root server, the remote object produces output and requests input as if it were actually executing upon the root server.

• For file I/O, the target file is either copied to or copied from the remote host.

Graphical User InterfaceGraphical User Interface

EvaluationEvaluation

Matrix Multiplication

(600 x 600)

0

10

20

30

40

50

60

70

80

90

Seconds

1 Parallel 2 3 4 5 6 7 8

Number of machines

Setup time

Execution time

Dinning Philosophers

(5 Philosophers)0

20

40

60

80

100

120

140

Seconds

1 2 3 4 5

Number of machines

Setup time

Execution time

EvaluationEvaluation

• Time to migrate an object

00.5

11.5

22.5

33.5

4

Tim

e (

Se

c.)

1 4 13 21 30

Object Size (Kb)

EvaluationEvaluation

• Code inflation due to pre-processing

ConclusionConclusion

• This project develops an agent-based distributed architecture to distribute and manage Java applications automatically across a wide area network.

• It has more features than other systems.• It performs well compared to other systems.• It is easy to use.

Future WorkFuture Work

• Security

• Fault Tolerance

• Performance Optimization

• Migration Improvement

Recommended