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