runtime: cgo calls are way faster when enabling CPU profile #38325
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It was present with 1.13.4 and uprading to latest release confirms it
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This issues a lot of cgo calls to a library which then proceed to syscall. We expected some performance issues.
Was running for 13.5s in average in our system (with a lot of datasets)
The surprise was that the whole call was then taking less than a second! This is fully reproducible on our machine: No change apart from enabling or disabling CPU profile goes from 13.5s without CPU profile to one second with it enabled.
cpu.pprof.txt
The result of DatasetOpenAll isn’t identical with and without CPU profile enabled, there are less objects returns (see the difference in call stack of number of
openchildren
)a. Without CPU Profile enabled:
Here is the trace (taking 15s): trace_without_cpuprofile.txt
b. With CPU Profile enabled:
Here is the trace (taking 3s): trace_with_cpuprofile.txt
There is a little bit more on the 15s trace of GC calls, but nothing drastic that can explain the difference (38ms vs 4.4ms). We can see there is a lot more gaps though in Execution time.
The other surprise is that we are blocking way more in syscalls (2.3s vs 0.4s).
https://github.com/bicomsystems/go-libzfs doesn’t seem to do anything particular in case it detects it’s being under profile, is there anything CPU profiler is doing to influence the Cgo calls or am I missing anything obvious?
The text was updated successfully, but these errors were encountered: