"Virtualization"의 두 판 사이의 차이

오픈소스 비즈니스 컨설팅
둘러보기로 가기 검색하러 가기
잔글
잔글
165번째 줄: 165번째 줄:
  
 
== Cgroups ==
 
== Cgroups ==
 +
 +
Linux Resource의 독점을 방지<br/>CPU, Memory, Block I/O, Network 등을 할당
 +
 +
<span style="color:#006400;">'''Subsystem'''</span>
 +
 +
blkio – control/limit IO from block devices<br/>cpu - uses the kernels scheduler to control access to cpu resource<br/>cpuacct – reporting of cpu usage<br/>cpuset – assignment of cpu and memory nodes
 +
 +
*cpusets.cpus (mandatory)
 +
*cpusets.mems (mandatory)
 +
*others optional
 +
 +
devices – allow or deny device access<br/>freezer – suspend or resume tasks<br/>hugetlb – controls and reporting on hugepages<br/>memory – limit and report on memory usage by tasks<br/>net_cls – tags network packets with class id<br/>net_prio – by network interface set priority of network traffic<br/>ns – namespace subsystem
 +
 +
vi &nbsp;/etc/cgconfig.conf
 +
 +
vi &nbsp;/etc/cgrules.conf
 +
 +
vi &nbsp;/usr/lib/systemd/system/~.service<br/>systemctl daemon-reload<br/>systemctl restart ~.service
 +
 +
service cgconfig start<br/>chkconfig cgconfig on
 +
 +
<span style="color:#006400;">'''Sample'''</span>
 +
<pre>yum -y install libcgroup
 +
mkdir -p /service_group
 +
mount -t cgroup -o cpu,memory,nodev /service_group
 +
cd /service_group
 +
cgcreate -g cpu,memory /service_group/web      #--- cgroup 생성
 +
cgset -r cpuset.cpus='0,2,4,6,8,10,12,14' web  #--- cgroup parameter 설정
 +
cgset -r cpuset.mems = '0' httpd
 +
cgcreate -g cpu,memory /service_group/db
 +
cgset -r cpuset.cpus='1,3,5,7,9,11,13,15' db
 +
cgset -r cpuset.mems = '1' db
 +
lscgroup -g cpu:/docker                        #--- Group 조회
 +
lssubsys ~                                    #--- Sussystem 조회
 +
cgget ~                                        #--- cgroup parameter 조회
 +
cgexec ~                                      #--- cgroup 정보를 가지고 process 시작
 +
cgdelete
 +
cgclassify                                    #--- process를 cgroup에 할당
 +
systemd-cgls
 +
systemd-cgtop
 +
 +
</pre>
 +
<span style="color:#006400;">'''참고 문헌'''</span>
 +
 +
*[http://www.slideshare.net/sprdd/linux-performan-tuning-part-1 http://www.slideshare.net/sprdd/linux-performan-tuning-part-1]
 +
*[https://share.confex.com/share/125/webprogram/Handout/Session17308/Managing%20Resources%20with%20cgroups.pdf https://share.confex.com/share/125/webprogram/Handout/Session17308/Managing%20Resources%20with%20cgroups.pdf]
  
 
== VDI ==
 
== VDI ==

2015년 10월 28일 (수) 13:31 판

Virtualization(가상화)을 정리 합니다.

가상화 인프라

  • CPU 가상화
  • VT (Virtualization Technology)를 지원하는 CPU
  • Intel-VT, AMD-V
  • Windows에서 CPU가 VT를 지원하는지 확인하는 방법

VirtualizationIntel.png

  • Linux에서 CPU가 VT를 지원하는지 확인하는 방법
grep --color vmx /proc/cpuinfo
grep --color svm /proc/cpuinfo
egrep '(vmx|svm)' --color=always /proc/cpuinfo
  • CPU가 VT를 지원하는데 활성화 되어 있지 않은 경우
  • Windows를 새로 기동하면서 F2 키를 눌러 BIOS 설정 화면을 표시 합니다.
  • SysInfo 탭에서
CPU VT (VT-X)                      Supported
  • Advanced 탭에서
Intel vPro Configuration
MEBx Entry Hot-Key             [Disabled]

CPU VT (VT-x)                  [Enabled]
Intel VT-d                     [Enabled]
Intel TxT                      [Disabled]

가상화 기술의 종류

가상화 기술의 종류

가상화 기술 상세
서버 가상화 Bare-metal Virtualization
  • 하드웨어와 호스트 운영체제 사이에 Hypervisor가 위치
  • Hypervisor : 물리적 서버 위에 존재하는 가상화 레이어를 통해 운영체제가 수행하는데 필요한 하드웨어 환경을 가상으로 생성. VMM (Virtual Machine Monitor)

    - Full Virtualization
    (전 가상화)

  • CPU, Memory, Storage, Network 등 모든 자원을 Hypervisor가 직접 제어, 관리하기 때문에 어떤 운영체제라도 수정하지 않고 설치 가능
    - Para Virtualization
    (반 가상화)
  • Privileged 명령어(Hypercall)는 Hypervisor가 하드웨어로 명령을 수행
  • I/O call 등은 Hypervisor를 거쳐 driver를 사용하여 수행
    • Monolithic 방식 : Driver가 Hypervisor에 있음
    • Microkernel 방식 : Driver가 각 Guest에 있음
  • 20% 정도 Guest 운영체제 수정
Hosted Virtualization
  • Host와 Guest 사이에 Hypervisor가 위치
데스크탑 가상화
  • VDI (Virtual Desktop Infrastructure)
애플리케이션 가상화
  • 가상 운영 환경 (Virtual Server Environment)을 추가하여 운영체제 가상화
리소스 가상화
  • 스토리지 : 가상 디스크 어댑터

  • 네트워크 : 가상 이더넷, 공유 이더넷 어댑터


Hypervisor별 가상화 방식

Hypervisor 상세

KVM

VMware

  • Full Virtualization
  • VT (Virtualization Technology)를 지원하는 CPU가 필요함
    • HVM (Hardware Virtual Machine)
    • Intel-VT, AMD-V
    • ARM (Cortex-A 15 이후)
  • 현재는 Para Virtualization도 지원함
Xen
  • Para Virtualization
  • 현재는 Full Virtualization도 지원함

Linux Namespace

Linux에서 제공하는 lightweight 가상화 기술로 격리된 환경을 제공 합니다.

Namespace 분류

분류 상세
UTS Hostname 분할
IPC Process 분할
PID PID (Process ID) 분할
NS File system의 mount 지점 분할
NET Network resource 분할
사례) Global namespace에 veth0를 zzns namespace에 veth1을 만들어 통신을 합니다.
ip netns add zzns                                      #--- zzns Namespace 생성
ip netns list zzna
ip link add veth0 type veth peer name veth1   #--- veth0, veth1 Veth (Virtual Ethernet) 생성
ip link list
ip link set veth1 netns zzns                          #--- veth1을 zzns namespace에 추가
ip netns exec zzns ip link list
USER User와 Group ID 분할

참고 문헌

Cgroups

Linux Resource의 독점을 방지
CPU, Memory, Block I/O, Network 등을 할당

Subsystem

blkio – control/limit IO from block devices
cpu - uses the kernels scheduler to control access to cpu resource
cpuacct – reporting of cpu usage
cpuset – assignment of cpu and memory nodes

  • cpusets.cpus (mandatory)
  • cpusets.mems (mandatory)
  • others optional

devices – allow or deny device access
freezer – suspend or resume tasks
hugetlb – controls and reporting on hugepages
memory – limit and report on memory usage by tasks
net_cls – tags network packets with class id
net_prio – by network interface set priority of network traffic
ns – namespace subsystem

vi  /etc/cgconfig.conf

vi  /etc/cgrules.conf

vi  /usr/lib/systemd/system/~.service
systemctl daemon-reload
systemctl restart ~.service

service cgconfig start
chkconfig cgconfig on

Sample

yum -y install libcgroup
mkdir -p /service_group
mount -t cgroup -o cpu,memory,nodev /service_group
cd /service_group
cgcreate -g cpu,memory /service_group/web      #--- cgroup 생성
cgset -r cpuset.cpus='0,2,4,6,8,10,12,14' web  #--- cgroup parameter 설정
cgset -r cpuset.mems = '0' httpd
cgcreate -g cpu,memory /service_group/db
cgset -r cpuset.cpus='1,3,5,7,9,11,13,15' db
cgset -r cpuset.mems = '1' db
lscgroup -g cpu:/docker                        #--- Group 조회
lssubsys ~                                     #--- Sussystem 조회
cgget ~                                        #--- cgroup parameter 조회
cgexec ~                                       #--- cgroup 정보를 가지고 process 시작
cgdelete
cgclassify                                     #--- process를 cgroup에 할당
systemd-cgls
systemd-cgtop

참고 문헌

VDI

VDI (Virtual Desktop Infrastructure)의 display protocol

  • RDP, RDP 7/8 for windows
  • NX : for linux
  • SPICE for linux, windows
  • VNC

참고 문헌