Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar

Similar presentations


Presentation on theme: "Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar"— Presentation transcript:

1 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar (hyungjun25@cnu.ac.kr)hyungjun25@cnu.ac.kr 2014 1 4 2014 1 4 2014 1 4 2014 1 4 2014 1 4 2014 1 4 2014 1 4 2014 1 4 JBoss Application Platform Assistance Version

2 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JBoss Application Platform Review JBoss Enterprise Middleware System JGroup JBoss Cache Performance Decline Factors Clustering State Replication Load-balancing Failover 2

3 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Enterprise Middleware System

4 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JEMS Architecture 4 Operating System (Windows, Unix = Linux, Solaris, AIX, etc.) Hardware (CPU + Storage + Memory) Java Virtual Machine (Sun JVM, BEA JRockit, IBM VM, etc.) JBoss Application Server 4.x (JMX Microkernel : JBossMX) Custom Mbeans Services beyond J2EE Persistence (Hibernate*) Clustering Caching (JBossCache*) Workflow (JBoss jBPM**) JBoss AOP* Java Applications Java Applications (EARs, WARs, JARs, JSPs, Servlets) JBoss Eclipse IDE JBoss Portal --- J2EE 1.4 Services implemented as JMX Mbeans --- JSP/Servlet (Tomcat*)JNDI (JBossNS) WS4EE (JBossWS) JDBCJMS (JBoss MQ) EJB (JBoss CMP) JTA (JBossJTA)SAAJ JACC JCA (JBossJCA) JAAS (JBossSX) RMI-IIOP (jacORB)JAX-RPCDeployment API JAXR Management API * Product can run inside JBoss AS or stand-alone ** Integration as MBean under development JAXP JBoss Remoting*

5 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory JGroup & JBoss Cache

6 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JGroups Toolkit for reliable multicasting Fragmentation Message retransmission Ordering Group membership, membership change notification LAN or WAN based Like JMS Receive a message Retrieve membership Disconnect from the group Close the channel Be notified when members join, leave (including crashes) 6 Group topology

7 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JGroups (Layered) Architecture 7 Channel GMS UNICAST UDP FD NAKACK Channel GMS UNICAST UDP FD NAKACK Network Application Building Blocks Building Blocks Channel Application send() receive() Channel Application send() receive() Protocol Stack View Pipe & Filter View Queue & Tread

8 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Flexible Protocol Stack & Code Sample 2 threads per protocol Can be optimized away, per protocol down_thread="false", up_thread="false" Cause the up() or down() to run on caller's thread A protocol implements up() and/or down() methods When done, pass message on: passUp(), passDown() methods Tradeoff between performance/concurrency and context switching Code Sample 8 public void JGroupsSample () { JChannel channel = new JChannel("file://home/bela/default.xml"); channel.connect("demo-group"); // join the group System.out.println("members are: " + channel.getView().getMembers()); Message msg = new Message(null, null, "Hello world"); channel.send(msg); Message m=(Message)channel.receive(0); System.out.println("received msg from " + m.getSrc() + ": " + m.getObject()); ch.disconnect(); // Leave from demo-group ch.close(); }

9 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Advantages of Protocol Stacks Each property is implemented by 1 protocol Fragmentation, retransmission, ordering Protocols are assembled into a stack Stack has exactly the properties needed by the appl / required by the network Cant get this with java.net.Socket, always comes with full TCP/IP Small scope: a protocol does just one job, but does it well Protocol stacks are fashionable: Servlet 2.3 filters Interceptors (Corba, JBoss) AOP: separation of concerns, e.g. fragmentation should not be an application concern 9

10 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Available Protocols Transport: UDP, TCP, TCP_NIO, TUNNEL, JMS, LOOPBACK Discovery: PING, TCPPING, TCPGOSSIP, UDPPING Group membership Ordering: FIFO, CAUSAL, TOTAL, TOTAL_TOKEN Security: ENCRYPT, SSL ConnectionTable (n/a) Fragmentation: FRAG Flow control: FLOW_CONTROL, FC Misc: PIGGYBACK, COMPRESS Reliable delivery & FIFO: NAKACK, SMACK, UNICAST Failure detection: FD, FD_SOCK, FD_PID, FD_SIMPLE, FD_PROB, VERIFY_SUSPECT State transfer: STATE_TRANSFER 10

11 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Group Membership Maintain a list of members Notify members when a new member joins, or an existing member leaves (or crashes) Each member has the same ordered list List can be retrieved by Channel.getView() First (= oldest) member is coordinator If coordinator crashes, 2nd oldest takes over Actions JOIN LEAVE Member sends LEAVE to coordinator Coordinator multicasts new view to all members CRASH GMS multicasts new view (not containing crashed member) 11 If (first member) { Coordinator adds new member to list, and multicasts new view (member list) to all members } else { sends JOIN to coordinator }

12 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JBoss Cache A replicated, transactional, persistency and fine-grained cache system Transactional or non-transactional Non-Transactional Replication after each modification Transactional Replication at TX commit DB isolation levels supported Support for pluggable TxManagers 12

13 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JBoss Cache Module Two modules TreeCache TreeCacheAOP Uses JGroups as underlying transport stack 13

14 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform TreeCache Architecture Tree structure Each node has a name and zero or more children Can be navigated recursively from node to node or using a fully qualified name (/a/d/g) : like xpath Multiple roots per cache allowed Each node is a map with keys and values Locking Isolation level per node Drawback Coarse grained Replication replicate a big object even only a sub-field is dirty Interface Node put(FQN name, Object key, Object value) Insert a (key, value) pair Object get(FQN name, Object key) Finds by key with node name remove(FQN name, Object key) 14 a dc e gf h

15 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform TreeCacheAOP Subclass of TreeCache POJO needs not be Serializable (but needs instrumentation) Fine-grained field-level Pojo Cache Object graph Sub-object reference, Cross and multiple reference Polymorphism Inheritance Use JBossAops Dynamic AOP feature Eviction policy Object management transparency Once the object is put into cache, regular POJO field operation will trigger appropriate replication. (ex : a method call, field access, instance construction) It s Kind Of AOP Magic If under transaction, the POJO operation is transacted as well. Automatic Collection class support List, Map, and Set A proxy is generated for the Collection. User operates on the proxy 15

16 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform TreeCacheAop Mapping 16 Person p (key=/husband) name: Joe addr hobbies city: San Jose zip: 95123 / husband addr city zip95123 San Jose hobbies 120 wife Person p (key=/wife) name: Mary addr hobbies nameJoe nameMary

17 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform TreeCacheAOP is a JBoss AOP Product 17 Person.java Jboss-aop.xml AopMarker.java package org.jboss.cache.aop; // Annotation marker interface Public interface AopMakrer {} /** * @@org.jboss.aop.cache.AopMarker */ Public class Address { String tel; String street; int zip; … } *)" /> street seoul myung-dong tel 083)231-234 zip 33098 www objectworld.org update

18 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform TreeCacheAOP Interface & Configuration 18 ... org.jboss.cache.transaction.JBossTransactionManagerLookup REPEATABLE_READ REPL_SYNC... replySync- service.xml TreeCacheAop cache = new TreeCacheAop(); PropertyConfigurator configurator = new PropertyConfigurator(); // Configuration via xml Configurator.config(cache, META-INF/replSync-serivce.xml); cache.start(); Person joe = new Person(Joe Black, 51); // Put object into cache management cache.putObject(/person/joe, joe); // Fine grained replication here. Only the age field is replicated! cache.getObject(/person/joe).setAge(61); // Remove it from the cache management cache.removeObject(/person/joe); assert(null == cache.findObject(/person/joe)); Code

19 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Clustering

20 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Performance Decline Factors (State Replication) (Load Balancing) (Silent Failover) redirection 20

21 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Clustering High availability enterprise services via JBoss Clusters To run an application on several parallel servers (cluster nodes) while providing a single view to application clients Clustering is crucial for Scalable enterprise applications: improve performance by simply adding more nodes to the clusters Highly available enterprise applications: support the redundancy 21

22 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform JBoss Clustering Includes Cluster Set of nodes with a common goal - Homogeneous Partition - Group of nodes Not statically defined Defined by a name Node can join and leave as needed Automatic cluster membership discovery HA-Singleton Only node is running at the same time in a cluster 22

23 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Clustering Clustering On the same network, even for the same service, they may have different clusters (partition) 23 Partition A Jboss Node 1 Jboss Node 2 Jboss Node 3 Partition B Jboss Node 4 Jboss Node 5 Partition C Jboss Node 1 Clusters and server nodes

24 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Clustering Clustering (State Replication) – Synchronous & Asynchronous Replication HTTP Session Stateful Session Bean Entity Bean Plain Old Java Bean (POJO) (Load Balancing) HTTP Load-balancing via Apache Plug-in EJB Load-balancing via Dynamic Proxy Message-Driven Bean Load-balancing via Queue (Silent Failover) HTTP failover via Apache Plug-in EJB failover via Dynamic Proxy 24

25 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Clustering Expression 25 JBossWeb SFSB EJB 3 Entity Bean POJO SFSB EJB 3 Entity Bean POJO JBoss instance Fat Client ApacheThin Client Remoting HTTP

26 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Clustering Clustering Farming Deployment JBoss deployment scanner deploy Dynamic Cluster Definition, 26

27 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Farming Deployment Hot-deploy Any of the cluster members and the application will be automatically duplicated across all nodes in the same cluster by simply copying a file in a /farm folder 27

28 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Configuration File 28 ... jboss:service=${jboss.partition.name:DefaultPartition} 5000 farm/... farm-service.xml

29 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Dynamic Cluster Definition 29 If any node fails, the cluster will identify the failure and remove that node from the cluster definition of every node and all client proxies. All nodes in a JBoss cluster are peers. There is no central director of the cluster, which eliminates any single point of failure. To add a node to the cluster simply duplicate a drive of an existing node, give the node a unique name/IP, and connect it to the network. Now all of the nodes in the cluster and all client proxies are aware of the new cluster member. Node five is now included in all state replication operations as well. two one four three fourfive one Cluster Definition one two three four Cluster Definition one two three four five Cluster Definition two three four five

30 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory (State Replication) (State Replication)

31 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform State Replication (1) Fine-Grained State Replication Object Object, field level Synchronous VS. Asynchronous, ( ) 31

32 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform SFSB Replications After each invocation of a SFSB, if the bean changed, a message is broadcast to the cluster The message contains the serialized state of the session bean The broadcast operation is synchronous (blocking) with acknowledgements from all the nodes of the cluster 32 TreeCacheAOP SFSB 2. register 1. new 3. Notify to other node TreeCacheAOP 5. update 4. Update state 6. Notify to other node TreeCacheAOP Automatic TreeCacheAOP Notification

33 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform State Replication Across Cluster 33 one five two four three :::::::::::::::::::::::::::::::::: :: :::::: 4 4 QTY $2.25Coffee Mugs25 $1.99Coffee Filters #42 $6.59Coffee Beans (1lb)1 Unit Price Product DescriptionLine # Shopping Cart 10 Now all nodes in the cluster are in sync with the updated state of the shopping cart. Replicated Objects HttpSessions Stateful Session Beans HA-JNDI tree

34 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform State Replication (2) Buddy Replication & Data Gravitation for HTTP Session buddy node (backup server) HTTP cluster Failover, HTTP buddy node Sticky load-balancing (session affinity) 34

35 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory (Load-balancing) (Load-balancing)

36 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Load-balancer HTTP-based services do not require the client to download anything External load balancer is required to process all requests and dispatch them to server nodes in the cluster 36 Load-balancer Jboss Node 1 Jboss Node 2 Web Browser Sessions Replications 1 1.2 1.1 1.3

37 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Load-balancing HTTP Load-balancing Apache Plug-in (mod-jk) Load-balancing Weight Round Robin Lowest Session Lowest Network Traffic Lowest Current Load EJB Load-balancing via Dynamic Proxy EJB Stub (Proxy) Load-balancing Round Robin First Available First Available with identical all proxies Message-Driven Bean Load-balancing via Queue 37

38 Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar Chungnam National University Computer Science and Engineering Database System Laboratory Chungnam National University Computer Science and Engineering Database System Laboratory (Failover) (Failover)

39 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Failover HTTP failover L4, Apache Plug-in (mod_jk) EJB failover EJB Stub (Dynamic Proxy) Client Exception Cluster Cluster EJB Stub 39

40 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Client-Server Communication The clients downloads an intelligent stub from the server and uses it to access the bean The stub encapsulates the load balancing policy and the failover mechanism JBoss provides load balance policies: RoundRobin FirstAvailable (Sticky Sessions) FirstAvailableIdenticalAllProxies The stubs maintains a list of server addresses which is updated on each request 40 Client Intelligent Stub : Server Address List : Server Address Reference Invoke Node 1 Node 2 RMI Dispatcher fault

41 Chungnam National University Computer Science and Engineering Database System Laboratory JBoss Application ServerJBoss Application Platform Silent Failover via Dynamic Proxies 41 two one five fourthree Dynamic Proxy Client Application = replicated stateful object (e.g. Stateful Session Bean) Current Cluster Nodes one two three four Dynamic proxies are provided out-of-box in JBoss. The client application does not know or care that the server has failed-over.


Download ppt "Chungnam National University Computer Science and Engineering Database System Laboratory Database System Laboratory Seminar"

Similar presentations


Ads by Google