Outline. J2EE Clustering. J2EE Clustering. J2EE Clustering. J2EE Clustering. J2EE Performance Scalability and Clustering Part 2

Outline J2EE Performance Scalability and Clustering Part 2 ƒ ƒ ƒ ƒ J2EE Clustering C-JDBC Démo Conclusion Emmanuel Cecchet INRIA Rhône-Alpes, Objec...
Author: Shonda Sherman
2 downloads 1 Views 448KB Size
Outline J2EE Performance Scalability and Clustering Part 2

ƒ ƒ ƒ ƒ

J2EE Clustering C-JDBC Démo Conclusion

Emmanuel Cecchet INRIA Rhône-Alpes, ObjectWeb

J2EE Clustering

J2EE Clustering Servlet Server

EJB Server

DB Server

Servlet Server

EJB Server

DB Server

Servlet Server

EJB Server

DB Server

Servlet Server

EJB Server

DB Server

Servlet Server

EJB Server

DB Server

Servlet Server

EJB Server

DB Server

Client Client

Web server

Client

Web server

Client

Web server

Client

Client Client

Web server

ƒ hardware: L4-switch ƒ software: One-IP techniques, RR-DNS, …

ƒ Web server to Servlet server

Web server

Internet

ƒ Load balancing on Web Servers

J2EE Clustering ƒ Servlet/JSP server clustering ƒ Tomcat in-memory session replication ƒ failover ensured by mod_jk

ƒ Servlet/JSP to EJB server ƒ clustered JNDI ƒ load-balancing and failover by clusteraware stubs

ƒ Load balancing with JK module (mod_jk) ƒ Static weighted round-robin ƒ Session affinity

J2EE Clustering ƒ EJB Server clustering ƒ cluster stubs for load-balancing ƒ transparent failover for idempotent methods ƒ session-beans ƒ stateless: no state to replicate ƒ stateful: in-memory replication or database-based persistency

ƒ entity beans ƒ usually database based persistency

1

J2EE Clustering

Outline

ƒ Database clustering ƒ Commercial offers ƒ Oracle RAC (60.000$ / cpu) ƒ based on expensive SAN (Storage Area Network)

ƒ Open-source solutions ƒ No real clustering

ƒ ƒ ƒ ƒ

J2EE Clustering C-JDBC Démo Conclusion

ƒ master/slave replication in MySQL ƒ Postgres-R (still in alpha)

ƒ Clustered JDBC

C-JDBC motivations ƒ J2EE performance scalability bounded by database performance ƒ Large SMP are not commodity ƒ Database tier must be ƒ ƒ ƒ ƒ ƒ

scalable fault tolerant (high availability + failover) without modifying the client application using open source databases on commodity hardware

RAIDb ƒ Redundant Array of Inexpensive Databases (RAIDb) ƒ better performance and fault tolerance than a single database, ƒ at a low cost, ƒ by combining multiple DB instances into an array of DB.

ƒ RAIDb controller ƒ gives the view of a single database to the client ƒ balance the load on the database backends

ƒ RAIDb levels ƒ RAIDb-0: full partitioning (best performance) ƒ RAIDb-1: full mirroring (best fault tolerance) ƒ RAIDb-2: partial replication (best tradeoff)

RAIDb with

C-JDBC – Key ideas ƒ Middleware implementing RAIDb ƒ Two components ƒ generic JDBC 2.0 driver (C-JDBC driver) ƒ C-JDBC Controller

Servlet container Tomcat, Servlet container Jetty, ... ... , Jetty, Tomcat Database JDBC driver

JVM

ƒ C-JDBC Controller provides ƒ ƒ ƒ ƒ

performance scalability high availability failover caching, logging, monitoring, …

Java client program Database JDBC driver

JVM

Servlet container Tomcat,

EJB Container

EJB Container JOnAS,

JVM

WebLogic, JBoss, WebSphere, ...

Jetty, ...

JOnAS,

Java client program

EJB Container WebLogic, JBoss, JOnAS, WebLogic, WebSphere, ... ... JBoss, WebSphere,

C-JDBC driver

Database JDBC driver

C-JDBC driver JVM

JVM

JVM

C-JDBC No scalability No fault tolerance No failover

C-JDBC driver

C-JDBC Controller Scalability - Fault tolerance - Failover Monitoring - Caching - Logging - ... Database JDBC driver

ƒ Supports heterogeneous databases Database MySQL, PostgreSQL, Oracle, DB2, InstantDB, ...

Database Database Database Database Database MySQL, PostgreSQL, Oracle, DB2, InstantDB, ...

2

C-JDBC RAIDb-1 example

C-JDBC RAIDb-2 example

Servlet container

ƒ no client code modification ƒ original PostgreSQL driver and RDBMS engine ƒ C-JDBC provides scalable performance and high availability

Tomcat, Jetty, ...

C-JDBC driver Java client program

EJB Container JOnAS, WebLogic, JBoss, WebSphere, ...

JVM

C-JDBC driver

C-JDBC driver

JVM

JVM

C-JDBC Controller RAIDb-1 PostgreSQL JDBC driver

PostgreSQL

PostgreSQL

PostgreSQL

Inside the Controller C-JDBC driver

Configuration & administration

XML configuration file

Virtual database

Virtual database

Authentication Manager

Authentication Manager

Request Manager

XML engine

Request Manager

Scheduler Recovery Log

Request Cache

Scheduler Recovery Log

Request Cache

Load balancer

Load balancer

Database Backend

Database Backend

Database Backend

Database Backend

Database Backend

Connection Manager

Connection Manager

Connection Manager

Connection Manager

Connection Manager

MySQL JDBC driver

MySQL JDBC driver

MySQL JDBC driver

Oracle JDBC driver

Oracle JDBC driver

MySQL

MySQL

MySQL

Oracle

Oracle

C-JDBC – Horizontal scalability Java client program

C-JDBC driver JVM

Java client program

Java client program

C-JDBC driver

C-JDBC driver

JVM

JVM

C-JDBC Controller

JavaGroups

MySQL PostgreSQL JDBC driver JDBC driver

MySQL

EJB Container JOnAS, WebLogic, JBoss, WebSphere, ...

JVM

C-JDBC driver

C-JDBC driver

JVM

JVM

C-JDBC Controller RAIDb-2 Oracle JDBC driver

Oracle

MySQL JDBC driver

MySQL

MySQL

MySQL

ƒ prevents the controller to be a Single Point Of Failure ƒ distributes the load among several controllers ƒ coherency ensured by group communications

ƒ C-JDBC Driver ƒ multiple controllers automatic failover ƒ jdbc:c-jdbc://node1:1099:c1,node2:1234:c2/myDB

ƒ connection caching ƒ URL parsing/controller lookup caching

C-JDBC scalability

Java client program

C-JDBC driver JVM

C-JDBC Controller MySQL PostgreSQL JDBC driver JDBC driver

PostgreSQL

Tomcat, Jetty, ...

C-JDBC driver Java client program

ƒ Horizontal scalability

RMI Sockets

C-JDBC Controller

Administration console

Servlet container

C-JDBC scalability

Java client program (Servlet, EJB, ...)

Sockets RMI

ƒ unload a single Oracle DB with several MySQL ƒ add caching, fault tolerance, and monitoring for free

ƒ Vertical scalability ƒ allows nested RAIDb levels ƒ allows tree architecture for scalable write broadcast ƒ necessary with large number of backends ƒ C-JDBC driver re-injected in C-JDBC controller

PostgreSQL

MySQL

MySQL

3

C-JDBC vertical scalability ƒ RAIDb-1-1 with C-JDBC ƒ no limit to composition deepness

Client program

Client program

Client program

C-JDBC driver

C-JDBC driver JVM

C-JDBC vertical scalability ƒ RAIDb-0-1 with C-JDBC

C-JDBC driver

JVM

JVM

Client program

C-JDBC driver JVM

C-JDBC driver JVM

C-JDBC driver JVM

C-JDBC controller RAIDb-1

C-JDBC controller RAIDb-0

C-JDBC driver

C-JDBC driver

C-JDBC controller RAIDb-1

C-JDBC controller RAIDb-1

C-JDBC controller RAIDb-1

C-JDBC controller RAIDb-1

C-JDBC controller RAIDb-1

C-JDBC controller RAIDb-1

MySQL JDBC driver

MySQL JDBC driver

MySQL JDBC driver

DB native JDBC driver

DB native JDBC driver

DB native JDBC driver

MySQL

MySQL

MySQL

MySQL

MySQL

MySQL

MySQL

table w

MySQL

Performance - TPC-W Throughput in requests per minute

Client program

Client program

table w

table x & y

table x & y

table x & y

table z

table z

Fine-grain caching ƒ Cache hit rate with TPC-W

1600 1400

ƒ browsing mix

1200 Single DB

1000

RAIDb-1

600

RAIDb-2

400 200 0 0

1

2

3

4

5

No cache Table Column Column+ single-row

6

Num ber of nodes

Fine-grain caching

Response time 9.1 req/s 3.30s 12.9 req/s 1.96s 16 req/s 1.36s

Throughput

RAIDb-0

800

16 req/s

1.35s

Hit rate 12.6% 48.8% 49.2%

Outline

ƒ Cache hit rate with TPC-W ƒshopping mix Response time 12.8 req/s 3.11s 13.5 req/s 2.58s 19.0 req/s 0.93s

Throughput No cache Table Column Column+ single-row

20.2 req/s

0.84s

Hit rate 3.5% 30.0%

ƒ ƒ ƒ ƒ

J2EE Clustering C-JDBC Démo Conclusion

30.4%

4

Outline

Conclusion ƒ J2EE Clustering

ƒ ƒ ƒ ƒ

J2EE Clustering C-JDBC Démo Conclusion

ƒ ƒ ƒ ƒ

One-IP or RR-DNS Apache + mod_jk Tomcat + in memory session replication EJB Server ƒ distributed JNDI ƒ cluster-aware stubs

ƒ C-JDBC + any RDBMS

Questions ?

Bonus slides

ƒ Apache/Tomcat : http://www.apache.org ƒ JOnAS: http://www.objectweb.org/jonas ƒ C-JDBC: http://c-jdbc.objectweb.org

RAIDb - Definition ƒ Redundant Array of Inexpensive Databases ƒ better performance and fault tolerance than a single database, at a low cost, by combining multiple database instances into an array of databases ƒ RAIDb controller

RAIDb levels ƒ RAIDb-0 ƒ partitioning ƒ no duplication and no fault tolerance ƒ at least 2 nodes SQL requests RAIDb controller

ƒ gives the view of a single database to the client ƒ balance the load on the database backends

table 1

table 2 & 3

table ...

table n-1

table n

5

RAIDb levels

RAIDb levels

ƒ RAIDb-1

ƒ RAIDb-1ec

ƒ mirroring ƒ performance bounded by write broadcast ƒ at least 2 nodes

ƒ mirroring + error checking ƒ error checking ƒ read request sent to multiple databases ƒ replies compared ƒ result returned only if a quorum is reached

SQL requests RAIDb controller

Full DB

Full DB

Full DB

ƒ at least 3 nodes

Full DB

Full DB

RAIDb levels

RAIDb levels composition ƒ RAIDb-0-1

ƒ RAIDb-2

ƒ RAIDb-0 at the top level ƒ RAIDb-1 underneath

ƒ partial mirroring + partial partitioning ƒ at least 2 copies of each table ƒ at least 3 nodes

SQL requests

SQL requests

RAIDb-0 controller

RAIDb controller RAIDb-1 controller

Full DB

table x

table y

table x & y

table z

table w

RAIDb levels composition

RAIDb-1 controller

table w

table x & y

table x & y

RAIDb-1 controller

table x & y

table z

table z

Horizontal scalability

SQL requests

ƒ RAIDb-1-0 ƒ no limit to the composition deepness

Java client program

Java client program

RAIDb-1 controller

C-JDBC driver JVM

RAIDb-0 controller

Java client program

C-JDBC driver

C-JDBC driver

JVM

table x & y

table z

table w

table y

C-JDBC driver JVM

JVM

RAIDb-0 controller

C-JDBC Controller table w

Java client program

JavaGroups

C-JDBC Controller

JavaGroups

Java client program

C-JDBC driver JVM

C-JDBC Controller

table x & z MySQL PostGreSQL JDBC driver JDBC driver

DB2 JDBC driver

Oracle JDBC driver

RAIDb-0 controller

MySQL

table w

table x

table y

PostGreSQL

Oracle

Oracle

DB2

DB2

table z

6