Hi,
I wrote a following program:
It is used to read data from a udp socket and write it to a file.
According to the attached svg, there seems to be a high utilization of syscall.Syscall which seems to lead to a high cpu usage when listening from multicast.
The test was done on Ubuntu 14.04.1 LTS, Trusty Tahr on the host and via docker.
sysctl.conf:
net.core.rmem_max=12582912
net.core.rmem_default=12582912
For one multicast socket read and file write, it utilizes around 40% on Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (6 cores).
A profiling file is also attached to this email.
(bear in mind I'm using different stream sources/mcast addresses)
Host:
a) one stream:
avg cpu usage: 58.38 (pidstat)
(pidstat 3 -p 63890 - Linux 3.16.0-33-generic (vod1) 04/29/2015 _x86_64_ (24 CPU))
b) two streams:
avg cpu usage: 72.30 (pidstat)
c) three streams:
avg cpu usage: 80.67 (pidstat)
I have also tested the whole thing on kvm (Intel Xeon E312xx (Sandy Bridge)) without runtime.GOMAXPROCS(2):
cat /proc/cpuinfo | grep processor | wc -l
1
a) one stream:
cat /proc/18113/status | grep ctxt
voluntary_ctxt_switches: 1286
nonvoluntary_ctxt_switches: 2902
avg cpu usage: 1.14 (pidstat)
b) two streams:
cat /proc/18113/status | grep ctxt
voluntary_ctxt_switches: 6233
nonvoluntary_ctxt_switches: 14674
avg cpu usage: 7.14 (pidstat)
c) three streams:
cat /proc/18113/status | grep ctxt
voluntary_ctxt_switches: 19426
nonvoluntary_ctxt_switches: 49421
avg cpu usage: 12.81 (pidstat)
Context switches were taken at similar intervals (two minutes after adding a new stream recording).
Does anyone have any ideas why a high cpu usage is seen here? Are there any bad parts in the gorecord code which would introduce such loads?
Bear in mind the rpc methods from the code aren't used when testing.
Thank you in advance!
With regards,
Mario Kozjak