[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱

PgDay.Seoul
PgDay.SeoulPgDay.Seoul
PostgreSQL을 위한
리눅스 커널 최적화
김상욱
PgDay.Seoul 2017
2
김상욱
• Co-founder and CEO @ Apposha
• 성균관대 컴퓨터공학 박사과정
• 4편의 SCI 저널 저술, 6편의 국제학술대회 논문 발표
• 클라우드/가상화 분야
• 멀티코어 스케줄링 [ASPLOS’13, VEE’14]
• 그룹 기반 메모리 관리 [JPDC’14]
• 데이터베이스/저장장치 분야
• 비휘발성 캐시 관리 [USENIX ATC’15, ApSys’16]
• 리퀘스트 중심 I/O 우선 처리 [FAST’17, HotStorage’17]
Apposha?
3
완전 관리형 서비스
MySQL 대비 5배 성능
상용 제품 대비 1/10 비용
for
Contents
• PostgreSQL 성능 관점에서의 리눅스 커널 최적화
• 백그라운드 작업 영향 최소화
• Full page writes 제거
• Parallel query 처리 최적화
4
Contents
• PostgreSQL 성능 관점에서의 리눅스 커널 최적화
• 백그라운드 작업 영향 최소화
• Full page writes 제거
• Parallel query 처리 최적화
5
PostgreSQL 구조
6
* 내부 프로세스 종류
- Backend (foreground)
- Checkpointer
- Autovacuum workers
- WAL writer
- Writer
- …
Storage Device
Linux Kernel
P1
클라이언트
P2
I/O
P3 P4
요청 응답
I/O I/O I/O
PostgreSQL
DB 성능
PostgreSQL 구조
7
* 내부 프로세스 종류
- Backend (foreground)
- Checkpointer
- Autovacuum workers
- WAL writer
- Writer
- …
Storage Device
Linux Kernel
P1
클라이언트
P2
I/O
P3 P4
요청 응답
I/O I/O I/O
PostgreSQL
PostgreSQL Checkpoint
8
http://www.interdb.jp/pg/pgsql09.html
PostgreSQL Autovacuum
9
Free Space Map
http://bstar36.tistory.com/308
백그라운드 태스크 영향
10
• Dell Poweredge R730
• 32 cores
• 132GB DRAM
• 1 SAS SSD
• PostgreSQL v9.5.6
• 52GB shared_buf
• 10GB max_wal
• TPC-C workload
• 50GB dataset
• 1 hour run
• 50 clients
0
200
400
600
800
1000
1200
0 500 1000 1500 2000 2500 3000
최대응답지연(ms)
경과시간 (초)
Default
최대 1.1초
백그라운드 태스크 영향
11
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
1 50 100 150 200 250 300
처리량(trx/sec)
클라이언트 수
Default Aggressive AV
처리량 40%
autovacuum_max_workers
3 => 6
autovacuum_naptime
1min => 15s
autovacuum_vacuum_threshold
50 => 25
autovacuum_analyze_threshold
50 => 10
autovacuum_vacuum_scale_factor
0.2 => 0.1
autovacuum_analyze_scale_factor
0.1 => 0.05
autovacuum_vacuum_cost_delay
20ms => -1
autovacuum_vacuum_cost_limit
-1 => 1000
백그라운드 태스크 영향
12
• Dell Poweredge R730
• 32 cores
• 132GB DRAM
• 1 SAS SSD
• PostgreSQL v9.5.6
• 52GB shared_buf
• 10GB max_wal
• TPC-C workload
• 50GB dataset
• 1 hour run
• 50 clients
0
500
1000
1500
2000
2500
0 500 1000 1500 2000 2500 3000
최대응답지연(ms)
경과시간 (초)
Default Aggressive AV
최대 2.5초
I/O 우선순위 적용의 어려움
• 각 계층에서의 독립적인 I/O 처리
13
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
I/O 우선순위 적용의 어려움
• 각 계층에서의 독립적인 I/O 처리
14
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Buffer Cache
read() write()
admission
control
I/O 우선순위 적용의 어려움
• 각 계층에서의 독립적인 I/O 처리
15
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Buffer Cache
read() write()
Block-level Q
admission
control
I/O 우선순위 적용의 어려움
• 각 계층에서의 독립적인 I/O 처리
16
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Buffer Cache
read() write()
Block-level Q
reorder
FG FG BGBG
I/O 우선순위 적용의 어려움
• 각 계층에서의 독립적인 I/O 처리
17
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Buffer Cache
read() write()
Block-level Q
reorder
FG FG BGBG
Device-internal Q
admission
control
I/O 우선순위 적용의 어려움
• 각 계층에서의 독립적인 I/O 처리
18
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Buffer Cache
read() write()
Block-level Q
reorder
FG FG BGBG
Device-internal QBG FG BGBG
reorder
I/O 우선순위 적용의 어려움
19
• I/O 우선순위 역전
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Locks
Condition variables
I/O 우선순위 적용의 어려움
20
• I/O 우선순위 역전
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Locks
Condition variablesCondition variables
I/OFG
lock
BG
wait
I/O 우선순위 적용의 어려움
21
• I/O 우선순위 역전
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Locks
Condition variablesCondition variables
I/OFG
lock
BG
wait
I/OFG
lock
BG
wait
FG
wait
wait
BGvar
wake
I/O 우선순위 적용의 어려움
22
• I/O 우선순위 역전
Storage Device
Caching Layer
Application
File System Layer
Block Layer
Abstraction
Locks
Condition variablesCondition variables
I/OFG
lock
BG
wait
I/OFG
lock
BG
wait
FG
wait
wait
BGvar
wake
I/O
FG
wait
wait
BGuser
var
wake
FG
wait
리퀘스트 중심 I/O 우선처리
• 솔루션 v1 (사후대책)
• 전체 계층에서의 우선순위 적용 [FAST’17]
• 동적 우선순위 상속 [USENIX ATC’15, FAST’17]
23
FG
lock
BG I/OFG BG
submit
complete
FG BG
FG
wait
BG
register
BG
inherit
FG BGI/O
submit
complete
wake
CV CV CV
[USENIX ATC’15] Request-Oriented Durable Write Caching for Application Performance
[FAST’17] Enlightening the I/O Path: A Holistic Approach for Application Performance
리퀘스트 중심 I/O 우선처리
• 솔루션 v1 (문제점)
24
리퀘스트 중심 I/O 우선처리
• 솔루션 v2 (사전예방)
25
Device Driver
Noop CFQ Deadline Apposha I/O Scheduler
Block Layer
Ext4 XFS F2FS
VFS
Apposha Front-End File System
Etc
리눅스 커널 I/O 스택
PageCache
- 우선순위 기반 I/O 스케줄링
- 디바이스 큐 혼잡 제어
- 우선순위 기반 쓰기 I/O 제어
- OS 캐싱 효율성 향상
리퀘스트 중심 I/O 우선처리
26
Apposha 최적화 엔진
MongoDB
Library
PostgreSQL
Library
Elasticsearch
Library
V12-M V12-P V12-E
- 태스크 중요도, 파일 접근 패턴 분류
Front-End File System I/O Scheduler
• V12 성능 최적화 엔진
리퀘스트 중심 I/O 우선처리
27
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
1 50 100 150 200 250 300
처리량(trx/sec)
클라이언트 수
Default Aggressive AV
리퀘스트 중심 I/O 우선처리
28
0
2000
4000
6000
8000
10000
12000
1 50 100 150 200 250 300
처리량(trx/sec)
클라이언트 수
Default Aggressive AV V12-P
처리량
71-86%
리퀘스트 중심 I/O 우선처리
29
0
500
1000
1500
2000
2500
0 500 1000 1500 2000 2500 3000
최대응답지연(ms)
경과시간 (초)
Default Aggressive AV V12-P
최대 0.15초
Contents
• PostgreSQL 성능 관점에서의 리눅스 커널 최적화
• 백그라운드 작업 영향 최소화
• Full page writes 제거
• Parallel query 처리 최적화
30
Full Page Writes
31
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
32
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
33
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
34
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
35
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
36
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
37
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
38
Tuning PostgreSQL for High Write Workloads – Grant McAlister
Full Page Writes
• WAL 크기
39
0
2
4
6
8
10
12
14
0 100 200 300 400 500 600
WAL크기(GB)
경과시간 (초)
Default
• PostgreSQL v9.6.5
• 52GB shared_buf
• 1GB max_wal
• TPC-C workload
• 50GB dataset
• 10 min run
• 200 clients
Full Page Writes
40
https://www.toadworld.com/platforms/postgres/b/weblog/archive/2017/06/07/a-first-look-at-
amazon-aurora-with-postgresql-compatibility-benefits-and-drawbacks-part-v
WAL Compression
• WAL 크기
41
0
2
4
6
8
10
12
14
0 100 200 300 400 500 600
WAL크기(GB)
경과시간 (초)
Default WAL compression
WAL Compression
• 성능 영향
42
0
2000
4000
6000
8000
10000
12000
처리량(trx/sec)
Default WAL compression
WAL Compression
• CPU 사용률
43
0
10
20
30
40
50
60
70
80
90
100
0 100 200 300 400 500 600
CPU사용률(%)
경과시간 (초)
Default WAL compression
Atomic Write 지원
44
매핑 레이어
PostgreSQL
Linux Kernel
Atomic Write 지원
45
매핑 레이어
DB 파일
open()
DB 쉐도우 파일
PostgreSQL
Linux Kernel
Atomic Write 지원
46
매핑 레이어
DB 파일
write()
DB 쉐도우 파일
PostgreSQL
Linux Kernel
Atomic Write 지원
47
매핑 레이어
DB 파일
read()
DB 쉐도우 파일
PostgreSQL
Linux Kernel
Atomic Write 지원
48
매핑 레이어
DB 파일
fsync()
DB 쉐도우 파일
체크포인트
PostgreSQL
Linux Kernel
Atomic Write 지원
49
매핑 레이어
DB 파일
write()
DB 쉐도우 파일
Atomic Write 지원
50
매핑 레이어
DB 파일
write()
DB 쉐도우 파일
Atomic Write 지원
51
매핑 레이어
DB 파일 DB 쉐도우 파일
read()
Atomic Write 지원
• WAL 크기 (max_wal_size=1GB)
52
0
2
4
6
8
10
12
14
0 100 200 300 400 500 600
WAL크기(GB)
경과시간 (초)
Default WAL compression V12-P
Atomic Write 지원
• 성능 영향
53
0
2000
4000
6000
8000
10000
12000
처리량(trx/sec)
Default WAL compression V12-P
처리량 2X
Atomic Write 지원
• CPU 사용률
54
0
10
20
30
40
50
60
70
80
90
100
0 100 200 300 400 500 600
CPU사용률(%)
경과시간 (초)
Default WAL compression V12-P
Contents
• PostgreSQL 성능 관점에서의 리눅스 커널 최적화
• 백그라운드 작업 영향 최소화
• Full page writes 제거
• Parallel query 처리 최적화
55
Parallel Query
56
https://blog.2ndquadrant.com/whats-new-in-postgres-xl-9-6/
Parallel Query
57
느린 응답
빠른 응답
사용자 쿼리
백엔드
워커
cache
storage
cache
storage
cache
storage
cache
storage
hit hitmiss!
워커 워커 워커
miss!
Parallel Query
• 기존 문제점
58
Parallel Query 처리 최적화
• 성능 영향
59
pgbench –i –s 1000 test1
pgbench –i –s 1000 test2
Q1: SELECT * FROM pgbench_accounts WHERE filler LIKE ‘%x% -d test1
Q2: SELECT * FROM pgbench_accounts WHERE filler LIKE ‘%x% -d test2
QUERY PLAN
--------------------------------------------------------------------------------------
Gather (cost=1000.00..1818916.53 rows=1 width=97)
Workers Planned: 7
-> Parallel Seq Scan on pgbench_accounts (cost=0.00..1817916.43 rows=1 width=97)
Filter: (filler ~~ '%x%'::text)
Parallel Query 처리 최적화
• 성능 영향
60
0
5
10
15
20
25
30
35
40
Solo Deadline Noop CFQ Task-aware
응답시간(초)
Q1 Q2
Parallel Query 처리 최적화
• 성능 영향 (디바이스 큐 off)
61
0
20
40
60
80
100
Solo Deadline Noop CFQ Task-aware
응답시간(초)
Q1 Q2 평균 응답
30% 향상
62
H http://apposha.io
F www.facebook.com/apposha
M sangwook@apposha.io
1 of 62

Recommended

PostgreSQL 튜닝워크샵 (2017년8월) by
PostgreSQL 튜닝워크샵 (2017년8월)PostgreSQL 튜닝워크샵 (2017년8월)
PostgreSQL 튜닝워크샵 (2017년8월)DBdemy
10.9K views207 slides
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재 by
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재PgDay.Seoul
415 views23 slides
[Pgday.Seoul 2018] 이기종 DB에서 PostgreSQL로의 Migration을 위한 DB2PG by
[Pgday.Seoul 2018]  이기종 DB에서 PostgreSQL로의 Migration을 위한 DB2PG[Pgday.Seoul 2018]  이기종 DB에서 PostgreSQL로의 Migration을 위한 DB2PG
[Pgday.Seoul 2018] 이기종 DB에서 PostgreSQL로의 Migration을 위한 DB2PGPgDay.Seoul
1.9K views20 slides
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정 by
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정PgDay.Seoul
188 views33 slides
Mvcc in postgreSQL 권건우 by
Mvcc in postgreSQL 권건우Mvcc in postgreSQL 권건우
Mvcc in postgreSQL 권건우PgDay.Seoul
3.7K views42 slides
[Pgday.Seoul 2021] 1. 예제로 살펴보는 포스트그레스큐엘의 독특한 SQL by
[Pgday.Seoul 2021] 1. 예제로 살펴보는 포스트그레스큐엘의 독특한 SQL[Pgday.Seoul 2021] 1. 예제로 살펴보는 포스트그레스큐엘의 독특한 SQL
[Pgday.Seoul 2021] 1. 예제로 살펴보는 포스트그레스큐엘의 독특한 SQLPgDay.Seoul
422 views20 slides

More Related Content

What's hot

[Pgday.Seoul 2020] SQL Tuning by
[Pgday.Seoul 2020] SQL Tuning[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL TuningPgDay.Seoul
1.2K views44 slides
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization by
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and OptimizationPgDay.Seoul
238 views107 slides
PostgreSQL Performance Tuning by
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
4.1K views64 slides
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱 by
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱PgDay.Seoul
186 views30 slides
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자 by
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자PgDay.Seoul
4.3K views14 slides
Introduction VAUUM, Freezing, XID wraparound by
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundMasahiko Sawada
2.3K views42 slides

What's hot(20)

[Pgday.Seoul 2020] SQL Tuning by PgDay.Seoul
[Pgday.Seoul 2020] SQL Tuning[Pgday.Seoul 2020] SQL Tuning
[Pgday.Seoul 2020] SQL Tuning
PgDay.Seoul1.2K views
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization by PgDay.Seoul
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
PgDay.Seoul238 views
PostgreSQL Performance Tuning by elliando dias
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
elliando dias4.1K views
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱 by PgDay.Seoul
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
PgDay.Seoul186 views
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자 by PgDay.Seoul
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
PgDay.Seoul4.3K views
Introduction VAUUM, Freezing, XID wraparound by Masahiko Sawada
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
Masahiko Sawada2.3K views
binary log と 2PC と Group Commit by Takanori Sejima
binary log と 2PC と Group Commitbinary log と 2PC と Group Commit
binary log と 2PC と Group Commit
Takanori Sejima4K views
Pgday bdr 천정대 by PgDay.Seoul
Pgday bdr 천정대Pgday bdr 천정대
Pgday bdr 천정대
PgDay.Seoul1.6K views
EDB Postgres DBA Best Practices by EDB
EDB Postgres DBA Best PracticesEDB Postgres DBA Best Practices
EDB Postgres DBA Best Practices
EDB3.4K views
[236] 카카오의데이터파이프라인 윤도영 by NAVER D2
[236] 카카오의데이터파이프라인 윤도영[236] 카카오의데이터파이프라인 윤도영
[236] 카카오의데이터파이프라인 윤도영
NAVER D212.9K views
Deep dive into PostgreSQL statistics. by Alexey Lesovsky
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky22.9K views
45分で理解する SQL Serverでできることできないこと by Insight Technology, Inc.
45分で理解する SQL Serverでできることできないこと45分で理解する SQL Serverでできることできないこと
45分で理解する SQL Serverでできることできないこと
CLUB DB2 第137回:基礎から再入門!DB2モニタリング入門 by Akira Shimosako
CLUB DB2 第137回:基礎から再入門!DB2モニタリング入門CLUB DB2 第137回:基礎から再入門!DB2モニタリング入門
CLUB DB2 第137回:基礎から再入門!DB2モニタリング入門
Akira Shimosako28.6K views
[pgday.Seoul 2022] PostgreSQL with Google Cloud by PgDay.Seoul
[pgday.Seoul 2022] PostgreSQL with Google Cloud[pgday.Seoul 2022] PostgreSQL with Google Cloud
[pgday.Seoul 2022] PostgreSQL with Google Cloud
PgDay.Seoul230 views
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~ by Miki Shimogai
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
Miki Shimogai118.7K views
Maria db 이중화구성_고민하기 by NeoClova
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기
NeoClova3.4K views
SQL Server チューニング基礎 by Jiayi Yang
SQL Server チューニング基礎SQL Server チューニング基礎
SQL Server チューニング基礎
Jiayi Yang438 views
MySQLを割と一人で300台管理する技術 by yoku0825
MySQLを割と一人で300台管理する技術MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術
yoku082550.5K views
MySQL GTID 시작하기 by I Goo Lee
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
I Goo Lee6.3K views
[B31,32]SQL Server Internal と パフォーマンスチューニング by Yukio Kumazawa by Insight Technology, Inc.
[B31,32]SQL Server Internal と パフォーマンスチューニング by Yukio Kumazawa[B31,32]SQL Server Internal と パフォーマンスチューニング by Yukio Kumazawa
[B31,32]SQL Server Internal と パフォーマンスチューニング by Yukio Kumazawa

Similar to [Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱

[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화 by
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화NAVER D2
6.6K views74 slides
[232] 성능어디까지쥐어짜봤니 송태웅 by
[232] 성능어디까지쥐어짜봤니 송태웅[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅NAVER D2
18.2K views140 slides
MySQL Deep dive with FusionIO by
MySQL Deep dive with FusionIOMySQL Deep dive with FusionIO
MySQL Deep dive with FusionIOI Goo Lee
904 views29 slides
OPENMARU APM 브로셔 by
OPENMARU APM 브로셔OPENMARU APM 브로셔
OPENMARU APM 브로셔Opennaru, inc.
10.3K views8 slides
Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017 by
Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017
Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017Amazon Web Services Korea
3.3K views64 slides
steeleye Replication by
steeleye Replication steeleye Replication
steeleye Replication 시온시큐리티
1.5K views27 slides

Similar to [Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱(20)

[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화 by NAVER D2
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
[231]운영체제 수준에서의 데이터베이스 성능 분석과 최적화
NAVER D26.6K views
[232] 성능어디까지쥐어짜봤니 송태웅 by NAVER D2
[232] 성능어디까지쥐어짜봤니 송태웅[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅
NAVER D218.2K views
MySQL Deep dive with FusionIO by I Goo Lee
MySQL Deep dive with FusionIOMySQL Deep dive with FusionIO
MySQL Deep dive with FusionIO
I Goo Lee904 views
Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017 by Amazon Web Services Korea
Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017
Amazon Aurora 성능 향상 및 마이그레이션 모범 사례 - AWS Summit Seoul 2017
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트) by Amazon Web Services Korea
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
AWS CLOUD 2018- Amazon Aurora  신규 서비스 알아보기 (최유정 솔루션즈 아키텍트)
지금 핫한 Real-time In-memory Stream Processing 이야기 by Ted Won
지금 핫한 Real-time In-memory Stream Processing 이야기지금 핫한 Real-time In-memory Stream Processing 이야기
지금 핫한 Real-time In-memory Stream Processing 이야기
Ted Won20.6K views
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트) by Amazon Web Services Korea
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
AWS 6월 웨비나 | AWS에서 MS SQL 서버 운영하기 (김민성 솔루션즈아키텍트)
IBM Storage for AI - NVMe & Spectrum Scale 기술을 탑재한 ESS3000 by Seoro Kim
IBM Storage for AI - NVMe & Spectrum Scale 기술을 탑재한 ESS3000IBM Storage for AI - NVMe & Spectrum Scale 기술을 탑재한 ESS3000
IBM Storage for AI - NVMe & Spectrum Scale 기술을 탑재한 ESS3000
Seoro Kim343 views
AWS 스토리지 서비스 소개 및 실습 - 김용기, AWS 솔루션즈 아키텍트 by Amazon Web Services Korea
AWS 스토리지 서비스 소개 및 실습 - 김용기, AWS 솔루션즈 아키텍트AWS 스토리지 서비스 소개 및 실습 - 김용기, AWS 솔루션즈 아키텍트
AWS 스토리지 서비스 소개 및 실습 - 김용기, AWS 솔루션즈 아키텍트
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018 by Amazon Web Services Korea
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
Amazon Aurora 신규 서비스 알아보기::최유정::AWS Summit Seoul 2018
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트) by Amazon Web Services Korea
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
091106kofpublic 091108170852-phpapp02 (번역본) by Taegil Heo
091106kofpublic 091108170852-phpapp02 (번역본)091106kofpublic 091108170852-phpapp02 (번역본)
091106kofpublic 091108170852-phpapp02 (번역본)
Taegil Heo1.3K views
[찾아가는세미나] 클라우드 데이터 가상화솔루션 by 해은 최
[찾아가는세미나] 클라우드 데이터 가상화솔루션[찾아가는세미나] 클라우드 데이터 가상화솔루션
[찾아가는세미나] 클라우드 데이터 가상화솔루션
해은 최1.6K views
관계형 데이터베이스의 새로운 패러다임 Amazon Aurora :: 김상필 :: AWS Summit Seoul 2016 by Amazon Web Services Korea
관계형 데이터베이스의 새로운 패러다임 Amazon Aurora :: 김상필 :: AWS Summit Seoul 2016관계형 데이터베이스의 새로운 패러다임 Amazon Aurora :: 김상필 :: AWS Summit Seoul 2016
관계형 데이터베이스의 새로운 패러다임 Amazon Aurora :: 김상필 :: AWS Summit Seoul 2016
Introduction to Apache Tajo by Gruter
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache Tajo
Gruter3.5K views
Zadara Storage As-a-Service, 스토리지 전문 서비스 활용 전략 - AWS Summit Seoul 2017 by Amazon Web Services Korea
Zadara Storage As-a-Service, 스토리지 전문 서비스 활용 전략 - AWS Summit Seoul 2017Zadara Storage As-a-Service, 스토리지 전문 서비스 활용 전략 - AWS Summit Seoul 2017
Zadara Storage As-a-Service, 스토리지 전문 서비스 활용 전략 - AWS Summit Seoul 2017
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법 by Ji-Woong Choi
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
Ji-Woong Choi12.4K views

More from PgDay.Seoul

[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기 by
[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기
[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기PgDay.Seoul
498 views17 slides
[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기 by
[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기
[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기PgDay.Seoul
940 views40 slides
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스 by
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스PgDay.Seoul
1.5K views29 slides
[Pgday.Seoul 2019] Advanced FDW by
[Pgday.Seoul 2019] Advanced FDW[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDWPgDay.Seoul
412 views30 slides
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개 by
[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개PgDay.Seoul
3K views13 slides
[Pgday.Seoul 2018] PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha by
[Pgday.Seoul 2018]  PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha[Pgday.Seoul 2018]  PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha
[Pgday.Seoul 2018] PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposhaPgDay.Seoul
1.1K views37 slides

More from PgDay.Seoul(19)

[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기 by PgDay.Seoul
[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기
[Pgday.Seoul 2020] 포스트그레스큐엘 자국어화 이야기
PgDay.Seoul498 views
[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기 by PgDay.Seoul
[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기
[Pgday.Seoul 2019] AppOS 고성능 I/O 확장 모듈로 성능 10배 향상시키기
PgDay.Seoul940 views
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스 by PgDay.Seoul
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
PgDay.Seoul1.5K views
[Pgday.Seoul 2019] Advanced FDW by PgDay.Seoul
[Pgday.Seoul 2019] Advanced FDW[Pgday.Seoul 2019] Advanced FDW
[Pgday.Seoul 2019] Advanced FDW
PgDay.Seoul412 views
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개 by PgDay.Seoul
[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개
PgDay.Seoul3K views
[Pgday.Seoul 2018] PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha by PgDay.Seoul
[Pgday.Seoul 2018]  PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha[Pgday.Seoul 2018]  PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha
[Pgday.Seoul 2018] PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha
PgDay.Seoul1.1K views
[Pgday.Seoul 2018] PostgreSQL Authentication with FreeIPA by PgDay.Seoul
[Pgday.Seoul 2018]  PostgreSQL Authentication with FreeIPA[Pgday.Seoul 2018]  PostgreSQL Authentication with FreeIPA
[Pgday.Seoul 2018] PostgreSQL Authentication with FreeIPA
PgDay.Seoul786 views
[Pgday.Seoul 2018] AWS Cloud 환경에서 PostgreSQL 구축하기 by PgDay.Seoul
[Pgday.Seoul 2018]  AWS Cloud 환경에서 PostgreSQL 구축하기[Pgday.Seoul 2018]  AWS Cloud 환경에서 PostgreSQL 구축하기
[Pgday.Seoul 2018] AWS Cloud 환경에서 PostgreSQL 구축하기
PgDay.Seoul1.2K views
[Pgday.Seoul 2018] Greenplum의 노드 분산 설계 by PgDay.Seoul
[Pgday.Seoul 2018]  Greenplum의 노드 분산 설계[Pgday.Seoul 2018]  Greenplum의 노드 분산 설계
[Pgday.Seoul 2018] Greenplum의 노드 분산 설계
PgDay.Seoul1.6K views
[Pgday.Seoul 2018] replacing oracle with edb postgres by PgDay.Seoul
[Pgday.Seoul 2018] replacing oracle with edb postgres[Pgday.Seoul 2018] replacing oracle with edb postgres
[Pgday.Seoul 2018] replacing oracle with edb postgres
PgDay.Seoul606 views
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우 by PgDay.Seoul
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
PgDay.Seoul4.5K views
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종 by PgDay.Seoul
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
[Pgday.Seoul 2017] 5. 테드폴허브(올챙이) PostgreSQL 확장하기 - 조현종
PgDay.Seoul435 views
[Pgday.Seoul 2017] 1. PostGIS의 사례로 본 PostgreSQL 확장 - 장병진 by PgDay.Seoul
[Pgday.Seoul 2017] 1. PostGIS의 사례로 본 PostgreSQL 확장 - 장병진[Pgday.Seoul 2017] 1. PostGIS의 사례로 본 PostgreSQL 확장 - 장병진
[Pgday.Seoul 2017] 1. PostGIS의 사례로 본 PostgreSQL 확장 - 장병진
PgDay.Seoul2.4K views
[Pgday.Seoul 2017] 4. Composite Type/JSON 파라미터를 활용한 TVP구현(with C#, JAVA) - 지현명 by PgDay.Seoul
[Pgday.Seoul 2017] 4. Composite Type/JSON 파라미터를 활용한 TVP구현(with C#, JAVA) - 지현명[Pgday.Seoul 2017] 4. Composite Type/JSON 파라미터를 활용한 TVP구현(with C#, JAVA) - 지현명
[Pgday.Seoul 2017] 4. Composite Type/JSON 파라미터를 활용한 TVP구현(with C#, JAVA) - 지현명
PgDay.Seoul573 views
[Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기 by PgDay.Seoul
[Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기[Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기
[Pgday.Seoul 2017] 8. PostgreSQL 10 새기능 소개 - 김상기
PgDay.Seoul3.1K views
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오 by PgDay.Seoul
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
PgDay.Seoul1.4K views
PostgreSQL 9.6 새 기능 소개 by PgDay.Seoul
PostgreSQL 9.6 새 기능 소개PostgreSQL 9.6 새 기능 소개
PostgreSQL 9.6 새 기능 소개
PgDay.Seoul3.2K views
pg_hba.conf 이야기 by PgDay.Seoul
pg_hba.conf 이야기pg_hba.conf 이야기
pg_hba.conf 이야기
PgDay.Seoul831 views
Pg report 20161010_02 by PgDay.Seoul
Pg report 20161010_02Pg report 20161010_02
Pg report 20161010_02
PgDay.Seoul342 views

[Pgday.Seoul 2017] 2. PostgreSQL을 위한 리눅스 커널 최적화 - 김상욱

  • 1. PostgreSQL을 위한 리눅스 커널 최적화 김상욱 PgDay.Seoul 2017
  • 2. 2 김상욱 • Co-founder and CEO @ Apposha • 성균관대 컴퓨터공학 박사과정 • 4편의 SCI 저널 저술, 6편의 국제학술대회 논문 발표 • 클라우드/가상화 분야 • 멀티코어 스케줄링 [ASPLOS’13, VEE’14] • 그룹 기반 메모리 관리 [JPDC’14] • 데이터베이스/저장장치 분야 • 비휘발성 캐시 관리 [USENIX ATC’15, ApSys’16] • 리퀘스트 중심 I/O 우선 처리 [FAST’17, HotStorage’17]
  • 3. Apposha? 3 완전 관리형 서비스 MySQL 대비 5배 성능 상용 제품 대비 1/10 비용 for
  • 4. Contents • PostgreSQL 성능 관점에서의 리눅스 커널 최적화 • 백그라운드 작업 영향 최소화 • Full page writes 제거 • Parallel query 처리 최적화 4
  • 5. Contents • PostgreSQL 성능 관점에서의 리눅스 커널 최적화 • 백그라운드 작업 영향 최소화 • Full page writes 제거 • Parallel query 처리 최적화 5
  • 6. PostgreSQL 구조 6 * 내부 프로세스 종류 - Backend (foreground) - Checkpointer - Autovacuum workers - WAL writer - Writer - … Storage Device Linux Kernel P1 클라이언트 P2 I/O P3 P4 요청 응답 I/O I/O I/O PostgreSQL DB 성능
  • 7. PostgreSQL 구조 7 * 내부 프로세스 종류 - Backend (foreground) - Checkpointer - Autovacuum workers - WAL writer - Writer - … Storage Device Linux Kernel P1 클라이언트 P2 I/O P3 P4 요청 응답 I/O I/O I/O PostgreSQL
  • 9. PostgreSQL Autovacuum 9 Free Space Map http://bstar36.tistory.com/308
  • 10. 백그라운드 태스크 영향 10 • Dell Poweredge R730 • 32 cores • 132GB DRAM • 1 SAS SSD • PostgreSQL v9.5.6 • 52GB shared_buf • 10GB max_wal • TPC-C workload • 50GB dataset • 1 hour run • 50 clients 0 200 400 600 800 1000 1200 0 500 1000 1500 2000 2500 3000 최대응답지연(ms) 경과시간 (초) Default 최대 1.1초
  • 11. 백그라운드 태스크 영향 11 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1 50 100 150 200 250 300 처리량(trx/sec) 클라이언트 수 Default Aggressive AV 처리량 40% autovacuum_max_workers 3 => 6 autovacuum_naptime 1min => 15s autovacuum_vacuum_threshold 50 => 25 autovacuum_analyze_threshold 50 => 10 autovacuum_vacuum_scale_factor 0.2 => 0.1 autovacuum_analyze_scale_factor 0.1 => 0.05 autovacuum_vacuum_cost_delay 20ms => -1 autovacuum_vacuum_cost_limit -1 => 1000
  • 12. 백그라운드 태스크 영향 12 • Dell Poweredge R730 • 32 cores • 132GB DRAM • 1 SAS SSD • PostgreSQL v9.5.6 • 52GB shared_buf • 10GB max_wal • TPC-C workload • 50GB dataset • 1 hour run • 50 clients 0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500 3000 최대응답지연(ms) 경과시간 (초) Default Aggressive AV 최대 2.5초
  • 13. I/O 우선순위 적용의 어려움 • 각 계층에서의 독립적인 I/O 처리 13 Storage Device Caching Layer Application File System Layer Block Layer Abstraction
  • 14. I/O 우선순위 적용의 어려움 • 각 계층에서의 독립적인 I/O 처리 14 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Buffer Cache read() write() admission control
  • 15. I/O 우선순위 적용의 어려움 • 각 계층에서의 독립적인 I/O 처리 15 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Buffer Cache read() write() Block-level Q admission control
  • 16. I/O 우선순위 적용의 어려움 • 각 계층에서의 독립적인 I/O 처리 16 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Buffer Cache read() write() Block-level Q reorder FG FG BGBG
  • 17. I/O 우선순위 적용의 어려움 • 각 계층에서의 독립적인 I/O 처리 17 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Buffer Cache read() write() Block-level Q reorder FG FG BGBG Device-internal Q admission control
  • 18. I/O 우선순위 적용의 어려움 • 각 계층에서의 독립적인 I/O 처리 18 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Buffer Cache read() write() Block-level Q reorder FG FG BGBG Device-internal QBG FG BGBG reorder
  • 19. I/O 우선순위 적용의 어려움 19 • I/O 우선순위 역전 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Locks Condition variables
  • 20. I/O 우선순위 적용의 어려움 20 • I/O 우선순위 역전 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Locks Condition variablesCondition variables I/OFG lock BG wait
  • 21. I/O 우선순위 적용의 어려움 21 • I/O 우선순위 역전 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Locks Condition variablesCondition variables I/OFG lock BG wait I/OFG lock BG wait FG wait wait BGvar wake
  • 22. I/O 우선순위 적용의 어려움 22 • I/O 우선순위 역전 Storage Device Caching Layer Application File System Layer Block Layer Abstraction Locks Condition variablesCondition variables I/OFG lock BG wait I/OFG lock BG wait FG wait wait BGvar wake I/O FG wait wait BGuser var wake FG wait
  • 23. 리퀘스트 중심 I/O 우선처리 • 솔루션 v1 (사후대책) • 전체 계층에서의 우선순위 적용 [FAST’17] • 동적 우선순위 상속 [USENIX ATC’15, FAST’17] 23 FG lock BG I/OFG BG submit complete FG BG FG wait BG register BG inherit FG BGI/O submit complete wake CV CV CV [USENIX ATC’15] Request-Oriented Durable Write Caching for Application Performance [FAST’17] Enlightening the I/O Path: A Holistic Approach for Application Performance
  • 24. 리퀘스트 중심 I/O 우선처리 • 솔루션 v1 (문제점) 24
  • 25. 리퀘스트 중심 I/O 우선처리 • 솔루션 v2 (사전예방) 25 Device Driver Noop CFQ Deadline Apposha I/O Scheduler Block Layer Ext4 XFS F2FS VFS Apposha Front-End File System Etc 리눅스 커널 I/O 스택 PageCache - 우선순위 기반 I/O 스케줄링 - 디바이스 큐 혼잡 제어 - 우선순위 기반 쓰기 I/O 제어 - OS 캐싱 효율성 향상
  • 26. 리퀘스트 중심 I/O 우선처리 26 Apposha 최적화 엔진 MongoDB Library PostgreSQL Library Elasticsearch Library V12-M V12-P V12-E - 태스크 중요도, 파일 접근 패턴 분류 Front-End File System I/O Scheduler • V12 성능 최적화 엔진
  • 27. 리퀘스트 중심 I/O 우선처리 27 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1 50 100 150 200 250 300 처리량(trx/sec) 클라이언트 수 Default Aggressive AV
  • 28. 리퀘스트 중심 I/O 우선처리 28 0 2000 4000 6000 8000 10000 12000 1 50 100 150 200 250 300 처리량(trx/sec) 클라이언트 수 Default Aggressive AV V12-P 처리량 71-86%
  • 29. 리퀘스트 중심 I/O 우선처리 29 0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500 3000 최대응답지연(ms) 경과시간 (초) Default Aggressive AV V12-P 최대 0.15초
  • 30. Contents • PostgreSQL 성능 관점에서의 리눅스 커널 최적화 • 백그라운드 작업 영향 최소화 • Full page writes 제거 • Parallel query 처리 최적화 30
  • 31. Full Page Writes 31 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 32. Full Page Writes 32 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 33. Full Page Writes 33 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 34. Full Page Writes 34 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 35. Full Page Writes 35 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 36. Full Page Writes 36 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 37. Full Page Writes 37 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 38. Full Page Writes 38 Tuning PostgreSQL for High Write Workloads – Grant McAlister
  • 39. Full Page Writes • WAL 크기 39 0 2 4 6 8 10 12 14 0 100 200 300 400 500 600 WAL크기(GB) 경과시간 (초) Default • PostgreSQL v9.6.5 • 52GB shared_buf • 1GB max_wal • TPC-C workload • 50GB dataset • 10 min run • 200 clients
  • 41. WAL Compression • WAL 크기 41 0 2 4 6 8 10 12 14 0 100 200 300 400 500 600 WAL크기(GB) 경과시간 (초) Default WAL compression
  • 42. WAL Compression • 성능 영향 42 0 2000 4000 6000 8000 10000 12000 처리량(trx/sec) Default WAL compression
  • 43. WAL Compression • CPU 사용률 43 0 10 20 30 40 50 60 70 80 90 100 0 100 200 300 400 500 600 CPU사용률(%) 경과시간 (초) Default WAL compression
  • 44. Atomic Write 지원 44 매핑 레이어 PostgreSQL Linux Kernel
  • 45. Atomic Write 지원 45 매핑 레이어 DB 파일 open() DB 쉐도우 파일 PostgreSQL Linux Kernel
  • 46. Atomic Write 지원 46 매핑 레이어 DB 파일 write() DB 쉐도우 파일 PostgreSQL Linux Kernel
  • 47. Atomic Write 지원 47 매핑 레이어 DB 파일 read() DB 쉐도우 파일 PostgreSQL Linux Kernel
  • 48. Atomic Write 지원 48 매핑 레이어 DB 파일 fsync() DB 쉐도우 파일 체크포인트 PostgreSQL Linux Kernel
  • 49. Atomic Write 지원 49 매핑 레이어 DB 파일 write() DB 쉐도우 파일
  • 50. Atomic Write 지원 50 매핑 레이어 DB 파일 write() DB 쉐도우 파일
  • 51. Atomic Write 지원 51 매핑 레이어 DB 파일 DB 쉐도우 파일 read()
  • 52. Atomic Write 지원 • WAL 크기 (max_wal_size=1GB) 52 0 2 4 6 8 10 12 14 0 100 200 300 400 500 600 WAL크기(GB) 경과시간 (초) Default WAL compression V12-P
  • 53. Atomic Write 지원 • 성능 영향 53 0 2000 4000 6000 8000 10000 12000 처리량(trx/sec) Default WAL compression V12-P 처리량 2X
  • 54. Atomic Write 지원 • CPU 사용률 54 0 10 20 30 40 50 60 70 80 90 100 0 100 200 300 400 500 600 CPU사용률(%) 경과시간 (초) Default WAL compression V12-P
  • 55. Contents • PostgreSQL 성능 관점에서의 리눅스 커널 최적화 • 백그라운드 작업 영향 최소화 • Full page writes 제거 • Parallel query 처리 최적화 55
  • 57. Parallel Query 57 느린 응답 빠른 응답 사용자 쿼리 백엔드 워커 cache storage cache storage cache storage cache storage hit hitmiss! 워커 워커 워커 miss!
  • 59. Parallel Query 처리 최적화 • 성능 영향 59 pgbench –i –s 1000 test1 pgbench –i –s 1000 test2 Q1: SELECT * FROM pgbench_accounts WHERE filler LIKE ‘%x% -d test1 Q2: SELECT * FROM pgbench_accounts WHERE filler LIKE ‘%x% -d test2 QUERY PLAN -------------------------------------------------------------------------------------- Gather (cost=1000.00..1818916.53 rows=1 width=97) Workers Planned: 7 -> Parallel Seq Scan on pgbench_accounts (cost=0.00..1817916.43 rows=1 width=97) Filter: (filler ~~ '%x%'::text)
  • 60. Parallel Query 처리 최적화 • 성능 영향 60 0 5 10 15 20 25 30 35 40 Solo Deadline Noop CFQ Task-aware 응답시간(초) Q1 Q2
  • 61. Parallel Query 처리 최적화 • 성능 영향 (디바이스 큐 off) 61 0 20 40 60 80 100 Solo Deadline Noop CFQ Task-aware 응답시간(초) Q1 Q2 평균 응답 30% 향상