22
Loris BOUZONNET ([email protected]) Making RMI clustering easy with CMI

Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

Loris BOUZONNET ([email protected])

Making RMI clustering easy with CMI

Page 2: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

2 ©Bull, 2008 Make clustering easy with CMI

Agenda

- A short history

- Toward the project CMI

- The project CMI

- Features

- Architecture

- Related work

- Incoming works

- Demo

Page 3: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

3 ©Bull, 2008 Make clustering easy with CMI

- CMI defines cluster of RMI objects (and not of servers).

Introduction

Client

Page 4: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

4 ©Bull, 2008 Make clustering easy with CMI

A short history

- Started in 2005 to provide clustering of EJB2.- Not yet a standalone project but rather an extension for JOnAS

- Drawbacks:- Too static- Bad Maintainability

- Need an independent mechanism to support EJB3.

Overview of CMI v1

Page 5: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

5 ©Bull, 2008 Make clustering easy with CMI

Beyond the clustering

Towards the CMI project

- CMI v2 started from scratch in 2007 to become a new OW2 project.

- Its domain application is no more limited to clustering- Distributed applications- SOA

- Requirements:- Support any RMI objects, whatever the

protocol- Easy to use for developers and administrators- Support of dynamic changes of topology and

weights- Easy to extend and follow standard evolutions jrmp iiop irmi

cmi

carol

appli

Page 6: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

6 ©Bull, 2008 Make clustering easy with CMI

The CMI project

Project management

- Software project management- Maven

- Version control- OW2 SVN: svn://svn.forge.objectweb.org/svnroot/cmi

- Test- TestNG

- Continuous integration- OW2 Bamboo: http://forge.ow2.org/bamboo/

- Documentation- Docbook

- Packaging- OSGi or not- Modules: admin, jndi, rpc, client, server/JGroups, server/JMS

Page 7: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

7 ©Bull, 2008 Make clustering easy with CMI

The project CMI

Community

Dynamic replication

HA algorithms

Group com layer

Leader

Selfware project

Page 8: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

8 ©Bull, 2008 Make clustering easy with CMI

The CMI project

Use CMIUse CMI

Used by CMIUsed by CMI

OW2 Utils:

cluster, component, event,log, maven, pool, xmlconfig

Relationship with some other OW2 projects

Page 9: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

9 ©Bull, 2008 Make clustering easy with CMI

@Cluster(name=“my_cluster")

@Policy(RoundRobin.class)

public class Hello implements HelloItf, Remote {

public void sayHello() {

System.out.println(“Hello!”);

}

}

Defining a clustered object

Tell that instances of Hello will be clustered

Tell how to access them

Features

Page 10: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

10 ©Bull, 2008 Make clustering easy with CMI

J1Update

Cluster logic

Master node

Ctrl flow

Cluster logic V1Cluster logic V2

Features

CMI added value for every RMI objects

- Dynamic update of the cluster configuration

- Easy administration- Update of the algorithm from the JOnAS admin

console, JMX or OSGi.

Page 11: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

11 ©Bull, 2008 Make clustering easy with CMI

Performance oriented

Separation of control and server flows

Page 12: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

12 ©Bull, 2008 Make clustering easy with CMI

Server-side

- JGroups- Multicast/Unicast- The initial implementation: most mature- Flat cluster views

- JMS (e.g. Joram)- Unicast- More lightweight- Allow to define hierarchical cluster views.

• Exploited by WildCAT

2 available implementations

Page 13: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

13 ©Bull, 2008 Make clustering easy with CMI

Link with an other work

- Feature in the autonomic loop powered by JASMINe- Provides rules to configure CMI- Computes load factors from JASMINe Events

Self-optimization of CMI clusters

Page 14: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

14 ©Bull, 2008 Make clustering easy with CMI

Incoming works

- Platform to launch tests of clusters in the continuous integration

- Terracotta support

- Computation of the cluster view according to an identity

- Dynamic deployment of client interceptors

- Dynamic replication

Page 15: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

15 ©Bull, 2008 Make clustering easy with CMI

Conclusion

- CMI already provides personalities for EJB2 and EJB3

- Easiness of the administration thanks to the dynamism of CMI

Page 16: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

16 ©Bull, 2008 Make clustering easy with CMI

Demo

node 2

node 1

master laptop

JMX

Rem

ote

democluster

JAR

democluster

CLIENT

democluster

JAR

Architecture

Page 17: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

17 ©Bull, 2008 Make clustering easy with CMI

Demo

Remote interface

package org.ow2.easybeans.examples.democluster;

public interface StatelessRemote {

public String getNodeName(String msg);

}

Page 18: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

18 ©Bull, 2008 Make clustering easy with CMI

Demo

Bean @Stateless

@Remote(StatelessRemote.class)

@Cluster(name="test_cluster")

@Policy(RoundRobin.class)

public class StatelessBean implements StatelessRemote {

public String getNodeName(String msg) {

String jonasInstanceName = "unknown";

// get the node name

try {

JProp jp = JProp.getInstance();

jonasInstanceName = jp.getValue("jonas.name");

} catch (Exception e) {

//

}

System.out.println(msg);

return jonasInstanceName;

}

}

Admin name

Page 19: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

19 ©Bull, 2008 Make clustering easy with CMI

public static void main(final String[] args) throws Exception {

Context initialContext = getInitialContext();

StatelessRemote statelessBean = (StatelessRemote) initialContext

.lookup("org.ow2.easybeans.examples.democluster.StatelessBean"

+ "_" + StatelessRemote.class.getName() + "@Remote");

while (true) {

i++;

msg="Request[T=" + pid + ", HD="+ dateFormat.format(new Date())

+ ", S=" + i + "]";

// invoke the EJB

String nodeName = statelessBean.getNodeName(msg);

System.out.println(msg + " -> " + nodeName);

Thread.sleep(200);

}

}

Demo

Client

Page 20: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

20 ©Bull, 2008 Make clustering easy with CMI

Demo

1) Load-balancing checking

• Default policy = round-robin

2) Dynamic change of the load-balancing policy

• To first available

3) Fail-over and server restart

4) Go back to the RoundRobin policy

5) Smooth stopping of a server

• Blacklist

Scenario

Page 21: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from

21 ©Bull, 2008 Make clustering easy with CMI

Demo

Monitoring with MbeanCmd

Server 2

Server 1MbeanCmdJMX

Page 22: Making RMI clustering easy with CMI - OW2 Consortium · 2008-12-02 · 5 ©Bull, 2008 Make clustering easy with CMI Beyond the clustering Towards the CMI project-CMI v2 started from