Happy to visit my research note ^^

Storage Systems and Security (prof. ahn) 본문

System Storage & Security

Storage Systems and Security (prof. ahn)

Liam Lim 2023. 4. 29. 01:09
728x90

 


Chap 1


 

 

 

  Our need for timely data analysis in increasing

1. Microsecond/millisecond analysis

2. Gigabytes, terabytes, petabytes per query

3. Scalability, distributed systems

4. Energy and efficiency needs

at the end of the day, how fast can you read and write your data from storage device ㅡ> this is what we will be studing

 

The triangle of storage hierarchy

 

  if far from the CPU, latency and throughput get worse but capacity will be bigger.

 

about hard disk drive

 

  1956년 IBM에서 개발한 hard disk drive(HDD)는 ferromagnetic material을 사용해서 bits를 저장하였다. 하나의 platter안에는 여러 track이 원형으로 이루어져있고, 하나의 track에는 또 여러 sector(512 bytes)로 정렬되어 있다. disk head가 회전 중인 platter의 track에서 움직이면서 sector에 접근해서 data를 read/write (대략 7-15K RPM으로)하게 된다. 그리고 이론적으로 sector에 read/write을 할 수 있는 횟수에 대해서는 infinite durability를 가진다. 이 기술은 HDD에서 persistency store data를 위한 주 기술이다.

 

HDD disk I/O basics

 

  Transfer time(데이터를 read/write 하는 데 걸리는 시간)은 rotation(disk가 회전하면서 sector가 disk head아래로 이동하는 데 걸리는 시간), seek(탐색 시간), read/write time(read/write하는 데 걸리는 시간)을 다 더한 합으로 구할 수 있다. 회전을 하면서 data를 read/write 하기 때문에 sequential I/O와 adjacent I/O가 빠르고, latency는 milliseconds 정도, bandwidth는 sequential 할때 100 MB/sec 정도이다.

  1. I/O는 sector granularity로 발생한다.

  2. Read/Write는 symmetric하다. 

  3. Random performance (both read/write)는 sequential보다 안좋다.

  4. HDD에는 transfer time에 rotational time과 seek time이 추가되기 때문에 small I/O에 대한 performance가 안좋다.

  5. Outer tracking performance와 Inner tracking performance가 다르다. ( 원심력과 관련이 있는데 outer tracking performance가 더 빠른 속도로 회전하기 때문에 performance 면에서 더 빠르다.)

  6. if disregarding heating, damage on disk, demagnetization, (theoreticall) infinite durability를 갖는다. -> magnetic field can be held indefinitely

 

linux 상에서 HDD에 대한 정보를 찾아볼 수 있다.

 

 

over the years, HDD performance is improved

 

  but ,,, HDD만으로 system storage를 building하기에는 limitations가 있었다.

 

  1. Latency limits: 10s thousands/sec 이상 회전시킬 수 없다. physical limitation을 해결하기 위해 DRAM caching, prefetching techniques를 이용하면 HDD에서 data를 access하는 것보다 훨씬 빠르기 때문에, 자주 사용되는 data를 DRAM에 caching하거나 data를 prefetching해서 performance improvement를 노릴 수 있다.

  2. Random performance limitation: HDDs는 필요한 sector로 read/write tasks를 실행하기 위해 물리적으로 read/write head를 이동해야한다. 이를 위해서는 platter의 회전을 기다려야해서 random I/O performance가 매우 안좋다. for fix this bottleneck, buffering operation을 수행하고 여러 작은 I/O request를 하나의 큰 request로 결합해서 rotational and seek latency를 분산시킬 수 있다.

 

  이러한 노력에서도, 근본적으로 HDD는 physical limitation 때문에 일부 성능 제한이 존재한다. read/write head를 물리적으로 이동시켜야 하고, disk의 회전 속도의 한계로 인해서 접근 대기 시간이 높다.

 

(% 참고)USB Drive (what is inside a USB drive)

  이 부분을 잠시 집고 넘어가자면, USB drive 내부에는 flash memory chip, controller, oscillator, crystal and capacitor가 있다. flash memory는 data store를 위한 main component이고, controller는 memory와 상호 작용하면서 drive를 제어한다. oscillator는 drive 내부에서 발생하는 전기 신호의 정확한 타이밍을 유지하는 데 사용되고, crystal은 oscillator를 안정화하는 데 사용된다. capacitor는 전원 공급이 일시적으로 중단되었을 때에도 데이터가 유지되도록 보호하는 데 사용된다.

 

 

 


Non-Volatile Memory (NVM) Technology


 

 

 

 

  NVM (Non-Volatile Memory) 기술은 many of related techs(Solid-State Drive, Storage-class memory)를 포괄하는 용어이다. 이 기술의 전반적인 아이디어는 물리적인 특성을 이용해서 bit와 data를 저장하는 것이다. 이를 위해서, 다양한 물리적 특성을 사용하는 데:

  1. Magnetic state

  2. Electrical charge

  3. Crystalline / amorphous state

  4. Resistance

  5. Optical

  => In particular !! No moving parts compared to the Hard Disk Drive

 

 


Caution / Confusion


 

 

  본인이 이 분야를 처음 공부할 때, 종종 memory와 storage가 섞여 사용되면 의미에 혼란을 주는 경우를 경험했던 적이 있었다. 그에 따라, 간단히 설명하자면, 일부 기술에서는 이름에 memory라는 키워드가 포함되어 있을 수 있다. 이러한 기술은 RAM을 만드는 데 사용할 수 있지만 will be slow and not efficient 하다. Operating System과 함께 사용돼서 어떻게 # packing되고 사용되는지에 따라 1. 직접적으로 CPU에서 주소 지정될 수 있는 것은 memory, 2. DRAM에 block data transfer가 통합된 것은 storage이다.

  즉, OS에서는 computer의 memory를 두 가지로 나눠서 관리한다. 첫 번째로, OS는 CPU가 직접적으로 주소를 지정해서 접근할 수 있는 memory space를 관리한다. 이를 physical memory or system memory라고 한다. 두 번째로, OS는 storage media(HDD, SSD, etc.)와 같은 non-volatile memory를 관리한다. 이런 memory는 CPU가 직접적으로 접근할 수 없고, storage media를 통해 block data transfer 방식으로 data를 주고 받는다. 이를 storage라고 한다.

  따라서, storage는 OS에서 관리하는 storage media의 개념이고, physical memory는 CPU에서 직접적으로 accessable한 memory space의 개념이다. 이 두 가지 memory space는 서로 다르게 관리되며, CPU는 각각의 memory space에 대해 접근 권한을 다르게 가지고 있다.

 

 

 


Flash Memory


 

 

Flash Memory

 

  Flash Memory는 Toshiba에 의해 발명되었으며, mid of 1980s부터 상용화되었다. MOSFET tech로 부터 유래된 floating gate의 기본 개념을 사용한다. 처음에는 embedded device에서 사용됐지만, mid-2000s 이후에는 mainstream computing 분야에서도 사용을 시작했다. Today, the most popular tech to store data 중 하나로, data를 저장하고 관리하는 방식에서 매우 근본적인 변화를 가져왔다.

 

 

  Flash Storage는 data를 bit 단위로 저장한다. flash cell # transistor를 통해 전류가 흐르는 것을 조절하는 isolated floating gate가 있다. Electron이 FG(Floating Gate)에 갇혀서 threshold voltage을 준다. Gate에 알려진 reference voltage을 적용해서 FG에 전자가 갇혀 있는지 확인한다. pass through = 1, blocked 0 . So, single cell에서는 0 또는 1을 저장할 수 있다.

 

 

left = SLC, right = MLC

 

  Flash storage cell은 Single-Level(SLC), Multi-Level(MLC) or Triple-Level(TLC)일 수 있다.

  - SLC = 0, presence = 1 (2 values)

  - MLC = {00, 01, 10, 11} (4 values)

  - TLC = {000, 001 .... 111} (8 values)

  - QLC(현재 사용 가능), PLC(in development)

  SLC cells은 가장 높은 performance를 가지고 있다. TLC cells는 가장 높은 밀도와 더 나은 $/byte cost를 가지고 있다. FG는 지속적으로 re-programmed / erase(P/E)되어 isolated oxide layer가 부식되는 문제로 인해서 유한한 P/E life cycle을 가지고 있다.

 

 

 


NAND, NOR, and AND Flash cells


 

 

 

About NAND, NOR, and AND Flash cells

 

 

  NAND, NOR, 그리고 AND flash cell은 data를 저장하는 다양한 방법이 있고, density, addressability, read and write performance, number of connection, etc. 등의 적절한 trade-off를 선택해서 cell을 packing할 수 있다. 이들은 Flash memory의 다양한 형태 중 일부이다.

  - NAND cell은 high density를 가지고 있으며, addressability와 write performance는 낮지만, read performance는 높다.

  - NOR cell은 read and write performance가 좋지만 density가 낮다.

  - AND cell은 가장 단순한 형태이고, Read and write performance가 높지만 addressability and density가 낮다.

  이런 다양한 cell 형식은 각자 분야에 맞는 응용 분야에서 사용되고, 이를 통해 분야에 적합한 performance와 capacity를 챙길 수 있다.

 

NAND vs. NOR

 

  Historically, NAND와 NOR 중에 어떤 기술이 더 좋을 지에 대한 논쟁이 있었다. NOR Flash technique는 BIOS ROM과 같이 코드 실행용으로 사용된다. 그러나 NAND Flash technique은 high density로 packing되어있고 large-scale capacity 용도로 사용된다. 현대 storage의 용도로는, NAND Flash 기술이 대부분의 large-scale storage device에 사용되고 있다.

 

이제 그럼 drive의 내부에서는 data를 어떻게 arrange 하는 지에 살펴보겠다.

 

(₩중간 지식₩) drive 내부에는 여러 개의 Flash chip이 package 형태로 구성되어 있다. 즉, package는 flash chip을 여러 개 묶어서 한 개의 package로 만든 것이다. 이러한 package는 drive에 다시 묶여서 drive 내부의 일정 영역에 놓인다. 이런 구성으로, drive capacity는 flash chip의 개수와 각 chip의 용량에 따라 결정된다. flash memory를 사용하는 drive는 일반적으로 controller chip도 내장되어 있다. 이 controller chip은 flash memory를 관리하고, data를 읽고 쓰는 등의 작업을 처리한다.

  그리고 flash memory는 전기적으로 기록 및 삭제가 가능하고 non-volatile이며 소형 디바이스에서 사용하기 적합하다. e.g., USB drive, SD card, SSD, etc.

  DRAM은 volatile memory로 주기적으로 전원이 인가되어 있어야만 데이터가 보존된다. DRAM은 CPU나 다른 칩에서 사용하는 main memory로 많이 사용된다.

 

 

 


How things are arranged inside a drive??


 

 

Making flash pages and blocks from flash cells

  

  보통 한 page는 4KB의 크기를 갖는다. 이 page는 일반적으로 unit of I/O이다. 한편, 여러 page를 모아서 block을 만든다. 이 block은 보통 64-128-256 개의 page로 구성되며, 수 메가바이트가 된다. block은 보통 erase 단위로 사용되고, erase를 해야만 flash cell에 다시 쓸 수 있다. 따라서, Flash cell을 쓰기 전에는 반드시 지워져야 한다.  (여기서 회사나 시스템에서는 chunk와 같이 다른이름을 사용할 수도 있다. 당황하지 말자.), 정확한지는 모르겠지만 chunk는 전송할 때 data를 작은 덩어리로 나눈 것, block은 storage media에서 데이터를 read/write하는 최소 단위, sector는 HDD에서 data를 읽거나 쓰는 최소 단위로 알고있다.

 

Flash page: Basic operations

  Flash memory의 기본 작업 중 하나인 flash page operation에 대해 설명해보겠다.

 

  1. Read (a page): logically? the same as reading a sector, read(page_number)

    - HDD같이 moving parts가 없으므로, 대략 10s of microseconds 밖에 안걸린다. 겁나 빠르죠?

    - 1번이든 1024번이든 어떤 page를 읽든 상관없이, uniform하게 빠르고 random read performance가 좋다.

 

  2. Erase (a block): reset a block (a few Megabytes)

    - 저장하려는 data가 있으면 다른 위치로 복사한 후, 전체 블록을 삭제한다.

    - 일반적으로 느리고, a few to 10-100s of milliseconds까지 소요된다.

 

  3. Write (a page): block이 삭제된 후에 page를 쓸 수 있다. write(page_number)

    - erase보다 cost적으로는 적게 들지만, read보다는 더 많이 든다. typically, 50-100 microseconds 소요된다.

    - 한 번 쓰면 삭제하기 전까지는 더 이상 overwrite할 수 없고, package에 따라 다른 read/write 단위를 가질 수 있다.

 

Simplified flash page state machine (구현에 따라 다름)

 

flash page state (impl. dependent)

 

 

  page도 state를 가지고 상태를 변화를 관리하는 data structure가 필요하다.

 

 

Write - Erase operation in detail

 

Erase operation in detail

 

  참고할 점은 page 1과 page 2의 내용이 손실되기 때문에, 이 내용을 저장하려면 전체 block을 복사해야만 한다. 이 문제에 대해서는 후에 다시 언급하는 시점이 올 것입니다. 

 

 

Typical Values of Operations

 

  지금보는 것은 flash physical chips의 typical values들이지만, 최근에 많은 발전이 이루어졌다. 따라서 operating system (flash storage device)에서 볼 수 있는 값은 다음과 같은 요소에 따라 달라진다.

  - the generation of the device

  - how expensive it is (internal implementation)

  - what cell technology it is using

  - how old is it

  - how much data you have written to it .....and many more

 

 

So Far: Flash vs HDD (at the cell level)

 

  1. flash storage 내부에는 moving parts가 없다.

  2. flash storage의 read latency는 HDD보다 훨씬 낮다. (10s of msecs vs 10s of usecs)

  3. asymmetric read and write performances, 10(read) vs 100(write) usecs

    a. HDD 는 같다. both read and write

  4. No overwriting (in-place update). 같은 페이지에 다시 덮어쓸 수 없다. (HDD 가능)

  5. [new operation] Erase operation, must erase a whole block before writing

  6. [new activity] If there are valid data pages, mst copy data before erase

  7. Flash cell을 erase/program할 수 있는 횟수는 한계가 있다. (P/E lifetime is finate)

    a. nonetheless, like with any electron based storage, they leak and data will be eventually lost

    b. HDD는 theoretically infinite durability를 가지고 있다.

  8. Read performance가 cell level에서 균일하다. no difference with random or sequential at the cell level

    a. write: sequential > random operation

  9. anything else that you could think of?

 

 

How do we make a device out of Flash cells?

  We have seen how an individual cells/pages behave

  How do we pack them as single "device" ?? so that:

  1. sector가 있어야 한다.

  2. addressable sector가 있어야 한다.

  3. read or write command를 내릴 수 있어야 한다.

  4. computers / servers 에 연결할 수 있어야 한다.

  5. can install a file system on it

  6. erase operation을 할 주체가 있어야 한다.

 

 

  이런 requirements를 충족시키기 위해서는 여러 가지 기술과 알고리즘이 사용된다. 예를 들어, sector와 addressable sector를 구성하기 위해서는 block으로 page를 그룹화하고, block을 다시 그룹화해서 sector를 형성할 수 있다. read/write commands는 주소 및 섹터 정보를 사용해서 내린다. file system을 사용해서 여러 file을 저장하고 관리하며, erase operation은 file system이나 operating system에서 관리한다. 또한 같은 위치를 다시 쓰는 문제를 해결하기 위해서는 Flash memory management tech를 사용한다. 이것은 write 연산이 발생할 때마다 새로운 page를 할당하고, 이전 page를 지우는 등의 작업을 수행해서 data를 안전하게 유지한다.

 

 

Must read!!

-> Though values might have changed the concepts, concerns, and trade-offs remain true still today.

본 논문에 대한 정리는 해당 블로그에서 찾아보면 알아보기 쉽게 정리해둔 곳을 찾을 수 있을 것이다.

 

 

 

What is inside the device

 

 

 

  - flash chips이 connector와 같이 arrange된다. (could be any topology, but here a line)

  - flash controller: a micro-controller, programs the flash chips

  - memory: 빠르고, data를 전송하는 동안 보유하는 buffer memory이다.

  - system interface: can support, SATA, SAS, USB, PCIe

 

즉, flash memory를 구성할 수 있는 요소들에 대한 설명이다. flash chip은 connector(could be any topology, but here a line)를 통해서 flash controller에 연결되어 있고, flash controller는 flash chip들을 program한다. 이런 작업을 수행하기 위해서, buffer memory가 사용되고, system interface를 통해 computer / server에 연결할 수 있다. 그리고 FP는 Flash Package를 의미하는데, FP는 여러 개의 flash chip, memory, controller 등이 포함된 physical package를 의미한다. 반면에, flash chip은 single chip으로 구성된 memory chip이다.

 

Flash Package(FP) Layout

 

 

Flash Package(FP) Layout

 

  Different packages might server I/O in parallel. Different packages might server control in parallel.

Different planes may work in parallel with a single command addressability

  - can move from plane 0 to 1, but not 2 (without buffering in between)

  - depends upon in the internal circultry

    - Cost function

 Multiple dies can be packaged together to push bandwidth

  

 

The Read/Write interface??

 

  all problems in computer science can be solved by another level of indirection

=> 다른 문제가 발생하면 문제를 추상화하고 더 많은 중간 단계를 도입해서 문제를 해결할 수 있다. 이런 중간 단계를 도입하면 문제를 좀 더 쉽게 해결할 수 있고 코드를 더 재사용할 수 있게 된다. 예를 들어, DB의 경우, 데이터에 대한 직접적인 참조 대신 index를 사용해서 data에 빠르게 access하는 방법을 제공한다. 이러한 추상화 레이어가 문제 해결에 대한 다른 관점을 제공해서 flexible and scalable software를 개발하는 데 도움이 된다.

 

  그래서 여기서 another level of indirection 측 추상화가 어디서 나타났냐를 확인해본다면 ??:

 

 

 

  LBA(Logical Block Address)는 (보통 page size와 다르지만 거의 동일한) 논리적인 sector를 가리키는데 사용된다. 내부적으로, LBA에서 physical locations으로 mapping할 수 있다. PBA는 internal device enumeration(내부 장치 열거)을 위해 사용되는 주소로, 외부에서는 사용되지 않는다.

  이런 LBA와 PBA와 같은 물리적인 세부 사항은 추상화 계층에서는 숨겨져 있다. file system이나 application에서는 block이나 page와 같은 logical unit으로 data에 access하며, 이러한 logical unit은 물리적인 세부 사항에서 완전히 분리된다. 추상화 계층은 데이터의 논리적인 구조와 물리적 구조를 분리함으로써, 우리가 물리적인 세부 사항을 걱정하지 않고 데이터를 다룰 수 있게 해준다.

 

 

Flash Translation Layer (FTL)

 

  A piece of logic that runs on the controller and is responsible for : Address Translation 

 

 

  file system은 logical file/folder의 구조를 관리하고 file data를 읽고 쓰기 위한 interface를 제공한다. file system은 LBA를 사용해서 data를 읽고 쓰고, FTL은 이런 LBA를 PBA로 변환해서 SSD에 쓰거나 SSD에서 읽어들인다.

 

 

What happens when you overwrite a LBA

 

 

  만약 overwrite를 하고 싶다면 physical space에서는 in-place update가 안되므로 다른 장소에 쓰고 기존에 있던 데이터를 erase하는 작업을 거친다.

 

 

FTL does a lot more ..

  - Address Translation, Garbage Collection, Performance, Parallelism, Wear leveling, Over-provisioning, Free blocks mng, Dead blocks and Error Corrections

 

 

 

앞으로 FTL에 대한 세부 기능과 storage에 관해 추가적으로 설명하는 페이지를 업데이트하겠습니다.

 

끝.

  

 

 

 

 

 

 

 

 

 


Terminology


 

 

# packing: packing은 data를 구조화하고 구성하는 과정을 말한다. 예를 들어, OS는 memory를 unit of page로 구성해서 사용하고, storage media는 unit of block으로 구성해서 사용한다. 이렇게 구조화된 데이터를 처리하고 전송하기 위해서는 특정한 protocol and rules를 따라야 한다. 따라서, OS와 storage media가 data를 구조화하고 구성하는 과정을 packing이라고 한다.

 

# transistor: transistor는 전자기기에서 가장 기본적인 부품 중 하나로, 전기 신호를 제어하고 증폭하는 데 사용한다. 즉, 전기 신호를 입력으로 받아서 출력을 다르게 만드는 작업을 수행한다. 대부분의 전자기기, 컴퓨터, 통신장비 등에서 사용되고, 소형화, 저전력화, 높은 속도, 안정성 등의 장점이 있어서 다양한 분야에서 활용된다.

728x90
Comments