CSQL DATABASE CACHE
Bijaya Kumar Sahu
Database Developer
Lakshya Solutions Pvt Ltd
What Is Next…
CSQL Cache Functionalities
CSQL Cache Configuration
Cache Tools
Information About :
What is CSQL Cache ?
CSQL Cache is a client side caching mechanism for any disk-based database
which increase the throughput of existing applications without requiring any
application changes.
CSQL Cache Functionalities
Updateable Cache Tables
Bi-Directional Updates
Synchronous and Asynchronous update propagation
Cont…
CSQL Cache Functionalities
Partial cache Updates
Multiple cache granularity
Recovery for cached tables
Cont…
CSQL Cache Functionalities
Tools to validate the coherence of cache
Transparent access to non-cached tables
Horizontally Scalable
Transparent Fail over
CSQL Cache Configuration
CACHE_TABLE
CACHE_ID
DSN
ENABLE_BIDIRECTIONAL_CACHE
CACHE_RECEIVER_WAIT_SECS
TABLE_CONFIG_FILE
For CSQL Cache Configuration , Following flag need to be set which is present in “ csql.conf ” file.
Unidirectional Cache Configuration
CACHE_TABLE = true
CACHE_ID = 1
DSN = <Dsn name of target database>*
ENABLE_BIDIRECTIONAL_CACHE = false
CACHE_RECEIVER_WAIT_SECS = 10
TABLE_CONFIG_FILE = <path of table configure file>**
For Unidirectional Caching, Set flags as below
Cont…
Unidirectional Cache Configuration
For Unidirectional Caching, Be sure that
CSQL server and target database is running.
Isql tool for target database working properly.
Use cache tool to cache table to Cache node.
Bi-Directional Cache Configuration
For Bi-Directional Caching, Set flags as below
CACHE_TABLE = true
CACHE_ID = 1
DSN = <Dsn name of target database>*
ENABLE_BIDIRECTIONAL_CACHE = true
CACHE_RECEIVER_WAIT_SECS = 10
TABLE_CONFIG_FILE = <path of table configure file>**
Cont…* For MySql := myodbc3, For Postgres : = psql etc.
** By default path /tmp/csql/csqltable.conf
Bi-Directional Cache Configuration
Create log table in target database.
For MySql :
create table csql_log_int ( tablename char(64), pkid int, operation int , cacheid int, id int not null unique auto_increment) engine=‘innodb’ ;
For Postgres :
create table csql_log_int( tablename varchar(64), pkid int, operation int,cacheid int);
alter table csql_log_int add id serial;
Cont…
Bi-Directional Cache Configuration
For Bi-directional Caching,
Run Trigger on key field of cached table.
Configure Isql tool for target database
Be sure CSQL server and target database server are running
Use cache tool to cache table to Cache node.
Multiple Cache Node Configuration
For Multiple Cache Node Configuration Change CACHE_ID in the csql.conf file as unique id for different cache
node.
Configure as per Bi-directional Cache Node.
Be sure CSQL server in each node and target database server are running.
Use cache tool to cache table into each Cache Node .
Make appropriate changes in trigger file.
Cache Tools
CSQL Cache have following Cache tools.
cachetable
cacheverify
Cont…
Cache Tools (cachetable)
Full Caching
Partial Caching ( Record based & Field based )
Caching with Direct Updates
CSQL supports three ways of caching mode
Cont…
To cache table from target database to cache node.
Cache Tools (cachetable)
Usage
cachetable [-U username] [-P password] -t tablename [-D]
-c "condition" -f "selected field names" -p fieldname [-R]
[-s] [-r]
username -> username to connect with csql.
password -> password for the above username to connect with csql.
tablename -> table name to be cached in csql from target db.
Cont…
Cache Tools (cachetable)
fieldname -> field name to be specified for the bidirectional caching
on which trigger to be run .
R -> Recover all cached tables from the target database.
s -> Load only the records from target db. Assumes table is
already created in csql
r -> Reload the table. get the latest image of table from target db
Cont…
Cache Tools (cachetable)
u -> Unload the table. if used with -s option, removes only
records and preserves the schema
D -> Enable direct option. For any non select SQL statement
directly interact with target database.
no option -> Get table definition and records from target db and
create in csql.
Cache Tools (cacheverify)
Usage
cacheverify [-U username] [-P password] -t tablename [-p] [-f]
username -> username to connect with csql.
password -> password for the above username to connect with csql.
Display the consistency in the specified cached table in between cache node and target database.
Cont…
Cache Tools (cacheverify)
tablename -> cached table name in csql from target db.
p -> verification at primary key field level
f -> verification at record level
?-> help
For More Information
Visit… http://sourceforge.net/projects/csql/
http://www.csqlcache.com/
http://www.csqldb.com/
Top Related