Red Hat ENTERPRISE LINUX 5.4 - SYSTEMTAP BEGINNERS GUIDE Technické informace Strana 141

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 240
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 140
Kernel Control Groups 127
Network Traffic (Resource Control)
With cgroup_tc, a network traffic controller is available. It can be used
to manage traffic that is associated with the tasks in a cgroup. Additionally,
cls_flow can classify packets based on the tc_classid field in the packet.
For example, to limit the traffic from all tasks from a file_server cgroup to
100Mbps, proceed as follows:
# create a file_transfer cgroup and assign it a unique classid
# of 0x10 - this will be used later to direct packets.
mkdir -p /dev/cgroup
mount -t cgroup tc -otc /dev/cgroup
mkdir /dev/cgroup/file_transfer
echo 0x10 > /dev/cgroup/file_transfer/tc.classid
echo $PID_OF_FILE_XFER_PROCESS > /dev/cgroup/file_transfer/tasks
# Now create an HTB class that rate-limits traffic to 100 mbits and
attach
# a filter to direct all traffic from the file_transfer cgroup
# to this new class.
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:10 htb rate 100mbit ceil
100mbit
tc filter add dev eth0 parent 1: handle 800 protocol ip prio 1 \
flow map key cgroup-classid baseclass 1:10
This example is taken from https://lwn.net/Articles/291161/,
where you can find more information about this feature.
10.4 Using Controller Groups
10.4.1 Prerequisites
To conveniently use cgroups, install the following additional packages:
libcgroup1 — basic user space tools to simplify resource management
cpuset — contains the cset to manipulate cpusets
libcpuset1 — C API to cpusets
kernel-source — only needed for documentation purposes
lxc — Linux container implementation
Zobrazit stránku 140
1 2 ... 136 137 138 139 140 141 142 143 144 145 146 ... 239 240

Komentáře k této Příručce

Žádné komentáře