Skip to content

Leeinsu1/DBMS_ON_SSD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ํ”„๋กœ์ ํŠธ๋ช…

๋ณธ ํ”„๋กœ์ ํŠธ๋Š” ํ”Œ๋ž˜์‹œ ๋ฉ”๋ชจ๋ฆฌ ์ƒ์—์„œ์˜ ํŒŒ์ผ ์‹œ์Šคํ…œ์— ๋”ฐ๋ฅธ DBMS ์„ฑ๋Šฅ์„ ์‹คํ—˜ํ•œ๋‹ค. ๋˜ํ•œ, discard ๋ช…๋ น์ด ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ์„ฑ๋Šฅ์— ๋ผ์น˜๋Š” ์˜ํ–ฅ์„ ์—ฐ๊ตฌํ•œ๋‹ค.

ํ”Œ๋ž˜์‹œ ๋ฉ”๋ชจ๋ฆฌ์—์„œ FFS(Ext4, XFS)์™€ LFS(F2FS)์˜ ์‚ฌ์šฉ์— ๋”ฐ๋ฅธ DBMS(MySQL/RocksDB) OLTP(๋ฒค์น˜๋งˆํฌ ํˆด: TPC-C, YCSB) ์„ฑ๋Šฅ์„ ๋น„๊ตํ•œ๋‹ค.

๋ฐฐ๊ฒฝ ์ง€์‹

ํ”Œ๋ž˜์‹œ ๋ฉ”๋ชจ๋ฆฌ

ํ”Œ๋ž˜์‹œ ๋ฉ”๋ชจ๋ฆฌ๋Š” Block๋“ค๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ, Block์€ ๋‹ค์‹œ Page๋“ค๋กœ ๊ตฌ์„ฑ๋œ๋‹ค. ํ”Œ๋ž˜์‹œ ๋ฉ”๋ชจ๋ฆฌ์—์„œ์˜ ์ฝ๊ธฐ(Read)์™€ ์“ฐ๊ธฐ(Write)๋Š” Page ๋‹จ์œ„๋กœ ์‹คํ–‰๋œ๋‹ค. ๋˜ํ•œ, ํ”Œ๋ž˜์‹œ ๋ฉ”๋ชจ๋ฆฌ์˜ Page๋Š” ๋ฎ์–ด์“ฐ๊ธฐ๊ฐ€ ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค. ๋”ฐ๋ผ์„œ ํ•œ๋ฒˆ 'stale' ์ƒํƒœ๊ฐ€ ๋œ Page๋Š” ๋ฐ˜๋“œ์‹œ ์‚ญ์ œ(Erase)๋ฅผ ๊ฑฐ์ณ 'free' ์ƒํƒœ๋กœ ์ „์ด๋œ ํ›„ ๋‹ค์‹œ ์“ฐ๊ธฐ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์‚ญ์ œ๋Š” ๋‹จ์ผ Page๊ฐ€ ์•„๋‹Œ, Block ๋‹จ์œ„์˜ ์‚ญ์ œ๋งŒ ๊ฐ€๋Šฅํ•˜๋‹ค. ์‚ญ์ œ ๋ช…๋ น์€ SSD๊ฐ€ 'free' ๊ณต๊ฐ„์ด ํ•„์š”ํ•  ๋•Œ Garbage-Collection์„ ์‹คํ–‰ํ•  ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค.

์ฆ‰, Page ๋‹จ์œ„์˜ ์ฝ๊ธฐ/์“ฐ๊ธฐ์™€ ๋‹ค๋ฅด๊ฒŒ Block ๋‹จ์œ„์˜ ์‚ญ์ œ๊ฐ€ ์ผ์–ด๋‚จ์œผ๋กœ์จ ์‚ญ์ œ ๋Œ€์ƒ Block์˜ ์œ ํšจํ•œ Page๋ฅผ ๋‹ค๋ฅธ Block์œผ๋กœ ๋ณต์‚ฌํ•  ํ•„์š”๊ฐ€ ์žˆ๋Š”๋ฐ, ์ด๋ฅผ '์นดํ”ผ๋ฐฑ'(Copy-Back)์ด๋ผ ํ•œ๋‹ค. ์ด๋Ÿฌํ•œ ์นดํ”ผ๋ฐฑ์œผ๋กœ ์ธํ•ด '์“ฐ๊ธฐ ์ฆํญ' (Write-Amplification) ํ˜„์ƒ์ด ๋ฐœ์ƒํ•œ๋‹ค. ์“ฐ๊ธฐ ์ฆํญ ์ •๋„(Write-Amplification Factor, WAF)๋Š” SSD์˜ ์„ฑ๋Šฅ์— ํฐ ์˜ํ–ฅ์„ ๋ผ์นœ๋‹ค. ๋˜ํ•œ SSD๋Š” FTL(Flash Translation Layer)๋ฅผ ํ†ตํ•ด HDD์™€ ๋™์ผํ•œ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•œ๋‹ค.

(์ฐธ์กฐ: https://tech.kakao.com/2016/07/15/coding-for-ssd-part-3/)

MySQL

MySQL์€ ๊ฐ€์žฅ ๋งŽ์ด ์“ฐ์ด๋Š” ์˜คํ”ˆ ์†Œ์Šค RDBMS์ด๋‹ค. MySQL์„œ๋ฒ„๋Š” ํฌ๊ฒŒ MySQL ์—”์ง„๊ณผ ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์œผ๋กœ ๋‚˜๋ˆ„์–ด์ง€๋Š”๋ฐ, MySQL ์—”์ง„์€ SQL ๋ฌธ์žฅ์„ ๋ถ„์„, ์ตœ์ ํ™”๋“ฑ ํด๋ผ์ด์–ธํŠธ๋กœ๋ถ€ํ„ฐ ์˜ค๋Š” ์š”์ฒญ์„ ์ฒ˜๋ฆฌํ•˜๊ณ , ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์€ ์‹ค์ œ ๋ฐ์ดํ„ฐ๋ฅผ ๋””์Šคํฌ ์Šคํ† ๋ฆฌ์ง€์— ์ €์žฅํ•˜๊ฑฐ๋‚˜ ์กฐํšŒํ•œ๋‹ค. MySQL์— ๋‹ค์–‘ํ•œ ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์„ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ ๊ทธ ์ค‘์—์„œ B+ Tree๊ธฐ๋ฐ˜์˜ InnoDB ์Šคํ† ๋ฆฌ์ง€ ์—”์ง„์ด ๊ฐ€์žฅ ๋„๋ฆฌ ์“ฐ์ธ๋‹ค. InnoDB๋Š” ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ๊ณผ ๋””์Šคํฌ ์˜์—ญ์œผ๋กœ ๋‚˜๋ˆ„์–ด ์ง„๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ DB๋ฅผ ๋ณ€๊ฒฝํ•œ๋‹ค๋ฉด in-place-update๋ฐฉ์‹์œผ๋กœ ๋””์Šคํฌ ์˜์—ญ์— ๋ฐ์ดํ„ฐ๊ฐ€ ์“ฐ์ธ๋‹ค.

Reference: https://jeong-pro.tistory.com/239

TPC-C

TPC๋ž€ Transaction Processing Performance Council ์—์„œ ๋ฐœํ‘œํ•œ ๋ฒค์น˜๋งˆํฌ ๋ชจ๋ธ๋“ค์ด๋‹ค. TCP๋Š” OLTP ์‹œ์Šคํ…œ์˜ ์ฒ˜๋ฆฌ ์„ฑ๋Šฅ์„ ํ‰๊ฐ€ํ•˜๋Š” ๊ธฐ์ค€์ด ๋œ๋‹ค. ๊ทธ ์ค‘ TPC-C๋Š” TPC-A ๋ชจ๋ธ์ด๋‚˜ TPC-B ๋ชจ๋ธ๋ณด๋‹ค ๋ณต์žกํ•œ ์œ ํ†ต์—…์˜ ์ˆ˜์ฃผยท๋ฐœ์ฃผ OLTP ์„ฑ๋Šฅ ํ‰๊ฐ€๋ฅผ ์œ„ํ•œ ๋ฒค์น˜๋งˆํฌ ๋ชจ๋ธ์ด๋‹ค.

RocksDB

RocksDB๋Š” SSD์— ์ตœ์ ํ™”๋œ Key-Value ํ˜•ํƒœ์˜ ๋กœ๊ทธ ๊ตฌ์กฐ ๋ฐ ์ดํ„ฐ๋ฒ ์ด์Šค ์—”์ง„์ด๋‹ค. RocksDB์˜ ๋ฐ์ดํ„ฐ ์ €์žฅ ๊ตฌ์กฐ๋Š” Log-Structured Merge Tree(LSM-tree)๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ๋‹ค. RocksDB๋Š” ์“ฐ๊ธฐ ์š”์ฒญ ์‹œ ๋ฉ”๋ชจ๋ฆฌ์˜ Active Memtable์ด๋ž€ ์ด๋ฆ„์˜ ์ž„์‹œ ๋ฒ„ํผ์— ๋ฐ์ดํ„ฐ๋ฅผ ์“ด๋‹ค. ํ•ด๋‹น Memtable์ด ์ผ์ • ํฌ๊ธฐ๊ฐ€ ๋˜๋ฉด ์ฝ๊ธฐ ์ „์šฉ Memtable์ด ๋˜๊ณ , ์ผ์ • ๊ฐœ์ˆ˜ ์ด์ƒ์˜ Memtable์ด ๋ชจ์ด๋ฉด ์ €์žฅ ์žฅ์น˜์— ๋‚ด๋ ค๊ฐ€(flush) SST ํŒŒ์ผ ํ˜•ํƒœ๋กœ ์ €์žฅ๋œ๋‹ค. ๋”ฐ๋ผ์„œ RocksDB๋Š” SST ํŒŒ์ผ ๋‹จ์œ„๋กœ(๊ธฐ๋ณธ 64MB) I/O๋ฅผ ์ง„ํ–‰ํ•˜๊ณ , ๋ฐ์ดํ„ฐ๋ฅผ append-only ๋กœ๊ทธ์— ์ €์žฅํ•จ์œผ๋กœ์จ ์ˆœ์ฐจ ์“ฐ๊ธฐ๋ฅผ ๋ณด์žฅํ•œ๋‹ค.

YCSB

YCSB(Yahoo! Cloud Serving Benchmark)๋Š” ํด๋ผ์šฐ๋“œ ์„œ๋น„์Šค์™€ NoSQL์˜ ์„ฑ๋Šฅ์„ ์ธก์ •ํ•˜๊ธฐ์œ„ํ•œ ๋ฒค์น˜๋งˆํฌ ํˆด์ด๋‹ค. YCSB๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ์ œ๊ณตํ•˜๋Š” ๋‹ค๋ฅธ ์ž‘๋™๋ฐฉ์‹์„ ๊ฐ€์ง„ workload๋“ค์ด ์žˆ๋‹ค. ๋˜ ์‚ฌ์šฉ์ž๊ฐ€ ์ด๋ฅผ ์ˆ˜์ •ํ•˜๊ฑฐ๋‚˜ ์ง์ ‘ ๋งŒ๋“ค์–ด ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

ํŒŒ์ผ ์‹œ์Šคํ…œ

  • FFS: Fast File System. ํ•˜๋“œ๋””์Šคํฌ์˜ ์‹ค๋ฆฐ๋” ๊ฐœ๋…์„ ํ™œ์šฉํ•˜์—ฌ ์‹ค๋ฆฐ๋” ๊ทธ๋ฃน (๋ธ”๋ก ๊ทธ๋ฃน)์œผ๋กœ ๋‚˜๋ˆ„์–ด ํŒŒ์ผ์„ ์ €์žฅํ•œ๋‹ค. In-Place update ์ •์ฑ…์„ ์‚ฌ์šฉํ•œ๋‹ค. ๋Œ€ํ‘œ์ ์ธ FFS๋กœ Ext4์™€ XFS๊ฐ€ ์žˆ๋‹ค.
  • LFS: Log-Structured File System. In-Place update๊ฐ€ ์•„๋‹Œ, ๋กœ๊ทธ ๊ตฌ์กฐ๋กœ ํŒŒ์ผ์„ ์ €์žฅํ•œ๋‹ค. ๋”ฐ๋ผ์„œ Garbage-Collection์ด ์š”๊ตฌ๋˜๋ฉฐ, ์ด๋กœ ์ธํ•ด Logical WAF๊ฐ€ ๋†’๋‹ค. ๋Œ€ํ‘œ์ ์ธ LFS๋กœ F2FS๊ฐ€ ์žˆ๋‹ค.

์„ฑ๋Šฅ ์ธก์ • ์ง€ํ‘œ

  • Physical WAF: SSD ๊ณ„์ธต์—์„œ์˜ ์“ฐ๊ธฐ ์ฆํญ ์ •๋„. ์‹คํ—˜ ์‹œ๊ฐ„ ์ „์ฒด์˜ WAF์ธ Cumulative WAF์™€ ํŠน์ • ์‹œ๊ฐ„(eg.5๋ถ„) ๊ฐ„๊ฒฉ์˜ WAF์ธ Run WAF๊ฐ€ ์žˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ํ•ด๋‹น ์ˆ˜์น˜๊ฐ€ ๋†’์„์ˆ˜๋ก ์„ฑ๋Šฅ์˜ ์ €ํ•˜๊ฐ€ ์‹ฌํ•œ ๊ฒฝํ–ฅ์„ ๋ณด์ธ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ discard๊ฐ€ ๋„ˆ๋ฌด ์ž์ฃผ ์ผ์–ด๋‚˜๊ฒŒ ๋œ๋‹ค๋ฉด, WAF๊ฐ€ ๋‚ฎ์•„์ง€๋”๋ผ๋„ ์˜คํžˆ๋ ค discard์˜ ์˜ค๋ฒ„ํ—ค๋“œ๋กœ ์ธํ•ด ์„ฑ๋Šฅ ์ €ํ•˜๊ฐ€ ์ผ์–ด๋‚  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๋‹ค.
  • Logical WAF: ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ณ„์ธต์—์„œ์˜ ์“ฐ๊ธฐ ์ฆํญ ์ •๋„. ์ผ๋ฐ˜์ ์œผ๋กœ LFS์—์„œ ์ธก์ •ํ•˜๋ฉฐ, ํ•ด๋‹น ์ˆ˜์น˜๊ฐ€ ๋†’์„์ˆ˜๋ก ์„ฑ๋Šฅ์˜ ์ €ํ•˜๊ฐ€ ์‹ฌํ•œ ๊ฒฝํ–ฅ์„ ๋ณด์ธ๋‹ค.
  • tpmC: TPC-C์—์„œ์˜ ์„ฑ๋Šฅ ์ง€ํ‘œ. ๋ถ„๋‹น ํŠธ๋žœ์žญ์…˜ ์ฒ˜๋ฆฌ๋Ÿ‰์„ ์˜๋ฏธํ•œ๋‹ค.
  • OPS: YCSB์—์„œ์˜ ์„ฑ๋Šฅ ์ง€ํ‘œ. ์ดˆ๋‹น operation ์ฒ˜๋ฆฌ๋Ÿ‰์„ ์˜๋ฏธํ•œ๋‹ค.
  • Undiscard: F2FS๊ฐ€ discard ๋ช…๋ น์„ ๋‚ด๋ ค์•ผ ํ•˜์ง€๋งŒ ์•„์ง ๋‚ด๋ฆฌ์ง€ ๋ชปํ•œ ํŽ˜์ด์ง€ ์ˆ˜. ํ•ด๋‹น ์ˆ˜์น˜๊ฐ€ ๋†’๊ฒŒ ์œ ์ง€๋˜๋ฉด ๋ถˆํ•„์š”ํ•œ ์นดํ”ผ๋ฐฑ์ด ๋งŽ์ด ๋ฐœ์ƒํ•ด ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ๋‹ค.

์‹คํ—˜ ํ™˜๊ฒฝ

Type Specification
OS Ubuntu 18.04.6 LTS
CPU Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz(total 96 core)
Memory 1.56TB
Kernel 5.4.0-84-generic
Data Device CT250 MX500 SSD

์‰˜ ์‚ฌ์šฉ๋ฒ•

์‹คํ—˜ ๋กœ๊ทธ ๊ธฐ๋ก ๋ฐ ๊ฒฐ๊ณผ ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ์„ ์œ„ํ•œ ์‰˜์˜ ์‚ฌ์šฉ๋ฒ•.

log_write.sh

์‰˜ ๋‚ด๋ถ€์˜ TEST_NAME ๋ณ€์ˆ˜๋ฅผ ํ˜„์žฌ ์‹คํ—˜๋ช…์œผ๋กœ ๋ฐ”๊พผ ํ›„ ์‹คํ–‰ํ•œ๋‹ค. ์‹คํ—˜(๋ฒค์น˜๋งˆํฌ)๋ฅผ ์‹คํ–‰ํ•จ๊ณผ ๋™์‹œ์— ํ•ด๋‹น ์‰˜๋„ ์‹คํ–‰ํ•œ๋‹ค.

./log_write.sh

waf_cal.sh

smartctl ๋กœ๊ทธ๋ฅผ ํ†ตํ•ด WAF ๊ณ„์‚ฐ์„ ํ•œ๋‹ค. 247ํ–‰๊ณผ 248ํ–‰, ์ฆ‰ LBA์™€ PBA ์ถ”์ถœ์„ ํ•˜์—ฌ ์ด์ „ Address์™€์˜ ์ฐจ์ด๋ฅผ ๊ณ„์‚ฐํ•˜์—ฌ logical, physical ์“ฐ๊ธฐ์˜ ์–‘์„ ๊ณ„์‚ฐํ•œ ํ›„ WAF๋ฅผ ๊ณ„์‚ฐํ•œ๋‹ค.

./waf_cal.sh ์‹คํ—˜๋ช…_smartctl.log

trace_plot.sh

blktrace์˜ ์ฝ๊ธฐ/์“ฐ๊ธฐ๋ฅผ ๊ทธ๋ž˜ํ”„๋กœ ๋งŒ๋“ ๋‹ค. read/write/read&write ์ด 3๊ฐœ์˜ ๊ทธ๋ž˜ํ”„๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค.

./trace_plot.sh ~/result/blktrace/์‹คํ—˜๋ช….btrace

graph.sh

์‹คํ—˜ ๊ฒฐ๊ณผ๋“ค์„ ๊ทธ๋ž˜ํ”„๋กœ ์ƒ์„ฑํ•ด์ค€๋‹ค. ํ•ด๋‹น ์‰˜์— ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ์‹คํ—˜ ๊ฒฐ๊ณผ๋Š”, ์ถ”๊ฐ€์ ์ธ ์ž‘์—…์ด ์š”๊ตฌ๋  ์ˆ˜ ์žˆ๋‹ค. (awk, grep ๋“ฑ์„ ์ด์šฉํ•œ ํŠน์ • ์ˆ˜์น˜ ์ถ”์ถœ ๋“ฑ) 3๊ฐœ์˜ ํŒŒ์ผ์‹œ์Šคํ…œ(Ext4,XFS,F2FS)๊ณผ ๊ฐ™์ด ์—ฌ๋Ÿฌ ์‹คํ—˜ ๊ฒฐ๊ณผ๋ฅผ ๋™์‹œ์— ๊ทธ๋ ค ๋น„๊ต๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

./graph.sh runwaf(ext4) runwaf(xfs) runwaf(f2fs)

rocks_strt.sh

RocksDB - YCSB๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ๊ฒฐ๊ณผ ํŒŒ์ผ์„ tee๋ฅผ ํ†ตํ•ด ์ €์žฅํ•œ๋‹ค. ์ง์ ‘ ์‹คํ–‰์ด ์•„๋‹Œ, rocks_idle.sh ๋‚ด๋ถ€์—์„œ ์‚ฌ์šฉ๋œ๋‹ค.

rocks_idle.sh

idle time์„ ์ฃผ๋Š” ์‹คํ—˜์„ ์œ„ํ•ด YCSB๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ์ฃผ๊ธฐ์ ์œผ๋กœ SIGSTOP์„ ํ†ตํ•ด ์ผ์‹œ์ •์ง€ ํ•œ๋‹ค. YCSB์˜ ๋ช‡๋ถ„ ์‹คํ–‰ ๋‹น ๋ช‡๋ถ„์˜ idle time์„ ์ค„์ง€ ์ฝ”๋“œ์˜ ์ˆ˜์ •์„ ํ†ตํ•ด ์„ค์ • ๊ฐ€๋Šฅํ•˜๋‹ค.

./rocks_idle.sh

๊ฒฐ๊ณผ ๋ถ„์„ ๋ฐฉ๋ฒ•

blktrace

blktrace ๊ฒฐ๊ณผ๋ฌผ์˜ ํŒŒ์‹ฑ์„ ํ†ตํ•ด btrace ํŒŒ์ผ์ด ์ƒ์„ฑ๋œ๋‹ค.
btrace
RWBS

  • R - Read
  • W - Write
  • S (RS,WS,FWFS,FWS) - ํŒŒ์ผ ์‹œ์Šคํ…œ์—์„œ Synchronous Operation์„ ๋œปํ•จ.
  • D - Discard

smartctl

smartctl์€ physical WAF ์ธก์ •์„ ์œ„ํ•ด ์‚ฌ์šฉ๋œ๋‹ค. 247ํ–‰๊ณผ 248ํ–‰์„ ํ†ตํ•ด WAF ๊ณ„์‚ฐ์ด ์ด๋ฃจ์–ด์ง€๋ฉฐ, 247์€ LBA, 248์€ SSD, ์ฆ‰ PBA๋ฅผ ๋œปํ•œ๋‹ค. smartctl_2

logwaf_streams

cat /proc/fs/f2fs/sdb1/iostat_info ํ†ตํ•ด ์ถ”์ถœํ•œ ๋กœ๊ทธ.
f2fslog

  • fs_data: SSD (block device, block layer)์— ์ „๋‹ฌํ•œ write bytes
  • TOTAL = fs_data + fs_node + fs_meta + fs_gc_data/node + fs_cp_data/node/meta
  • Logical(Filesystem) WAF = (fs_data) / TOTAL

logwaf__streams

cat /sys/kernel/debug/f2fs/status ํ†ตํ•ด ์ถ”์ถœํ•œ ๋กœ๊ทธ. undiscard ์ˆ˜์น˜๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
undiscard

SSD ์ดˆ๊ธฐํ™” ๋ฐ File System Mount

  1. Data directory ๋‚ด์šฉ ์‚ญ์ œ
rm -rf /path/to/datadir/*
  1. ๊ธฐ์กด SSD Unmount
sudo umount /dev/[PARTITION]
  1. SSD Blksidcard
sudo blkdiscard /dev/[DEVICE]
  1. ํŒŒํ‹ฐ์…˜ ์ƒ์„ฑ
sudo fdisk /dev/[DEVICE]
//command: n (new partition), w (write, save)
//Whole SSD in 1 partition
  1. File system ์ƒ์„ฑ
//F2FS
sudo mkfs.f2fs /dev/[PARTITION] -f

//Ext4
sudo mkfs.ext4 /dev/[PARTITION] -E discard,lazy_itable_init=0,lazy_journal_init=0 -F

//XFS
sudo mkfs.xfs /dev/[PARTITION] -f
  1. Data directory์— mount
//F2FS default
sudo mount /dev/[PARTITION] /path/to/datadir 

//F2FS lfs mode
sudo mount -o mode=lfs /dev/[PARTITION] /path/to/datadir 

///Ext4, XFS
sudo mount -o discard /dev/[PARTITION] /path/to/datadir 
  1. ๊ถŒํ•œ ์„ค์ •
sudo chown -R USER[:GROUP] /path/to/datadir 
sudo chmod -R 777 /path/to/datadir
  • F2FS์˜ ๊ฒฝ์šฐ File System Log๋ฅผ ์œ„ํ•ด ์ถ”๊ฐ€์ ์ธ ์ž‘์—…์„ ์ˆ˜ํ–‰ ํ•ด์•ผ ํ•จ.
sudo -E bash
echo 1 > /sys/fs/f2fs/[PARTITION]/iostat_enable
exit;

MySQL, TPC-C ์‹คํ—˜

  1. Install MySQL 5.7 and TPC-C
    Reference the installation guide to install and run TPC-C benchmark on MySQL 5.7

  2. my.cnf ์ˆ˜์ •

#
# The MySQL database server configuration file
#
[client]
user    = root
port    = 3306
socket  = /tmp/mysql.sock

[mysql]
prompt  = \u:\d>\_

[mysqld_safe]
socket  = /tmp/mysql.sock

[mysqld]
# Basic settings
default-storage-engine = innodb
pid-file        = /path/to/datadir/mysql.pid
socket          = /tmp/mysql.sock
port            = 3306
datadir         = /path/to/datadir/
log-error       = /path/to/datadir/mysql_error.log

#
# Innodb settings
#
# Page size
innodb_page_size=16KB

# Buffer pool settings

##### Change buffer pool size according to data size(5GB, 10GB, 15GB)
innodb_buffer_pool_size=5G
innodb_buffer_pool_instances=8

# Transaction log settings
innodb_log_file_size=100M
innodb_log_files_in_group=2
innodb_log_buffer_size=32M

# Log group path (iblog0, iblog1)
# If you separate the log device, uncomment and correct the path
#innodb_log_group_home_dir=/path/to/logdir/

# Flush settings (SSD-optimized)
# 0: every 1 seconds, 1: fsync on commits, 2: writes on commits
innodb_flush_log_at_trx_commit=0
innodb_flush_neighbors=0
# innodb_flush_method=O_DIRECT

##### F2FS lfs mode O_DIRECT error
innodb_flush_method=fsync
  1. ์žฌ์‹คํ—˜ ์‹œ data directory ๋ฐ MySQL ์ดˆ๊ธฐํ™”
//์„œ๋ฒ„ ์ข…๋ฃŒ
./bin/mysqladmin -uroot -p[yourPassword] shutdown

//SSD ์ดˆ๊ธฐํ™” ๋ฐ File System Mount
...
...
//

./bin/mysqld --initialize --user=mysql --datadir=/path/to/datadir --basedir=/path/to/basedir

./bin/mysqld_safe --skip-grant-tables --datadir=/path/to/datadir

./bin/mysql -uroot

root:(none)> use mysql;

root:mysql> update user set authentication_string=password('yourPassword') where user='root';
root:mysql> flush privileges;
root:mysql> quit;

./bin/mysql -uroot -p[yourPassword]

root:mysql> set password = password('yourPassword');
root:mysql> quit;

./bin/mysqladmin -uroot -pyourPassword shutdown
./bin/mysqld_safe --defaults-file=/path/to/my.cnf

./bin/mysql -u root -p[yourPassword] -e "CREATE DATABASE tpcc;"
./bin/mysql -u root -p[yourPassword] tpcc < /home/vldb/MySQL/tpcc-mysql/create_table.sql
./bin/mysql -u root -p[yourPassword] tpcc < /home/vldb/MySQL/tpcc-mysql/add_fkey_idx.sql
  1. TPC-C, ๋กœ๊ทธ ์‰˜ ์‹œ์ž‘
//๋‹ค์šด๋กœ๋“œ //๋‘๊ฐœ ์ปค๋งจ๋“œ ์ค‘ ํƒ 1
//Warehouse Number: 500, 1000, 1500
./tpcc_load -h 127.0.0.1 -d tpcc -u root -p "yourPassword" -w [Warehouse Number]
./load.sh tpcc [Warehouse Number]


//๋‹ค์šด๋กœ๋“œ ์™„๋ฃŒ ํ›„ // ps -ef | grep tpcc ๋กœ ๋‹ค์šด๋กœ๋“œ ์ข…๋ฃŒ ์—ฌ๋ถ€ ํ™•์ธ
./log_write.sh
./tpcc_start -h 127.0.0.1 -S /tmp/mysql.sock -d tpcc -u root -p "yourPassword" -w [Warehouse Number] -c 8 -r 10 -l [Run Time] | tee [Experiment Name].txt

RocksDB, YCSB ์‹คํ—˜

  1. Install RocksDB
  • Upgrade gcc version at least 4.8
  • gflags: sudo apt-get install libgflags-dev If this doesn't work, here's a nice tutorial: (http://askubuntu.com/questions/312173/installing-gflags-12-04)
  • snappy: sudo apt-get install libsnappy-dev
  • zlib: sudo apt-get install zlib1g-dev
  • bzip2: `sudo apt-get install libbz2-dev
git clone https://github.com/facebook/rocksdb
cd rocksdb
make
make check

Reference: https://github.com/meeeejin/SWE3033-F2021/blob/main/week-6/README.md

  1. Install YCSB
  • Java:
$ sudo apt-get install openjdk-8-jdk
$ javac -version
javac 1.8.0_292
$ which javac
/usr/bin/javac
$ readlink -f /usr/bin/javac
/usr/lib/jvm/java-8-openjdk-amd64
$ sudo vi /etc/profile
...
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
$ source /etc/profile
$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64 
  • Maven 3:
$ sudo apt-get install maven
  1. Clone the YCSB git repository:
$ git clone https://github.com/brianfrankcooper/YCSB
  1. Compile:
$ cd YCSB
$ mvn -pl site.ycsb:rocksdb-binding -am clean package

Reference: https://github.com/meeeejin/til/blob/master/benchmark/how-to-install-ycsb-for-rocksdb.md

  1. Workload ์ˆ˜์ •
# Yahoo! Cloud System Benchmark
# Workload A: Update heavy workload
#   Application example: Session store recording recent actions
#
#   Read/update ratio: 50/50
#   Default data size: 1 KB records (10 fields, 100 bytes each, plus key)
#   Request distribution: zipfian

# 1G : 0 6๊ฐœ
# 40000000 --> 44GB
# 85000000 --> 93GB
# 125000000 --> 137GB
recordcount=40000000
operationcount=2000000000
workload=site.ycsb.workloads.CoreWorkload
maxexecutiontime=7200

readallfields=true

readproportion=0.5
updateproportion=0.5
scanproportion=0
insertproportion=0

requestdistribution=zipfian
  1. YCSB ์‹คํ–‰
//Data Download
./bin/ycsb load rocksdb -s -P workloads/[yourWorkload] -threads 8 -p rocksdb.dir=/path/to/datadir

//๋‹ค์šด๋กœ๋“œ 
./log_write.sh
./bin/ycsb run rocksdb -s -P workloads/[yourWorkload] -threads 8 -p rocksdb.dir=/path/to/datadir 2>&1 | tee [Experiment Name].dat

ํ”„๋กœ์ ํŠธ ์ •๋ณด

ํ•™๋ฒˆ - ์ด๋ฆ„ - github์ฃผ์†Œ - ์ด๋ฉ”์ผ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages