SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
Linux Resource Linux Resource 
ManagementManagement
Marian HackMan Marinov
Chief System Architect
mm@siteground.com
Who am I?Who am I?
●
Chief System Architect - SiteGroundChief System Architect - SiteGround
●
Linux System Administrator since 1996Linux System Administrator since 1996
●
Teaching LSA and NetSec at FMI SofiaTeaching LSA and NetSec at FMI Sofia
●
Organizing OpenFest and othersOrganizing OpenFest and others
●
ulimitulimit
●
quotaquota
●
CPU affinity per-device and per-processCPU affinity per-device and per-process
●
cGroupscGroups
cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited
scheduling priority (-e) 0scheduling priority (-e) 0
real-time priority (-r) 0real-time priority (-r) 0
file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited
pending signals (-i) 96832pending signals (-i) 96832
open files (-n) 1024open files (-n) 1024
file locks (-x) unlimitedfile locks (-x) unlimited
pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200
max user processes (-u) 200max user processes (-u) 200
max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited
virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited
core file size (blocks, -c) 0core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited
stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192
ulimitsulimits
app1
userXuserX
  user  procsuser  procs
userX    1userX    1
tty:tty:
core file size (blocks, -c) 0core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited
scheduling priority (-e) 0scheduling priority (-e) 0
file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited
pending signals (-i) 96832pending signals (-i) 96832
max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited
open files (-n) 1024open files (-n) 1024
pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0real-time priority (-r) 0
stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited
max user processes (-u) 200max user processes (-u) 200
virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedfile locks (-x) unlimited
ulimitsulimits
app2
app1
userXuserX
userXuserX
  user  procsuser  procs
userX    2userX    2
tty:tty:
core file size (blocks, -c) 0core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited
scheduling priority (-e) 0scheduling priority (-e) 0
file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited
pending signals (-i) 96832pending signals (-i) 96832
max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited
open files (-n) 1024open files (-n) 1024
pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0real-time priority (-r) 0
stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited
max user processes (-u) 200max user processes (-u) 200
virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedfile locks (-x) unlimited
ulimitsulimits
app2
app1
app3
userXuserX
userXuserX
userXuserX
  user  procsuser  procs
userX    3userX    3
tty:tty:
core file size (blocks, -c) 0core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited
scheduling priority (-e) 0scheduling priority (-e) 0
file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited
pending signals (-i) 96832pending signals (-i) 96832
max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited
open files (-n) 1024open files (-n) 1024
pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0real-time priority (-r) 0
stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited
max user processes (-u) 200max user processes (-u) 200
virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedfile locks (-x) unlimited
ulimitsulimits
core file size (blocks, -c) 0core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited
scheduling priority (-e) 0scheduling priority (-e) 0
file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited
pending signals (-i) 96832pending signals (-i) 96832
max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited
open files (-n) 1024open files (-n) 1024
pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0real-time priority (-r) 0
stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited
max user processes (-u) 200max user processes (-u) 200
virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedfile locks (-x) unlimited
app2
app1
app3
userXuserX
userXuserX
userXuserX
  user  procsuser  procs
userX    4userX    4
app4
userXuserX
ssh:ssh:
tty:tty:
ulimitsulimits
● login (on tty, via PAM)
● KDM, GDM, XDM & etc. (locally via PAM)
● ssh (remotely, via PAM and shell)
● pam_limits
– /etc/security/limits.conf
– /etc/security/limits.d/
● shell (sh, bash, zsh, csh, tcsh)
– /etc/profile.d/limits.[tcz]sh
ulimitsulimits how-tohow-to
$ cat /proc/self/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 200 200 processes
Max open files 1024 4096 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 200 200 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
ulimitsulimits how-tohow-to
$ cat /proc/self/limits
on older kernels:
$ echo -n "Max open files=2000:6000"
> /proc/self/limits
$ prlimit
ulimitsulimits how-tohow-to
Other kernel limits
● fs.file-max - max fd for the machine
● fs.nr_open - max fd per process
● fs.mount-max - max mounted filesystems
● kernel.threads-max
● Dedicate a CPU to HW device
● Dedicate a CPU to a process
● taskset mask cmd
● /proc/interrupts
– /proc/irq/NUM/smp_affinity
– /proc/irq/NUM/smp_affinity_list
– /proc/irq/NUM/affinity_hint
CPU AffinityCPU Affinity
● Dedicate a CPU to HW device
● Dedicate a CPU to a process
core0 core1
core2 core3
eth0 1Gbps
eth4 10Gbps
megaraid 6Gbps
CPU AffinityCPU Affinity
● Dedicate a CPU to HW device
● Dedicate a CPU to a process
core0 core1
core2 core3
eth0 1Gbps
eth1 10Gbps
eth2 10Gbps
megaraid 6Gbps
core0 - eth1 10Gbps
core1 - eth2 10Gbps
core3 - megaraid 6Gbps
core4 - eth0 & processes
CPU AffinityCPU Affinity
taskset example
root@terion:~# taskset -p 2727
pid 2727's current affinity mask: ff
root@terion:~# taskset -pc 3 2727
pid 2727's current affinity list: 0-7
pid 2727's new affinity list: 3
root@terion:~# taskset -p 2727
pid 2727's current affinity mask: 8
root@terion:~# ps axf|grep 2727
2727 ? Ss 2:06 /usr/sbin/acpid
root@terion:~#
irq affinity example
root@terion:~# cat /proc/interrupts
CPU0 CPU1
16: 3567385 0 IO-APIC 16-fasteoi ehci_hcd:usb1
17: 4567 0 IO-APIC 17-fasteoi snd_hda_intel:
23: 50797 0 IO-APIC 23-fasteoi ehci_hcd:usb2
25: 78045696 0 PCI-MSI 512000-edge ahci
36: 12 0 PCI-MSI 409600-edge eth0
37: 169256226 0 PCI-MSI 1572864-edge iwlwifi
38: 3515939 0 PCI-MSI 524288-edge nvidia
irq affinity example
root@terion:~# cd /proc/irq/37
root@terion:/proc/irq/37# cat smp_affinity
ff
root@terion:/proc/irq/37# cat smp_affinity_list
0-7
root@terion:/proc/irq/37# echo 3 > smp_affinity_list
root@terion:/proc/irq/37# cat smp_affinity
08
root@terion:/proc/irq/37# cat smp_affinity_list
3
root@terion:/proc/irq/37#
Other resource limitations can be
enforced using virtualization
technologies like KVM, Xen, etc.
What if you want to set a limit to a
group of processes?
● CPUSET
● CPU
● CPUACCT
● MEMORY
● BLKIO
● DEVICES
● freezer
● net_cls
● net_prio
● perf_event
● hudgetlb
cGroupscGroups
cGroupscGroups
● freezer
● net_cls
● net_prio
● perf_event
● hudgetlb
● CPUSET
● CPU
● CPUACCT
● MEMORY
● BLKIO
● DEVICES
● cGroups have hierarchy
//
/user1/user1
/user2/user2
/user1/user3/user1/user3
cGroupscGroups
root@goblin:/cgroup# ls -1 cpuset*
cpuset.cpus
cpuset.mems
cpuset.cpu_exclusive
cpuset.mem_exclusive
cpuset.effective_cpus
cpuset.effective_mems
...
cGroupscGroups CPUSETCPUSET
root@goblin:/cgroup# ls -1 cpu.*
cpu.cfs_period_us
cpu.cfs_quota_us
cpu.rt_period_us
cpu.rt_runtime_us
cpu.shares
cpu.stat
cGroupscGroups CPUCPU
root@goblin:/cgroup# ls -1 cpuacct.*
cpuacct.stat
cpuacct.usage
cpuacct.usage_percpu
cpuacct.usage_all
cpuacct.usage_percpu_sys
cpuacct.usage_percpu_user
cpuacct.usage_sys
cpuacct.usage_user
CPUACCTCPUACCTcGroupscGroups
memory.memsw.failcnt
memory.memsw.limit_in_bytes
memory.memsw.max_usage_in_bytes
memory.memsw.usage_in_bytes
memory.limit_in_bytes memory.usage_in_bytes
memory.soft_limit_in_bytes
memory.max_usage_in_bytes
memory.move_charge_at_immigrate memory.failcnt
memory.numa_stat memory.stat
memory.oom_control memory.pressure_level
memory.swappiness memory.use_hierarchy
cGroupscGroups MEMORYMEMORY
blkio.throttle.io_service_bytes
blkio.throttle.io_serviced
blkio.throttle.read_bps_device
blkio.throttle.read_iops_device
blkio.throttle.write_bps_device
blkio.throttle.write_iops_device
cGroupscGroups BLKIOBLKIO
blkio.weight
blkio.weight_device
blkio.leaf_weight
blkio.leaf_weight_device
BLKIOBLKIOcGroupscGroups
cGroupscGroups
root@goblin:/cgroup# ls -1 devices.*
devices.allow
devices.deny
devices.list
DEVICESDEVICES
Marian HackMan Marinov
Chief System Architect
mm@siteground.com
QuestionsQuestions

Contenu connexe

Tendances

Hadoop Installation and basic configuration
Hadoop Installation and basic configurationHadoop Installation and basic configuration
Hadoop Installation and basic configuration
Gerrit van Vuuren
 
General commands for navisphere cli
General commands for navisphere cliGeneral commands for navisphere cli
General commands for navisphere cli
msaleh1234
 
Проблемы использования TCP в мобильных приложениях. Владимир Кириллов
Проблемы использования TCP в мобильных приложениях.  Владимир КирилловПроблемы использования TCP в мобильных приложениях.  Владимир Кириллов
Проблемы использования TCP в мобильных приложениях. Владимир Кириллов
Anthony Marchenko
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
hugo lu
 
2014-4Q-OpenStack-Fall-presentation-public-20150310a
2014-4Q-OpenStack-Fall-presentation-public-20150310a2014-4Q-OpenStack-Fall-presentation-public-20150310a
2014-4Q-OpenStack-Fall-presentation-public-20150310a
Ken Igarashi
 

Tendances (20)

Wuala, P2P Online Storage
Wuala, P2P Online StorageWuala, P2P Online Storage
Wuala, P2P Online Storage
 
Hadoop Installation and basic configuration
Hadoop Installation and basic configurationHadoop Installation and basic configuration
Hadoop Installation and basic configuration
 
General commands for navisphere cli
General commands for navisphere cliGeneral commands for navisphere cli
General commands for navisphere cli
 
Unix 6 en
Unix 6 enUnix 6 en
Unix 6 en
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 
Log
LogLog
Log
 
Integration of neutron, nova and designate how to use it and how to configur...
Integration of neutron, nova and designate  how to use it and how to configur...Integration of neutron, nova and designate  how to use it and how to configur...
Integration of neutron, nova and designate how to use it and how to configur...
 
Проблемы использования TCP в мобильных приложениях. Владимир Кириллов
Проблемы использования TCP в мобильных приложениях.  Владимир КирилловПроблемы использования TCP в мобильных приложениях.  Владимир Кириллов
Проблемы использования TCP в мобильных приложениях. Владимир Кириллов
 
Log
LogLog
Log
 
Archiving in linux tar
Archiving in linux tarArchiving in linux tar
Archiving in linux tar
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
 
Galaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWSGalaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWS
 
Network sockets
Network socketsNetwork sockets
Network sockets
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)
 
Hadoop spark performance comparison
Hadoop spark performance comparisonHadoop spark performance comparison
Hadoop spark performance comparison
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat Sheet
 
Bucket your partitions wisely - Cassandra summit 2016
Bucket your partitions wisely - Cassandra summit 2016Bucket your partitions wisely - Cassandra summit 2016
Bucket your partitions wisely - Cassandra summit 2016
 
Fight Against Citadel in Japan  by You Nakatsuru
Fight Against Citadel in Japan  by You NakatsuruFight Against Citadel in Japan  by You Nakatsuru
Fight Against Citadel in Japan  by You Nakatsuru
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
 
2014-4Q-OpenStack-Fall-presentation-public-20150310a
2014-4Q-OpenStack-Fall-presentation-public-20150310a2014-4Q-OpenStack-Fall-presentation-public-20150310a
2014-4Q-OpenStack-Fall-presentation-public-20150310a
 

Similaire à Linux Resource Management - Мариян Маринов (Siteground)

Shak larry-jeder-perf-and-tuning-summit14-part2-final
Shak larry-jeder-perf-and-tuning-summit14-part2-finalShak larry-jeder-perf-and-tuning-summit14-part2-final
Shak larry-jeder-perf-and-tuning-summit14-part2-final
Tommy Lee
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
no no
 
import rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythonimport rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Python
groveronline
 

Similaire à Linux Resource Management - Мариян Маринов (Siteground) (20)

ulimit
ulimit ulimit
ulimit
 
End to End Processing of 3.7 Million Telemetry Events per Second using Lambda...
End to End Processing of 3.7 Million Telemetry Events per Second using Lambda...End to End Processing of 3.7 Million Telemetry Events per Second using Lambda...
End to End Processing of 3.7 Million Telemetry Events per Second using Lambda...
 
Shak larry-jeder-perf-and-tuning-summit14-part2-final
Shak larry-jeder-perf-and-tuning-summit14-part2-finalShak larry-jeder-perf-and-tuning-summit14-part2-final
Shak larry-jeder-perf-and-tuning-summit14-part2-final
 
Java и Linux — особенности эксплуатации / Алексей Рагозин (Дойче Банк)
Java и Linux — особенности эксплуатации / Алексей Рагозин (Дойче Банк)Java и Linux — особенности эксплуатации / Алексей Рагозин (Дойче Банк)
Java и Linux — особенности эксплуатации / Алексей Рагозин (Дойче Банк)
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Serial-War
Serial-WarSerial-War
Serial-War
 
import rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythonimport rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Python
 
LSA2 - 02 Namespaces
LSA2 - 02  NamespacesLSA2 - 02  Namespaces
LSA2 - 02 Namespaces
 
CONFidence 2017: Hacking embedded with OpenWrt (Vladimir Mitiouchev)
CONFidence 2017: Hacking embedded with OpenWrt (Vladimir Mitiouchev)CONFidence 2017: Hacking embedded with OpenWrt (Vladimir Mitiouchev)
CONFidence 2017: Hacking embedded with OpenWrt (Vladimir Mitiouchev)
 
[Pgday.Seoul 2018] PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha
[Pgday.Seoul 2018]  PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha[Pgday.Seoul 2018]  PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha
[Pgday.Seoul 2018] PostgreSQL 성능을 위해 개발된 라이브러리 OS 소개 apposha
 
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
 
Accelerating HPC Applications on NVIDIA GPUs with OpenACC
Accelerating HPC Applications on NVIDIA GPUs with OpenACCAccelerating HPC Applications on NVIDIA GPUs with OpenACC
Accelerating HPC Applications on NVIDIA GPUs with OpenACC
 
Low-level Accesses
Low-level AccessesLow-level Accesses
Low-level Accesses
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuilding
 
Advertising Fraud Detection at Scale at T-Mobile
Advertising Fraud Detection at Scale at T-MobileAdvertising Fraud Detection at Scale at T-Mobile
Advertising Fraud Detection at Scale at T-Mobile
 
PerfUG 3 - perfs système
PerfUG 3 - perfs systèmePerfUG 3 - perfs système
PerfUG 3 - perfs système
 
Mikhail Belopuhov: OpenBSD: Where is crypto headed?
Mikhail Belopuhov: OpenBSD: Where is crypto headed?Mikhail Belopuhov: OpenBSD: Where is crypto headed?
Mikhail Belopuhov: OpenBSD: Where is crypto headed?
 
Docker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in PragueDocker and friends at Linux Days 2014 in Prague
Docker and friends at Linux Days 2014 in Prague
 

Plus de PlovDev Conference

Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
PlovDev Conference
 

Plus de PlovDev Conference (7)

Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
Интернет стандартите - къде и как се създават, и защо си струва да участвам?-...
 
Приложение на изкуствен интелект при анализа на медийно съдържание в интернет...
Приложение на изкуствен интелект при анализа на медийно съдържание в интернет...Приложение на изкуствен интелект при анализа на медийно съдържание в интернет...
Приложение на изкуствен интелект при анализа на медийно съдържание в интернет...
 
DevOps in the Cloud Валентин Христев (VMWare)
DevOps in the Cloud Валентин Христев (VMWare)DevOps in the Cloud Валентин Христев (VMWare)
DevOps in the Cloud Валентин Христев (VMWare)
 
Introduction to Android with Kotlin: Дончо Минков (Telerik Academy)
Introduction to Android with Kotlin:  Дончо Минков (Telerik Academy)Introduction to Android with Kotlin:  Дончо Минков (Telerik Academy)
Introduction to Android with Kotlin: Дончо Минков (Telerik Academy)
 
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин ВладевPlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
 
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo RadulovskiPlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
PlovDev 2016: Drupal 8 Evolution & Kickstart by Ivo Radulovski
 
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
 

Dernier

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 

Dernier (20)

Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 

Linux Resource Management - Мариян Маринов (Siteground)

  • 2. Who am I?Who am I? ● Chief System Architect - SiteGroundChief System Architect - SiteGround ● Linux System Administrator since 1996Linux System Administrator since 1996 ● Teaching LSA and NetSec at FMI SofiaTeaching LSA and NetSec at FMI Sofia ● Organizing OpenFest and othersOrganizing OpenFest and others
  • 3. ● ulimitulimit ● quotaquota ● CPU affinity per-device and per-processCPU affinity per-device and per-process ● cGroupscGroups
  • 4. cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited scheduling priority (-e) 0scheduling priority (-e) 0 real-time priority (-r) 0real-time priority (-r) 0 file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited pending signals (-i) 96832pending signals (-i) 96832 open files (-n) 1024open files (-n) 1024 file locks (-x) unlimitedfile locks (-x) unlimited pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200 max user processes (-u) 200max user processes (-u) 200 max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited core file size (blocks, -c) 0core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192 ulimitsulimits
  • 5. app1 userXuserX   user  procsuser  procs userX    1userX    1 tty:tty: core file size (blocks, -c) 0core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited scheduling priority (-e) 0scheduling priority (-e) 0 file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited pending signals (-i) 96832pending signals (-i) 96832 max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited open files (-n) 1024open files (-n) 1024 pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0real-time priority (-r) 0 stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited max user processes (-u) 200max user processes (-u) 200 virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited file locks (-x) unlimitedfile locks (-x) unlimited ulimitsulimits
  • 6. app2 app1 userXuserX userXuserX   user  procsuser  procs userX    2userX    2 tty:tty: core file size (blocks, -c) 0core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited scheduling priority (-e) 0scheduling priority (-e) 0 file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited pending signals (-i) 96832pending signals (-i) 96832 max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited open files (-n) 1024open files (-n) 1024 pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0real-time priority (-r) 0 stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited max user processes (-u) 200max user processes (-u) 200 virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited file locks (-x) unlimitedfile locks (-x) unlimited ulimitsulimits
  • 7. app2 app1 app3 userXuserX userXuserX userXuserX   user  procsuser  procs userX    3userX    3 tty:tty: core file size (blocks, -c) 0core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited scheduling priority (-e) 0scheduling priority (-e) 0 file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited pending signals (-i) 96832pending signals (-i) 96832 max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited open files (-n) 1024open files (-n) 1024 pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0real-time priority (-r) 0 stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited max user processes (-u) 200max user processes (-u) 200 virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited file locks (-x) unlimitedfile locks (-x) unlimited ulimitsulimits
  • 8. core file size (blocks, -c) 0core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimiteddata seg size (kbytes, -d) unlimited scheduling priority (-e) 0scheduling priority (-e) 0 file size (blocks, -f) unlimitedfile size (blocks, -f) unlimited pending signals (-i) 96832pending signals (-i) 96832 max locked memory (kbytes, -l) 64max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimitedmax memory size (kbytes, -m) unlimited open files (-n) 1024open files (-n) 1024 pipe size (512 bytes, -p) 8pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0real-time priority (-r) 0 stack size (kbytes, -s) 8192stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimitedcpu time (seconds, -t) unlimited max user processes (-u) 200max user processes (-u) 200 virtual memory (kbytes, -v) unlimitedvirtual memory (kbytes, -v) unlimited file locks (-x) unlimitedfile locks (-x) unlimited app2 app1 app3 userXuserX userXuserX userXuserX   user  procsuser  procs userX    4userX    4 app4 userXuserX ssh:ssh: tty:tty: ulimitsulimits
  • 9. ● login (on tty, via PAM) ● KDM, GDM, XDM & etc. (locally via PAM) ● ssh (remotely, via PAM and shell) ● pam_limits – /etc/security/limits.conf – /etc/security/limits.d/ ● shell (sh, bash, zsh, csh, tcsh) – /etc/profile.d/limits.[tcz]sh ulimitsulimits how-tohow-to
  • 10. $ cat /proc/self/limits Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited seconds Max file size unlimited unlimited bytes Max data size unlimited unlimited bytes Max stack size 8388608 unlimited bytes Max core file size 0 unlimited bytes Max resident set unlimited unlimited bytes Max processes 200 200 processes Max open files 1024 4096 files Max locked memory 65536 65536 bytes Max address space unlimited unlimited bytes Max file locks unlimited unlimited locks Max pending signals 200 200 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us ulimitsulimits how-tohow-to
  • 11. $ cat /proc/self/limits on older kernels: $ echo -n "Max open files=2000:6000" > /proc/self/limits $ prlimit ulimitsulimits how-tohow-to
  • 12. Other kernel limits ● fs.file-max - max fd for the machine ● fs.nr_open - max fd per process ● fs.mount-max - max mounted filesystems ● kernel.threads-max
  • 13. ● Dedicate a CPU to HW device ● Dedicate a CPU to a process ● taskset mask cmd ● /proc/interrupts – /proc/irq/NUM/smp_affinity – /proc/irq/NUM/smp_affinity_list – /proc/irq/NUM/affinity_hint CPU AffinityCPU Affinity
  • 14. ● Dedicate a CPU to HW device ● Dedicate a CPU to a process core0 core1 core2 core3 eth0 1Gbps eth4 10Gbps megaraid 6Gbps CPU AffinityCPU Affinity
  • 15. ● Dedicate a CPU to HW device ● Dedicate a CPU to a process core0 core1 core2 core3 eth0 1Gbps eth1 10Gbps eth2 10Gbps megaraid 6Gbps core0 - eth1 10Gbps core1 - eth2 10Gbps core3 - megaraid 6Gbps core4 - eth0 & processes CPU AffinityCPU Affinity
  • 16. taskset example root@terion:~# taskset -p 2727 pid 2727's current affinity mask: ff root@terion:~# taskset -pc 3 2727 pid 2727's current affinity list: 0-7 pid 2727's new affinity list: 3 root@terion:~# taskset -p 2727 pid 2727's current affinity mask: 8 root@terion:~# ps axf|grep 2727 2727 ? Ss 2:06 /usr/sbin/acpid root@terion:~#
  • 17. irq affinity example root@terion:~# cat /proc/interrupts CPU0 CPU1 16: 3567385 0 IO-APIC 16-fasteoi ehci_hcd:usb1 17: 4567 0 IO-APIC 17-fasteoi snd_hda_intel: 23: 50797 0 IO-APIC 23-fasteoi ehci_hcd:usb2 25: 78045696 0 PCI-MSI 512000-edge ahci 36: 12 0 PCI-MSI 409600-edge eth0 37: 169256226 0 PCI-MSI 1572864-edge iwlwifi 38: 3515939 0 PCI-MSI 524288-edge nvidia
  • 18. irq affinity example root@terion:~# cd /proc/irq/37 root@terion:/proc/irq/37# cat smp_affinity ff root@terion:/proc/irq/37# cat smp_affinity_list 0-7 root@terion:/proc/irq/37# echo 3 > smp_affinity_list root@terion:/proc/irq/37# cat smp_affinity 08 root@terion:/proc/irq/37# cat smp_affinity_list 3 root@terion:/proc/irq/37#
  • 19. Other resource limitations can be enforced using virtualization technologies like KVM, Xen, etc.
  • 20. What if you want to set a limit to a group of processes?
  • 21. ● CPUSET ● CPU ● CPUACCT ● MEMORY ● BLKIO ● DEVICES ● freezer ● net_cls ● net_prio ● perf_event ● hudgetlb cGroupscGroups
  • 22. cGroupscGroups ● freezer ● net_cls ● net_prio ● perf_event ● hudgetlb ● CPUSET ● CPU ● CPUACCT ● MEMORY ● BLKIO ● DEVICES
  • 23. ● cGroups have hierarchy // /user1/user1 /user2/user2 /user1/user3/user1/user3 cGroupscGroups
  • 24. root@goblin:/cgroup# ls -1 cpuset* cpuset.cpus cpuset.mems cpuset.cpu_exclusive cpuset.mem_exclusive cpuset.effective_cpus cpuset.effective_mems ... cGroupscGroups CPUSETCPUSET
  • 25. root@goblin:/cgroup# ls -1 cpu.* cpu.cfs_period_us cpu.cfs_quota_us cpu.rt_period_us cpu.rt_runtime_us cpu.shares cpu.stat cGroupscGroups CPUCPU
  • 26. root@goblin:/cgroup# ls -1 cpuacct.* cpuacct.stat cpuacct.usage cpuacct.usage_percpu cpuacct.usage_all cpuacct.usage_percpu_sys cpuacct.usage_percpu_user cpuacct.usage_sys cpuacct.usage_user CPUACCTCPUACCTcGroupscGroups
  • 30. cGroupscGroups root@goblin:/cgroup# ls -1 devices.* devices.allow devices.deny devices.list DEVICESDEVICES
  • 31. Marian HackMan Marinov Chief System Architect mm@siteground.com QuestionsQuestions