How to improve the network of Docker? How to integrate with OpenVSwitch? How to apply more fine-grained QoS limitation and monitor the resource usage of containers? How to improve Docker in non-intrusive ways? This slides shared by Li Yulai, the Chief Architect of SpeedyCloud, is to answer questions above. Visit http://www.speedycloud.cn to find out more.
10. • Linux Net Namespace: /proc/$PID/ns/net
• ip link add Command creates veth NIC
• ip netns Command adjust netns configuration
by detecting /var/run/netns path
• Use ovs-vsctl (or brctl) to setup the network of
new NIC
Docker Network Improvement
17. The tangling of Memory, Swap and OOM
• Trigger of memory, swap and OOM
– When memory is short, Kernel will exchange
memory pages to swap
– OOM will be triggered if swap and memory are
full.
• How does OOM work
– Find the process that uses most of the memory
( the child process usage will be added to parent
process usage)
– Kill the process that uses most of the memory
18. The tangling of Memory, Swap and OOM
• Imagine that if you are running php-fpm, and the
OOM happens…
19. The tangling of Memory, Swap and OOM
• Save more for swap in your container if
you want to keep alive
21. QoS of Docker Resources
• The major and minor IDs of disk
– cat /proc/partitions
– ls –l /dev/
• Use the major and minor of devices, not those
of partitions
22. QoS of Docker Resources
• Network Bandwidth QoS
– OpenVSwitch
– Linux Bridge
• OpenVSwitch
– ovs-vsctl set interface veth1 ingress_policing_rate=1000
• ebtables + tc
– ebtables -A FORWARD -i veth1 -j mark --mark-set 0x1 --mark-target
ACCEPT
– qdics, class, filter
– tc filter add dev eth0 parent 1:0 protocol ip handle 1 fw flowid 1:1
23. QoS of Docker Resources
• Limitation of Disk Volume
– LVM creates the volume and make it accessible for
Container by using –volume parameter after
mount
– Use btrfs and set up quota
• btrfs qgroup limit –e 100G
/var/lib/docker/btrfs/subvolumes/CONTAINER_ID