25
In-Memory !? MADE IN

In memory OLTP

Embed Size (px)

Citation preview

Page 1: In memory OLTP

JJOO

Page 2: In memory OLTP

In-Memory? Who?In-Memory Architecture

In-Memory DEMO

JJOO

In-Memory File

Page 3: In memory OLTP

MADE IN JJOO

Page 4: In memory OLTP

JJOO

Hekaton? In-Memory? In-Memory OLTP?

Memory-optimized OLTP engine

RDBMS + In-Memory = Hybrid

High Level Architecture

Page 5: In memory OLTP

LOGO

최적화된 메모리• 메모리 가격의 하락• DISK 가 아닌 메모리에 저장• 빠른 속도

T-SQL 머신 코드 전환• 명령어 개수 감소• 처리 속도증가• 낮은 지연속도

고도의 동시성• Latching 해결• Lock Free 알고리즘 구현

SQL Server 와 통합• 기존의 구조 + 인메모리• 기존의 기능 모두 사용가능

Page 6: In memory OLTP

JJOO

NEW function① In-memory Table

② Natively Compiled Procedure

③ Hash Index

④ NON CLUSTERED Hash Index

Page 7: In memory OLTP

JJOO

Hekaton ? DBCC PINTABLE 과 다름 대부분의 기존 쿼리를 그대로 사용 가능

But! 일부 수정이 필요하며 , Native Compiled Procedure 는 제약이 더 많음 재시작하면 테이블의 데이터가 손실

But! 옵션을 이용하여 , 데이터를 보존 할 수 있음 HASH INDEX 가 무조건 좋지는 않음

범위 검색 또는 몇 가지 검색에 제약 있음

Page 8: In memory OLTP

MADE IN JJOO

Page 9: In memory OLTP

JJOO

TDS Handler and Session Management

Memory Optimized Table File-group

Transaction Log Data Filegroup

Natively CompiledSP & schema

In-MemoryCompiler T-SQL Query Execution

Buffer Pool for Tables & Indexes

ParserCatalog

Opti-mizer

Memory Optimized Table & Indexes

Page 10: In memory OLTP

JJOO

ROW HEADER Payload ( 컬럼 )

Start Time Stamp

EndTime Stamp Statement ID Index Link

Count8 bytes 8 bytes 4 bytes 2 bytes 8 bytes * 인덱스 개수

….

Page 11: In memory OLTP

Data Search

JJOO

SELECT * FROM DB-Null

WHERE NAME = ‘주형권’

Get key’s Index bucket B = H(‘ 주형권’ ) % (BUCKET_COUNT-1)

Exists a row(Pointer) at

Bucket B?

Row key=‘ 주형권’ and End Time-

stamp = ∞

Do this row points to another row?

Row not Found

Return Row

Y

N

Y

N

N

Y

Page 12: In memory OLTP

JJOO

01234567

Index Key 1

Index Key 2

Hashfunction

Start Tstm

EndTstm Pointer Data 1 Data 2 Data 3

Start Tstm

EndTstm Pointer Data 1 Data 2 Data 3

Start Tstm

EndTstm Pointer Data 1 Data 2 Data 3

Start Tstm

EndTstm Pointer Data 1 Data 2 Data 3

Start Tstm

EndTstm Pointer Data 1 Data 2 Data 3

Page 13: In memory OLTP

JJOO

01234567

Index Key 1

Hashfunction

30 ∞ Pointer 주형권 DBA 남자

Start Time Stamp End Time Stamp Pointer Name JOB SEX

Hash In-dex

‘Name’

50 ∞ Pointer 주형권 개발자 남자

Page 14: In memory OLTP

JJOO

01234567

Index Key 1

Hashfunction

30 ∞ Pointer 주형권 DBA 남자

Start Time Stamp End Time Stamp Pointer Name JOB SEX

Hash In-dex

‘Name’

50 ∞ Pointer 주형권 개발자 남자

100 270 Pointer 이승연 DBA 남자

Page 15: In memory OLTP

JJOO

01234567

Index Key 1

Hashfunction

30 ∞ Pointer 주형권 DBA 남자

Start Time Stamp End Time Stamp Pointer Name JOB SEX

Hash In-dex

‘Name’

50 ∞ Pointer 주형권 개발자 남자

100 270 Pointer 이승연 DBA 남자

100 ∞ Pointer 이승연 DBA 남자

Page 16: In memory OLTP

Hash Collision

JJOO

01234567

Index Key 1

Hashfunction

30 ∞ Pointer 주형권 DBA 남자

Start Time Stamp End Time Stamp Pointer Name JOB SEX

Hash In-dex

‘Name’

200 ∞ Pointer 권순용 DBA 남자

Page 17: In memory OLTP

Garbage collection

JJOO

01234567

Index Key 1

Hashfunction

30 ∞ Pointer 주형권 DBA 남자

Start Time Stamp End Time Stamp Pointer Name JOB SEX

Hash In-dex

‘Name’

50 ∞ Pointer 주형권 개발자 남자

100 270 Pointer 이승연 DBA 남자

100 ∞ Pointer 이승연 DBA 남자

Page 18: In memory OLTP

MADE IN JJOO

Page 19: In memory OLTP

File Architecture

JJOO

File Checkpoint File (Data File / Delta File 존재 )

① Filestream ② 순차적 기록③ 복원에 사용

Transaction Log File① Commit transaction 만 기록 (Disk Table 과 다름 )② Disk Table 보다 저장 양이 작음③ Disk Table 과 같은 곳에 저장

Page 20: In memory OLTP

Check point

JJOO

Offline Checkpoint Thread

Memory-optimized Table Filegroup

Range 100~200 Range 200~300 Range 300~400 Range 400~500 Range 500~

Delete 150 TS Delete 250 TS Insert New Row

Page 21: In memory OLTP

JJOO

Memory-optimized Table Filegroup Memory-optimized Table Filegroup

Memory-optimized Table Filegroup Memory-optimized Table Filegroup

Memory-optimized Table Filegroup Memory-optimized Table Filegroup

Page 22: In memory OLTP

MADE IN JJOO

Page 23: In memory OLTP

DEMO

JJOO

DEMO

Page 24: In memory OLTP

LOGO

Page 25: In memory OLTP

LOGO