Http://c-jdbc.objectweb.org/ - [email protected] 1 - 20/11/2003 C-JDBC: a High Performance...

31
tp://c-jdbc.objectweb.org/ - [email protected] 1 - 20/11/2003 C-JDBC: a High Performance Database Clustering Middleware Nicolas Modrzyk [email protected]

Transcript of Http://c-jdbc.objectweb.org/ - [email protected] 1 - 20/11/2003 C-JDBC: a High Performance...

http://c-jdbc.objectweb.org/ - [email protected] 1 - 20/11/2003

C-JDBC: a High Performance Database Clustering Middleware

Nicolas [email protected]

http://c-jdbc.objectweb.org/ - [email protected] 2 - 20/11/2003

Outline - Motivations

MotivationsUse-CasesC-JDBC conceptsPerformanceCommunityConclusion

http://c-jdbc.objectweb.org/ - [email protected] 3 - 20/11/2003

Motivations

J2EE performance scalability bounded by database performance

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

http://c-jdbc.objectweb.org/ - [email protected] 4 - 20/11/2003

What is

Database Database

C-JDBC Controller Scalability - Fault tolerance - Failover -

Monitoring - Caching - Logging - ...

Database JDBC driver

DatabaseDatabase Database

Database

JVM

Java client program

Database JDBC driver

JVM

EJB Container JOnAS, WebLogic,

JBoss, WebSphere, ...

Servlet container Tomcat, Jetty, ...

Database JDBC driver

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

Database JDBC driver

JVM

Java client program

C-JDBC driver

JVM

EJB Container

JOnAS,

WebLogic, JBoss, WebSphere, ...

Servlet container

Tomcat,

Jetty, ...

C-JDBC driver

C-JDBC driver

JVM

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

JVM

C-JDBC

No scalability No fault tolerance

No failover

EJB Container

JOnAS,

WebLogic, JBoss, WebSphere, ...

Servlet container

Tomcat,

Jetty, ...

http://c-jdbc.objectweb.org/ - [email protected] 5 - 20/11/2003

Key ideas

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– RAIDb-1: full mirroring– RAIDb-2: partial replication– composition possible

http://c-jdbc.objectweb.org/ - [email protected] 6 - 20/11/2003

C-JDBC

Middleware implementing RAIDbTwo components

– generic JDBC 2.0 driver (C-JDBC driver)– C-JDBC Controller

C-JDBC Controller provides– performance scalability– high availability– failover– caching, logging, monitoring, …

Supports heterogeneous databases

http://c-jdbc.objectweb.org/ - [email protected] 7 - 20/11/2003

Outline - Use-Cases

MotivationsUse-CasesC-JDBC conceptsPerformance CommunityConclusion

http://c-jdbc.objectweb.org/ - [email protected] 8 - 20/11/2003

What C-JDBC offers

Usually, we do this:

Database

JDBCDriver

Application

http://c-jdbc.objectweb.org/ - [email protected] 9 - 20/11/2003

Pooling

Cache

ControllerDatabaseVirtual

Driver

What C-JDBC offers

Now we have this:

Backend

JDBCDriver

Application

http://c-jdbc.objectweb.org/ - [email protected] 10 - 20/11/2003

What C-JDBC offers

And, finally we have all this:

DatabaseVirtual

BackendBackend recovery

Pooling

Cache

ControllerDatabaseVirtual

JDBCDriver

Load balancing

Driver

Application

http://c-jdbc.objectweb.org/ - [email protected] 11 - 20/11/2003

Heterogeneity support

application alreadywritten for a specific[commercial] database

user defined rulesfor on-the-fly queryrewriting to executeon heterogeneousbackends

MySQL MySQL

C-JDBC Controller RAIDb-2

MySQL JDBC driver

MySQLOracle

Java client program

C-JDBC driver

JVM

C-JDBC driver

C-JDBC driver

JVM

JVM

Oracle JDBC driver

EJB Container JOnAS, WebLogic,

JBoss, WebSphere, ...

Servlet container Tomcat, Jetty, ...

http://c-jdbc.objectweb.org/ - [email protected] 12 - 20/11/2003

Outline - C-JDBC concepts

MotivationsUse-CasesC-JDBC conceptsPerformanceCommunityConclusion

http://c-jdbc.objectweb.org/ - [email protected] 13 - 20/11/2003

Controller

XML configuration file

C-JDBC Controller

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

XML engine

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Configuration &

administrationAdministration console

RMIRMI

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

Recovery Log

Authentication Manager

Oracle

Oracle JDBC driver

Oracle JDBC driver

Oracle

SocketsSockets

JMX

http://c-jdbc.objectweb.org/ - [email protected] 14 - 20/11/2003

Virtual Database

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

gives the view of a single database

establishes the mapping between the database name used by the application and the backend specific settings

backends can be added and removed dynamically

configured using an XML configuration file

http://c-jdbc.objectweb.org/ - [email protected] 15 - 20/11/2003

Scheduler

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

Manages concurrency control

Specific implementations for Single DB, RAIDb 0, 1 and 2

Query-levelOptimistic and pessimistic

transaction level– uses the database schema that is

automatically fetched from backends

http://c-jdbc.objectweb.org/ - [email protected] 16 - 20/11/2003

Request cache

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

caches results from SQL requests

improved SQL statement analysis to limit cache invalidations– table based invalidations– column based invalidations– single-row SELECT optimization

request parsing possible in theC-JDBC driver– offload the controller– parsing caching in the driver

http://c-jdbc.objectweb.org/ - [email protected] 17 - 20/11/2003

Load balancer

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

RAIDb-0– query directed to the backend having the

needed tables

RAIDb-1– read executed by current thread– write executed in parallel by a dedicated

thread per backend– result returned if one, majority or all commit– if one node fails but others succeed, failing

node is disabled

RAIDb-2– same as RAIDb-1 except that writes are

sent only to nodes owning the written table

http://c-jdbc.objectweb.org/ - [email protected] 18 - 20/11/2003

Connection Manager

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

Connection pooling for a backend– Simple : no pooling– RandomWait : blocking pool– FailFast : non-blocking pool– VariablePool : dynamic pool

Connection pools defined on a per login basis– resource management per login– dedicated connections for admin

http://c-jdbc.objectweb.org/ - [email protected] 19 - 20/11/2003

Recovery Log

MySQL

C-JDBC driver

Java client program

(Servlet, EJB, ...)

MySQL

Virtual database

Database Backend

Connection Manager

Database Backend

Connection Manager

Request Manager

Request Cache

Scheduler

Load balancer

MySQL JDBC driver

MySQL JDBC driver

Recovery Log

Authentication Manager

MySQL

Database Backend

Connection Manager

MySQL JDBC driver

Checkpoints are associated with database dumps

Record all updates and transaction markers since a checkpoint

Used to resynchronize a database from a checkpoint

JDBCRecoveryLog– store information in a database– can be re-injected in a C-JDBC

cluster for fault tolerance

http://c-jdbc.objectweb.org/ - [email protected] 20 - 20/11/2003

Octopus integration

PostgreSQL

C-JDBC Controller

PostgreSQL JDBC driver

C-JDBC driver

JVM

EJB Container JOnAS, WebLogic,

JBoss, WebSphere, ...

dump for initial

checkpoint

Recovery Log

Octopus

PostgreSQL PostgreSQLdisabled disabledenabled

enabled

JDBC Recovery Log

Add new backends while being online

Restore dump corresponding to initial checkpoint with Octopus

http://c-jdbc.objectweb.org/ - [email protected] 21 - 20/11/2003

Outline - Performance

MotivationsUse-CasesC-JDBC conceptsPerformance CommunityConclusion

http://c-jdbc.objectweb.org/ - [email protected] 22 - 20/11/2003

TPC-W Performance

0

200

400

600

800

1000

1200

1400

1600

0 1 2 3 4 5 6

Number of nodes

Th

rou

gh

pu

t in

req

ues

ts p

er m

inu

te

Single DB

RAIDb-0

RAIDb-1

RAIDb-2

http://c-jdbc.objectweb.org/ - [email protected] 23 - 20/11/2003

RUBiS- Tomcat withoutC-JDBC caching

Tomcat~50% cpu

1 Database100% cpu

Throughput: 3900 pages/min

http://c-jdbc.objectweb.org/ - [email protected] 24 - 20/11/2003

RUBiS- Tomcat withC-JDBC caching

Tomcat~55% cpu

1 Database~20% cpu

Throughput: 4200 pages/min

C-JDBC <10% cpu

http://c-jdbc.objectweb.org/ - [email protected] 25 - 20/11/2003

Outline - Community

MotivationsUse-CasesC-JDBC conceptsPerformanceCommunityConclusion

http://c-jdbc.objectweb.org/ - [email protected] 26 - 20/11/2003

Stats as of November, 2003

Downloads– total : 8500 downloads since may 2003– last 30 days : > 2800 downloads– > 430.000 hits since first release– 2nd most downloaded ObjectWeb project

Mailing lists– [email protected]: 101 subscribers– [email protected]: 18 subscribers

Team– 9 committers– 1 full-time INRIA engineer

http://c-jdbc.objectweb.org/ - [email protected] 27 - 20/11/2003

The developer community

Mathieu Peltier (ObjectWeb)– build scripts, automatic installer, JUnit test

Julie Marguerite (ObjectWeb)– JDBCRecoveryLog, automatic schema detection

Christiana Amza (Rice University), Anupam Chanda (Rice University), Sara Bouchenak (EPF Lausanne)

– SQL query caching

Guillaume Bort (INRIA Lorraine)– JBoss support

Marek Prochazka (INRIA Rhone-Alpes)– Datasource implementation

Greg Ward (dplanet.ch)– Sybase support, design, debug

Marc Wick (monte-bre.ch)– HSQL support, design debug and ideas

Duncan Smith (mightybot.com)– IP binding, security concerns, console, JMX, distributed management

Vadim Kassin (Kazakhstan Stock Exchange)– Autogenerated keys support

http://c-jdbc.objectweb.org/ - [email protected] 28 - 20/11/2003

Outline - Conclusion

MotivationsUse-CasesC-JDBC conceptsPerformanceCommunityConclusion

http://c-jdbc.objectweb.org/ - [email protected] 29 - 20/11/2003

Current status

C-JDBC 1.0b15 release– Generic JDBC 2.0 driver– Schedulers and load balancers for RAIDb 0, 1 and 2– Fine grain query caching– JDBC recovery log– Logger/request player– Java installer– User documentation

On-going work and efforts– Octopus integration (in next release)– Horizontal scalability (for Christmas) – Dynamic reconfiguration …

http://c-jdbc.objectweb.org/ - [email protected] 30 - 20/11/2003

Prototype

C-JDBC Management Framework

Shared design

http://c-jdbc.objectweb.org/ - [email protected] 31 - 20/11/2003

Your questions&&

Your comments …

http://c-jdbc.objectweb.org