Document 7275134

Download Report

Transcript Document 7275134

C-JDBC: a High Performance Database
Clustering Middleware
Nicolas Modrzyk
[email protected]
http://c-jdbc.objectweb.org/ - [email protected]
1 - 20/11/2003
Outline - Motivations
Motivations
Use-Cases
C-JDBC concepts
Performance
Community
Conclusion
http://c-jdbc.objectweb.org/ - [email protected]
2 - 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]
3 - 20/11/2003
What is
Servlet
container
Servlet
container
Tomcat,
Servlet container
Jetty,
... ...
Tomcat
, Jetty,
Database
JDBC driver
JVM
EJB
Container
JOnAS,
Java client
program
EJB Container
WebLogic, JBoss,
JOnAS, WebLogic,
WebSphere,
... ...
JBoss,
WebSphere,
C-JDBC
driver
Database
JDBC driver
Java client
program
Database
JDBC driver
JVM
Jetty, ...
EJB
Container
C-JDBC driver
JOnAS,
JVM
WebLogic, JBoss,
WebSphere, ...
Tomcat,
C-JDBC
Database
MySQL, PostgreSQL,
Oracle, DB2, InstantDB, ...
http://c-jdbc.objectweb.org/ - [email protected]
JVM
JVM
JVM
No scalability
No fault tolerance
No failover
C-JDBC driver
C-JDBC Controller
Scalability - Fault tolerance - Failover Monitoring - Caching - Logging - ...
Database JDBC driver
Database Database Database Database Database
MySQL, PostgreSQL, Oracle, DB2, InstantDB, ...
4 - 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]
5 - 20/11/2003
C-JDBC
Middleware implementing RAIDb
Two 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]
6 - 20/11/2003
Outline - Use-Cases
Motivations
Use-Cases
C-JDBC concepts
Performance
Community
Conclusion
http://c-jdbc.objectweb.org/ - [email protected]
7 - 20/11/2003
What C-JDBC offers
Usually, we do this:
Application
Database
JDBC
Driver
http://c-jdbc.objectweb.org/ - [email protected]
8 - 20/11/2003
What C-JDBC offers
Now we have this:
Application
Virtual
Database Controller
JDBC
Driver
Driver
Cache
Pooling
http://c-jdbc.objectweb.org/ - [email protected]
Backend
9 - 20/11/2003
What C-JDBC offers
And, finally we have all this:
Load balancing
Application
Virtual
VirtualDatabase
Database Controller
Driver
JDBC
Driver
Cache
Pooling
http://c-jdbc.objectweb.org/ - [email protected]
Backend
Backend recovery
10 - 20/11/2003
Heterogeneity support
Servlet container
 application already
written for a specific
[commercial] database
 user defined rules
for on-the-fly query
rewriting to execute
on heterogeneous
backends
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-2
Oracle JDBC driver
MySQL JDBC driver
MySQL
MySQL
MySQL
Oracle
http://c-jdbc.objectweb.org/ - [email protected]
11 - 20/11/2003
Outline - C-JDBC concepts
Motivations
Use-Cases
C-JDBC concepts
Performance
Community
Conclusion
http://c-jdbc.objectweb.org/ - [email protected]
12 - 20/11/2003
Controller
Java client
program
(Servlet, EJB, ...)
C-JDBC
driver
RMI
Sockets
Sockets
RMI
C-JDBC Controller
XML configuration file
Administration
console
JMX
Configuration
&
administration
Virtual database
Virtual database
Authentication Manager
Authentication Manager
Request Manager
Request Manager
XML engine
Scheduler
Recovery
Log
Request Cache
Scheduler
Recovery
Log
Request Cache
Load balancer
http://c-jdbc.objectweb.org/ - [email protected]
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
13 - 20/11/2003
Oracle
Virtual Database
Java client
program
(Servlet, EJB, ...)
C-JDBC
driver
Virtual database
Authentication Manager
Request Manager
Scheduler
Recovery
Log
Request Cache
Load balancer
Database
Backend
Database
Backend
Database
Backend
Connection
Manager
Connection
Manager
Connection
Manager
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
MySQL
MySQL
 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]
14 - 20/11/2003
Scheduler
Java client
program
(Servlet, EJB, ...)
C-JDBC
driver
Virtual database
Authentication Manager
Request Manager
Scheduler
Recovery
Log
Request Cache
Load balancer
Database
Backend
Database
Backend
Database
Backend
Connection
Manager
Connection
Manager
Connection
Manager
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
JDBC driver
Manages concurrency
control
Specific implementations
for Single DB, RAIDb 0, 1
and 2
Query-level
Optimistic and pessimistic
transaction level
– uses the database schema that is
automatically fetched from backends
MySQL
MySQL
MySQL
http://c-jdbc.objectweb.org/ - [email protected]
15 - 20/11/2003
Request cache
Java client
program
(Servlet, EJB, ...)
C-JDBC
driver
Virtual database
Authentication Manager
Request Manager
 caches results from SQL
requests
 improved SQL statement
analysis to limit cache
invalidations
Scheduler
Recovery
Log
– table based invalidations
– column based invalidations
– single-row SELECT optimization
Request Cache
Load balancer
Database
Backend
Database
Backend
Database
Backend
Connection
Manager
Connection
Manager
Connection
Manager
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
JDBC driver
 request parsing possible in the
C-JDBC driver
– offload the controller
– parsing caching in the driver
MySQL
MySQL
MySQL
http://c-jdbc.objectweb.org/ - [email protected]
16 - 20/11/2003
Load balancer
Java client
program
(Servlet, EJB, ...)
 RAIDb-0
C-JDBC
driver
– query directed to the backend having the
needed tables
Virtual database
Authentication Manager
 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
Request Manager
Scheduler
Recovery
Log
Request Cache
Load balancer
Database
Backend
Database
Backend
Database
Backend
Connection
Manager
Connection
Manager
Connection
Manager
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
JDBC driver
 RAIDb-2
MySQL
MySQL
MySQL
http://c-jdbc.objectweb.org/ - [email protected]
– same as RAIDb-1 except that writes are
sent only to nodes owning the written table
17 - 20/11/2003
Connection Manager
Java client
program
(Servlet, EJB, ...)
Connection pooling for a
backend
C-JDBC
driver
–
–
–
–
Virtual database
Authentication Manager
Request Manager
Scheduler
Recovery
Log
Request Cache
Load balancer
Database
Backend
Database
Backend
Database
Backend
Connection
Manager
Connection
Manager
Connection
Manager
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
JDBC driver
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
MySQL
MySQL
MySQL
http://c-jdbc.objectweb.org/ - [email protected]
18 - 20/11/2003
Recovery Log
Java client
program
(Servlet, EJB, ...)
C-JDBC
driver
Virtual database
Authentication Manager
Request Manager
Scheduler
Recovery
Log
Request Cache
Load balancer
Database
Backend
Database
Backend
Database
Backend
Connection
Manager
Connection
Manager
Connection
Manager
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
JDBC driver
MySQL
MySQL
Checkpoints are associated
with database dumps
Record all updates and
transaction markers since a
checkpoint
Used to resynchronize a
database from a checkpoint
JDBCRecoveryLog
MySQL
http://c-jdbc.objectweb.org/ - [email protected]
– store information in a database
– can be re-injected in a C-JDBC
cluster for fault tolerance
19 - 20/11/2003
Octopus integration
 Add new
backends while
being online
 Restore dump
JDBC
corresponding toRecovery
Log
initial checkpoint
with Octopus
Octopus
EJB Container
JOnAS, WebLogic,
JBoss, WebSphere, ...
C-JDBC driver
JVM
enabled
C-JDBC Controller
Recovery
Log
PostgreSQL JDBC driver
dump
for initial
checkpoint
http://c-jdbc.objectweb.org/ - [email protected]
PostgreSQL PostgreSQL
disabled
enabled
PostgreSQL
disabled
20 - 20/11/2003
Outline - Performance
Motivations
Use-Cases
C-JDBC concepts
Performance
Community
Conclusion
http://c-jdbc.objectweb.org/ - [email protected]
21 - 20/11/2003
Throughput in requests per minute
TPC-W Performance
1600
1400
1200
Single DB
1000
RAIDb-0
800
RAIDb-1
600
RAIDb-2
400
200
0
0
1
2
3
4
5
6
Num ber of nodes
http://c-jdbc.objectweb.org/ - [email protected]
22 - 20/11/2003
RUBiS- Tomcat without
C-JDBC caching
Throughput: 3900 pages/min
1 Database
100% cpu
Tomcat
~50% cpu
http://c-jdbc.objectweb.org/ - [email protected]
23 - 20/11/2003
RUBiS- Tomcat with
C-JDBC caching
Throughput: 4200 pages/min
Tomcat
~55% cpu
1 Database
~20% cpu
C-JDBC
<10% cpu
http://c-jdbc.objectweb.org/ - [email protected]
24 - 20/11/2003
Outline - Community
Motivations
Use-Cases
C-JDBC concepts
Performance
Community
Conclusion
http://c-jdbc.objectweb.org/ - [email protected]
25 - 20/11/2003
Downloads
–
–
–
–
Stats as of November,
2003
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]
26 - 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]
27 - 20/11/2003
Outline - Conclusion
Motivations
Use-Cases
C-JDBC concepts
Performance
Community
Conclusion
http://c-jdbc.objectweb.org/ - [email protected]
28 - 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]
29 - 20/11/2003
Prototype
 C-JDBC
Management
Framework
Shared design
http://c-jdbc.objectweb.org/ - [email protected]
30 - 20/11/2003
Your questions
&&
Your comments …
http://c-jdbc.objectweb.org
http://c-jdbc.objectweb.org/ - [email protected]
31 - 20/11/2003