목차
概述
Part 1: Oracle TimesTen In-Memory Database
TimesTen架构
TimesTen高可用
应用层缓存
Part II: Oracle Database In-Memory
Oracle Database In-Memory概览
新的In-Memory列格式
内存扫描
内存中JOIN
内存中Aggregations 和 Groupings
内存列存储和完整的交易一致性
列存储的扩展
列格式的未来发展
参考
데이터 베이스 MySQL 튜토리얼 Oracle的内存数据库战略

Oracle的内存数据库战略

Jun 07, 2016 pm 02:49 PM
oracle 메모리 전략 데이터 베이스 소개

此文简介了Oracle内存数据库的两大分支,TimesTen和Database In-Memory,非常值得一读,两种技术的重要特性完全涵盖,可以让读者很快的对Oracle内存数据库技术的关键点有一个全面的认识,建议看完此文后可以对参考中的原文再读一遍。 概述 随着内存容量不断

此文简介了Oracle内存数据库的两大分支,TimesTen和Database In-Memory,非常值得一读,两种技术的重要特性完全涵盖,可以让读者很快的对Oracle内存数据库技术的关键点有一个全面的认识,建议看完此文后可以对参考中的原文再读一遍。

概述

随着内存容量不断增大,价格不断下降,将全部的用户数据置入内存已避免昂贵的I/O已成为可能。

Oracle提供两种互补的内存数据库技术,用于应用层和数据库层:
1) TimesTen
可以部署在数据库层,作为独立的数据库;或在应用层作为后端Oracle数据库的缓存。
主要用于低延迟的OLTP应用

2) Database In-Memory
是数据库企业版12c的选件,部署在数据库层,用于加速分析负载。数据库的大小不受内存的限制,需要分析的表可以载入内存,其它的可以用磁盘, SSD等存储。

Part 1: Oracle TimesTen In-Memory Database

TimesTen架构

TimesTen是关系型的内存数据库,支持ACID。由于数据完全在内存中,因此可以实现高性能低延时。

应用可以使用JDBC, ODBC, OCI, SQL连接TimesTen.

TimesTen支持传统的C/S模式,以及独有的更高性能Direct模式(In direct-link mode, all database API invocations are treated simply as function calls into the TimesTen shared library allowing for in-process execution of database code)

为何内存数据库比Cache还要快,解释如下:

Another over-arching design principle is the use of memory-based addressing rather than logical addressing. For instance, indexes in TimesTen contain pointers to the tuples in the base table. The metadata describing the layout of a table contains pointers to the pages comprising the table. Therefore both index scans and tablescans can operate via pointer traversal. This design approach is repeated over and over again in the storage manager, with the result that TimesTen is significantly faster than a disk-oriented database even one that is completely cached – since there is no overhead from having to translate logical rowids to physical memory addresses of buffers in a buffer cache.

支持的索引类型为Hash, Range和Bitmap

Hash Indexes for speeding up lookup queries, Bitmap Indexes for accelerating star joins with complex predicates, as well as Range Indexes for accelerating range scans.

ACID中的Transactional Durability是通过Checkpoint和write-ahead logging实现的,有两个checkpoint文件和多个log文件。每一次checkpoint完成时,就会切换到另一个文件,因此总有一个完整的内存映像用于备份和恢复时的roll-forward。日志方面,为性能计,TimesTen除提供与Oracle一样的Durable Commit外,也提供delayed-durability模式,即日志写入log buffer后,后台每200ms将buffer中的数据flush到磁盘。
如果对数据丢失不能容许,可以使用Durable Commit模式或后面提到的2-Safe复制模式

缺省隔离级为read-committed isolation。支持行级锁,和Oracle一样,也支持MVCC或MVRC,这样读写互不阻塞。

TimesTen高可用

TimesTen的高可用是通过基于日志的复制实现的,原理是log-shipping。支持异步,准同步和同步模式(2-Safe)。

With 2-safe replication, a transaction is committed locally only after the commit has been successfully acknowledged by the receiver.

2-safe 复制通常与non-durable commit组合使用.

This combination allows applications to achieve commit durability in two memories, without requiring any disk IO.

复制可以基于单个表(Classic Replication)和整个数据库(Active Standb Pair),复制可以是双向(Classic Replication)或单向复制(Classic Replication或Active Standb Pair),最常用和推荐的复制模式为Active Standb Pair,Standby节点运行只读应用,Standby节点可以再复制到多个Subscriber节点以提高读扩展性。
可以通过并行复制提高复制速度和吞吐量。

应用层缓存

这是TimesTen最常用的模式,即作为后端Oracle数据库的可持久化的交易缓存,从而极大的加速应用。
应用层缓存的高性能取决于:
In-Memory Optimizations - 这是最根本的,即全内存的架构比基于磁盘的架构速度快得多
Application Proximity - TimesTen部署在中间层,离应用更近,而独有的Direct Mode,可以使应用和TimesTen在进程内通讯,进一步提高效率

TimesTen以Cache Group对应Oracle中需要缓存的表。
Cache Group中数据的加载支持Pre-Load(预先加载)和Dynamically loaded(访问时加载)模式。

对于Dynamically loaded模式,The data to be referenced must be identified by an equality predicate on the primary key of the root table

Dynamically loaded模式还可以指定缓存Aging策略,可以基于时间或LRU

最常用的缓存类型是Read-Only Cache Groups和Updatable Cache Groups:
Read-Only Cache Groups -

For data that is infrequently updated, but widely read, a read-only cache group can be created on TimesTen to offload the backend Oracle database. Very hot reference data, as online catalogs, airline gate arrival/departure information, etc. is a candidate for this type of caching. The Oracle side tables corresponding to Read-Only cache groups are updated on Oracle. The updates are periodically refreshed into TimesTen using an automatic refresh mechanism.

Updatable Cache Groups -

For frequently updated data, an updatable cache group with write-through synchronization is appropriate. Account balance information for an online ecommerce application, the location of subscribers in a cellular network, streaming sensor data, etc. are all candidates for write-through caching. TimesTen provides a number of alternative mechanisms for propagating writes to Oracle, but the most commonly used and highest performing mechanism is referred to as Asynchronous Writethrough where the changes are replicated to Oracle using a log-based transport mechanism. This mechanism is also capable of applying changes to Oracle in parallel, in keeping with the parallel-everywhere design theme of the system.

注意: TimesTen中的术语write-through等同于存储中的write-back。
从TimesTen到Oracle的复制,原理同TimesTen到TimesTen的复制是一样的。

可以为一个Oracle数据库部署多个TimesTen缓存,它们之间是协同的,称为Application-Tier Database Cache Grid。

因此缓存的类型可进一步划分为本地和全局Cache Group。
Local Cache Groups -
缓存中的数据是私有的,其它成员看不到

This type of cache group is useful when the data can be statically partitioned across grid members; for instance, different ranges of user profile Ids may be cached on different grid members.

Global Cache Groups -

In many cases, an application cannot be statically partitioned and Global Cache Groups allow applications to transparently share cached contents across a grid of independent TimesTen databases. With this type of cache group, cache instances are migrated across the grid on reference. Only consistent (committed) changes are propagated across the grid.

缓存中的数据可以为其它成员共享。应用从哪个TimesTen节点访问,cache instance就会传递到那个节点。因此,尽管不能静态分区,但还是应尽量保证数据的本地化,避免节点间过多的数据传递。

Thus, the contents of the global cache group are accessible from any location, via data shipping.

在没有考虑复制的前提下,每一个cache instance在全局缓存中只有一份,这样,增加TimesTen节点就可以横向扩展,提供更多的容量和处理能力。
如果需要考虑高可用,可以为每一个节点建立Active Standby Pair。

可以通过global query实现对于全局缓存中所有TimesTen成员的联邦查询。例如COUNT(*), MAX等

A global query is a query executed in parallel across multiple grid members.

Part II: Oracle Database In-Memory

Oracle Database In-Memory概览

Oracle Database In-Memory(DBIM)为数据提供了行和列两种格式,其中行格式是早已有的Buffer Cache。和传统的内存数据库不同,DBIM并不限制数据的容量必须完全容纳在内存中。
DBIM的创新在于:
* 双格式
行格式适合访问多个列少数行的OLTP应用,列格式适合分析
* 无限容量
可以将重要的用于分析的表和分区置于IM column store,而其余数据置于buffer cache,SSD和磁盘
* 应用透明
由于列格式无缝的嵌入到数据访问层,所有的数据库特性如RAC,多租户,ADG都可以结合使用,数据库自动判断是访问列存储还是buffer cache

新的In-Memory列格式

新的列格式完全基于内存,可以将整个表空间,表,表的部分列,分区和子分区置于内存中。
数据可以修改,数据库自动维护列格式和行格式的数据一致性。
数据自动通过后台进程发布到内存中,不会有应用中断。
数据的加载可以控制优先级,可以在数据库启动时预先加载,或在访问时实时加载。

加载的数据是自动压缩的,可以选择不同的压缩级别,如果OLTP范围频繁,可以选择开销较小的压缩级别。

内存扫描

通过SIMD(Single Instruction Multiple Data)可以实现单个指令对多个列数据并行扫描。

Storage Index进一步实现I/O优化,

An In-Memory Storage Index keeps track of minimum and maximum values for each column CU.

类似于分区,在查询时可以略过不必要的CU(Column Unit),从而减少I/O

内存中JOIN

典型的在fact table和dimension table间的star join可以通过bloom filter将join转化为列扫描,这非常适合于列式存储,从而提高扫描速度。

内存中Aggregations 和 Groupings

A new optimizer transformation, called Vector Group By, is used to compute multi-dimensional aggregates in real-time. The Vector Group By transformation is a two-part process similar to the well known star transformation.

内存列存储和完整的交易一致性

The default isolation level provided by Oracle Database is known as Consistent Read. With Consistent Read, every transaction in the database is associated with a monotonically increasing timestamp referred to as a System Change Number (SCN). A multi-versioning protocol is employed by the buffer cache to ensure that a given transaction or query only sees changes made by transactions with older SCNs.

加入列存储格式后,仍然可以与buffer cache保持数据一致性。

The IM column store similarly maintains the same consistent read semantics as the buffer cache. Each IMCU is marked with the SCN of the time of its creation. An associated metadata area, known as a Snapshot Metadata Unit (SMU) tracks changes to the rows within the IMCU made beyond that SCN.

SMU维护IMCU中数据的有效性,如果数据由于修改导致陈旧,在查询时会自动与日志联合查询得到最新的数据,然后后台会自动更新IMCU中的数据。

IMCU的更新可以根据设定的阈值或定期的小批量更新。

列存储的扩展

通过在RAC节点间分布数据实现扩展。同时可实现并行查询

分布的策略可以依据分区,如果没有分区,可以依据ROWID。或者完全由系统自动选择。

数据分布后,如果考虑高可用,可以选择复制,复制的数据位于RAC中的其它节点或其它所有节点。

列格式的未来发展

  • 考虑与12c中的Automatic Data Optimization (ADO)结合,实现数据的自动生命周期管理
  • 在ADG的物理standby上实现列存储,从而可以充分利用灾备端,实现最大ROI
  • 将列格式扩展到Flash或其它可持久化的内存技术上

参考

  • Oracle’s In-Memory Database Strategy for OLTP and Analytics
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 채팅 명령 및 사용 방법
1 몇 달 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

MySQL : 세계에서 가장 인기있는 데이터베이스 소개 MySQL : 세계에서 가장 인기있는 데이터베이스 소개 Apr 12, 2025 am 12:18 AM

MySQL은 오픈 소스 관계형 데이터베이스 관리 시스템으로, 주로 데이터를 신속하고 안정적으로 저장하고 검색하는 데 사용됩니다. 작업 원칙에는 클라이언트 요청, 쿼리 해상도, 쿼리 실행 및 반환 결과가 포함됩니다. 사용의 예로는 테이블 작성, 데이터 삽입 및 쿼리 및 조인 작업과 같은 고급 기능이 포함됩니다. 일반적인 오류에는 SQL 구문, 데이터 유형 및 권한이 포함되며 최적화 제안에는 인덱스 사용, 최적화 된 쿼리 및 테이블 분할이 포함됩니다.

MySQL을 사용하는 이유는 무엇입니까? 혜택과 장점 MySQL을 사용하는 이유는 무엇입니까? 혜택과 장점 Apr 12, 2025 am 12:17 AM

MySQL은 성능, 신뢰성, 사용 편의성 및 커뮤니티 지원을 위해 선택됩니다. 1.MYSQL은 효율적인 데이터 저장 및 검색 기능을 제공하여 여러 데이터 유형 및 고급 쿼리 작업을 지원합니다. 2. 고객-서버 아키텍처 및 다중 스토리지 엔진을 채택하여 트랜잭션 및 쿼리 최적화를 지원합니다. 3. 사용하기 쉽고 다양한 운영 체제 및 프로그래밍 언어를 지원합니다. 4. 강력한 지역 사회 지원을 받고 풍부한 자원과 솔루션을 제공합니다.

Oracle Loop에서 커서를 만드는 방법 Oracle Loop에서 커서를 만드는 방법 Apr 12, 2025 am 06:18 AM

Oracle에서 FOR 루프 루프는 커서를 동적으로 생성 할 수 있습니다. 단계는 다음과 같습니다. 1. 커서 유형을 정의합니다. 2. 루프를 만듭니다. 3. 커서를 동적으로 만듭니다. 4. 커서를 실행하십시오. 5. 커서를 닫습니다. 예 : 커서는 상위 10 명의 직원의 이름과 급여를 표시하기 위해주기별로 만들 수 있습니다.

Oracle Dynamic SQL을 만드는 방법 Oracle Dynamic SQL을 만드는 방법 Apr 12, 2025 am 06:06 AM

SQL 문은 Oracle의 동적 SQL을 사용하여 런타임 입력을 기반으로 작성 및 실행할 수 있습니다. 단계에는 다음이 포함됩니다 : 동적으로 생성 된 SQL 문을 저장할 빈 문자열 변수 준비. 즉시 실행 또는 준비 명령문을 사용하여 동적 SQL 문을 컴파일하고 실행하십시오. 바인드 변수를 사용하여 사용자 입력 또는 기타 동적 값을 동적 SQL로 전달하십시오. 동적 SQL 문을 실행하려면 즉시 실행 또는 실행을 사용하십시오.

Oracle AWR 보고서를 읽는 방법 Oracle AWR 보고서를 읽는 방법 Apr 11, 2025 pm 09:45 PM

AWR 보고서는 데이터베이스 성능 및 활동 스냅 샷을 표시하는 보고서입니다. 해석 단계에는 다음이 포함됩니다 : 활동 스냅 샷의 날짜 및 시간 식별. 활동 및 자원 소비에 대한 개요를 봅니다. 세션 활동을 분석하여 세션 유형, 자원 소비 및 대기 이벤트를 찾으십시오. 느린 SQL 문, 자원 경합 및 I/O 문제와 같은 잠재적 성능 병목 현상을 찾으십시오. 대기 이벤트를보고, 성능을 위해 식별하고 해결하십시오. 래치 및 메모리 사용 패턴을 분석하여 성능 문제를 일으키는 메모리 문제를 식별하십시오.

Oracle Cursor를 닫는 문제를 해결하는 방법 Oracle Cursor를 닫는 문제를 해결하는 방법 Apr 11, 2025 pm 10:18 PM

Oracle Cursor Closure 문제를 해결하는 방법에는 다음이 포함됩니다. Close 문을 사용하여 커서를 명시 적으로 닫습니다. For Update 절에서 커서를 선언하여 범위가 종료 된 후 자동으로 닫히십시오. 연관된 PL/SQL 변수가 닫히면 자동으로 닫히도록 사용 절에서 커서를 선언하십시오. 예외 처리를 사용하여 예외 상황에서 커서가 닫혀 있는지 확인하십시오. 연결 풀을 사용하여 커서를 자동으로 닫습니다. 자동 제출을 비활성화하고 커서 닫기를 지연시킵니다.

Oracle에서 데이터베이스를 열는 방법 Oracle에서 데이터베이스를 열는 방법 Apr 11, 2025 pm 10:51 PM

Oracle 데이터베이스를 열기위한 단계는 다음과 같습니다. Oracle 데이터베이스 클라이언트를 열고 데이터베이스 서버에 연결하십시오. username/password@servername sqlplus 명령을 사용하여 데이터베이스를 엽니 다.

Oracle의 트리거 사용 방법 Oracle의 트리거 사용 방법 Apr 11, 2025 pm 11:57 PM

Oracle의 트리거는 특정 이벤트 (삽입, 업데이트 또는 삭제) 후 자동으로 작업을 수행하는 데 사용되는 저장된 절차입니다. 데이터 검증, 감사 및 데이터 유지 관리를 포함한 다양한 시나리오에서 사용됩니다. 트리거를 만들 때 트리거 이름, 협회 테이블, 트리거 이벤트 및 트리거 시간을 지정해야합니다. 트리거에는 두 가지 유형이 있습니다. 이전 트리거가 작동하기 전에 발사되고 작업 후 트리거가 발사됩니다. 예를 들어, 이전 삽입 트리거는 삽입 된 행의 연령 열이 음수가 아닌지 확인합니다.

See all articles