TimesTen 应用层数据库缓存学习:1. 基本概念

Cache Group基本概念

TimesTen Application-Tier Database Cache is an Oracle Database product option that includes the Oracle TimesTen In-Memory Database. It is used as a database cache at the application tier to cache Oracle Database data and reduce the workload on the Oracle database. It also provides the connection and transfer of data between an Oracle database and a TimesTen database, as well as facilitating the capture and processing of high-volume event flows into a TimesTen database and subsequent transfer of data into an Oracle database.

TimesTen既可以作为单独的数据库,也可以作为Oracle数据库的缓存。在被Oracle收购之前,TimesTen可以作为很多数据库的缓存,如Sybase,不过收购之后,就只支持Oracle了。

作为缓存,既可以提升性能,也可减轻后端数据库的负载。

You can cache Oracle Database data in a TimesTen database within cache groups. A cache group in a TimesTen database can cache a single Oracle Database table or a group of related Oracle Database tables. You can also share Oracle Database data globally across several TimesTen databases with global cache groups, which must be members of a cache grid.

作为缓存,TimesTen有Cache Group和Cache Grid两种方式。前者是一个TimesTen对应一个Oracle数据库,后者则是多个TimesTen对应一个Oracle数据库。

A cache grid is a set of distributed TimesTen in-memory databases that work together to cache data from an Oracle database and guarantee cache coherence for global cache groups among the TimesTen databases.

不适用cache grid,也可以多个独立的cache group来对应一个Oracle数据库,但cache grid的好处是保证数据的coherence,即数据一致性。

一个cache grid是由多个grid member组成的,grid member为一个独立的TimesTen数据库,或为Active Standby Pair。 grid member由grid node组成,独立的TimesTen数据库只有一个node,Active Standby Pair有两个node,即active master和standby master。
TimesTen 应用层数据库缓存学习:1. 基本概念_第1张图片

在上图中,cache grid有3个grid member,4个grid nodes。

In a cache grid, global cached data is dynamically distributed across multiple grid members without shared storage. This architecture enables the capacity of the cache grid to scale based on the processing needs of the application. When the workload increases or decreases, new grid members attach to the grid or existing grid members detach from the grid. Attaching to or detaching from the grid are online operations that do not interrupt operations on other grid members.

cache grid共享Oracle的数据,每一个缓存数据(cache instance)只能属于一个节点,但可以在节点之间传递,随着grid member的增加,缓存容量和处理能力可以横向扩展。

When requests are submitted to the grid members, the cache grid automatically redistributes data based on application access patterns. The location of the data is transparent to the application, but the cache grid redistributes data dynamically to minimize access time. The cache grid automatically maintains cache coherence and transactional consistency across the grid members.

缓存的数据对于应用透明,也就是说,不管应用访问哪个节点,都可以访问到数据。如果数据不在此节点,数据可以从所属的节点传递到此节点,然后此节点变为数据新的属主。当然,数据分布的原则应 尽量避免数据传递。

Data is loaded from an Oracle database into a cache group within a TimesTen database in units called cache instances. A cache instance is defined as a single row in the cache group’s root table together with the set of related rows in the child tables.

cache instance是TimesTen中缓存的一行数据。

Cache Group的类型包含只读(Read Only),读写(AWT)等

TimesTen与Oracle的数据传递如下图:

其中TimesTen中提交的交易通过Flush和Propagate传递到Oracle,Flush是手工的,Propagate是自动的。这些操作对应于AWT Cache Group.
Oracle中提交的交易通过Load, refresh和autorefresh 传递到TimesTen,其中Load,refresh是手工的,autorefresh是自动的。这些操作对应于Read only Group.

Cache Group的数据加载分为Explicitly和dynamic 两种方式。
Explicitly方式特征为:

In an explicitly loaded cache group, cache instances are loaded manually into the TimesTen cache tables from an Oracle database by using a load or refresh operation or automatically by using an autorefresh operation. The cache tables are loaded before operations such as queries are performed on the tables. An explicitly loaded cache group is appropriate when the set of data to cache is static and can be predetermined before applications begin performing operations on the cache tables. By default, cache groups are explicitly loaded unless they are defined as dynamic.

Dynamic方式特征为:

In a dynamic cache group, cache instances are loaded into the TimesTen cache tables on demand from an Oracle database using a dynamic load operation or manually using a load operation. A manual refresh or an autorefresh operation on a dynamic cache group can result in existing cache instances being updated or deleted, but committed updates on Oracle Database data that are not being cached do not result in new cache instances being loaded into its cache tables. A dynamic cache group is appropriate when the set of data to cache is small and should not be preloaded from Oracle Database before applications begin performing operations on the cache tables.

Cache Group也可以实现高可用性,通过Active Standby Pair(ASP)。如果是Cache Grid,可以通过让其每一个member为ASP来实现高可用性

参考:Oracle® TimesTen Application-Tier Database Cache User’s Guide 11g Release 2 (11.2.2) E21634-11 | 1 TimesTen Application-Tier Database Cache Concepts

你可能感兴趣的:(timesten,缓存组,cachegroup)