Replication Framework for Jini Services

23
Replication Framework for Jini Services Reti di Calcolatori LS a.a. 2003-2004 Jonathan Cristoforetti 160789

description

Replication Framework for Jini Services. Reti di Calcolatori LS a.a. 2003-2004 Jonathan Cristoforetti 160789. Objective. Creation of a prototypical framework for the replication of Jini services which: is reusable is based on the passive replication model is coherent with the Jini vision. - PowerPoint PPT Presentation

Transcript of Replication Framework for Jini Services

Page 1: Replication Framework for Jini Services

Replication Framework for Jini Services

Reti di Calcolatori LSa.a. 2003-2004

Jonathan Cristoforetti160789

Page 2: Replication Framework for Jini Services

Objective

• Creation of a prototypical framework for the replication of Jini services which:– is reusable– is based on the passive replication

model– is coherent with the Jini vision

Page 3: Replication Framework for Jini Services

Passive replication model

• Passive replication model– Only one replica executes (Master)– Others act as stand-by copies (Slave)

• State synchronization:– Cold stand-by– Hot stand-by

Page 4: Replication Framework for Jini Services

The framework replication model

• Three main aspects must be defined:

– Logical topology

– Synchronization protocol

– Failure detection mechanism

Page 5: Replication Framework for Jini Services

Logical topology

• Replicas are organized in a logical chain

• Communication happens only between adjacent elements

Page 6: Replication Framework for Jini Services

Logical Topology (2)

• Replicas organize automatically using the Jini lookup service to discover the presence of a master

Master Slave 1

Slave 2

join

ack

join

Slave 1

join

ack

• Iterative join protocol to free the master quickly

Page 7: Replication Framework for Jini Services

State synchronization

• Checkpoint based• The Single Fault Assumption is made

TTR < (M)TBF• The first slave is hot stand-by, the

successive are cold stand-by:

Page 8: Replication Framework for Jini Services

State synchronization (2)

• The complete state is transferred during each synchronization and must be encapsulated into a serializable object:

Higher bandwidth consumption Looser coupling between the

service and the framework• no information about the state internal

representation is needed by the framework

Page 9: Replication Framework for Jini Services

Failure detection

• Heart-beat protocol– periodical invokation of a ping-like

method on the precedin element

• Fail-stop assumption on the failure behavior– if the method invokation succeds, the

replica is working correctly

Page 10: Replication Framework for Jini Services

Communication protocol

• Communication based on RMI

• Four methods define in an interface called IReplica:– join– ping– activate– synchronize

Page 11: Replication Framework for Jini Services

The framework

• Works with Jini services which use RMI for the communication between client and server

• Classic Jini service lookup and usage:

Page 12: Replication Framework for Jini Services

The framework (2)

• The master replica must register by the Jini registrar and be discoverable both by the other replicas and by the service clients

Dynamic Proxy• Java Object which implements one or more

interfaces defined at runtime

Page 13: Replication Framework for Jini Services

The framework (3)

• Given a service interface and the relative implementation class, the framework will:– export both the service and the IReplica

interface using JERI– Combine the two RMI proxies into a

dynamic proxy– Register such proxy by the Jini registrar

Page 14: Replication Framework for Jini Services

Dynamic Proxy

Service Registrar

MasterJini

Client

Replica

Service

Replica

Service

register

Lookup “Service”Replica

Service

Replica

Service

Page 15: Replication Framework for Jini Services

Dynamic Proxy

Service Registrar

Master Slave 1

Replica

Service

register

Lookup “IReplica”

Replica

Service

Replica

Service

Replica

Service

Page 16: Replication Framework for Jini Services

IReplicatedServiceCallbacks

• Interface that defines the interaction protocol between framework and service

• Two methods:– getState: to obtain the service state in

order to send it as an update– updateState: to synchronize the service

state after an updated state has been received

Page 17: Replication Framework for Jini Services

Service requirements

• To be used with the framework a service must:

1. Be an RMI based remote service.

2. Define a service interface.

3. Provide a service implementation.

4. Implement the callback interface.

Page 18: Replication Framework for Jini Services

Configuration file

• Written in XML, if defines the following:

1. The complete name of the service interface

2. The complete name of the service implementation

3. The frequency of state updates, expresses in the number of service invocations after which to synchronize.

Page 19: Replication Framework for Jini Services

Implementation

Page 20: Replication Framework for Jini Services

Example Services

• Sequential Number service:– Method: sequentialNumber()– State: an integer

• Bank account service:– Methods:

• GetBalance(ID)• Deposit(ID, amount)• Withdraw(ID, amount)• Transfer(IDSource, IDDest, amount)

– State: an array of Account objects

Page 21: Replication Framework for Jini Services

JUnit testing

• Three automated tests for each service, executed with 3 replicas:

1. Execution of the service with no failures

2. Execution with failing masters

3. Execution with failing first slaves

Page 22: Replication Framework for Jini Services

JUnit results

Page 23: Replication Framework for Jini Services

Future developments

• Support for more policies defined via configuration files

• Support for partial state synchronization

• Support for active replication