Bug #15225
closedLinking to -lrbd causes process startup times to balloon
0%
Description
Take a trivial program:
$ cat test.c
#include <stdlib.h>
int main () { exit (0); }
and compare the startup time with and without linking to -lrados -lrbd.
Without:
$ gcc test.c -o test
$ TIMEFORMAT='%R' ; time ./test
0.001
With:
$ gcc test.c -o test -lrbd
$ TIMEFORMAT='%R' ; time ./test
0.044
This really matters - currently initializing librbd consumes
15% of the total time taken to start up the libguestfs appliance.
I looked at the code and did some profiling with perf [see attachment]
and it seems as if the following code is responsible:
https://github.com/ceph/ceph/blob/master/src/common/Cycles.cc#L50
This code is really wrong, but it in lieu of being able to fix it,
it would be nice at least to have an environment variable we can
use to skip the madness.
Files
Updated by Jason Dillaman about 8 years ago
Original source: https://bugzilla.redhat.com/show_bug.cgi?id=1319483
Updated by Jason Dillaman about 8 years ago
@Haomai, it appears that Cycles is only used in a couple test cases. Can we explicitly enable Cycles only within the test case instead of statically initializing it?
Updated by Richard Jones about 8 years ago
- File perf-report.txt perf-report.txt added
Attaching perf output from the original bug report. This shows the perf output of the null program linked to librbd.
Updated by Richard Jones about 8 years ago
- File 0001-Do-not-initialize-Cycles-globally.patch 0001-Do-not-initialize-Cycles-globally.patch added
I can't get Ceph to compile at the moment. Seems to break with GCC 6.0. Anyway, I wrote the attached, lightly tested patch based on Jason's observation in comment 3.
It reduces the process startup overhead by about 80%. That's not everything, but it's a good start.
Updated by Josh Durgin about 8 years ago
- Status changed from New to Pending Backport
Thanks, passed a rados run (http://pulpito.ceph.com/joshd-2016-04-01_22:23:13-rados-wip-mirror-test---basic-smithi/) and merged.
Updated by Josh Durgin about 8 years ago
commit:1c2831a2c1277c69f9649200d74a75c04a4b0296
Updated by Nathan Cutler about 8 years ago
- Copied to Backport #15359: infernalis: Linking to -lrbd causes process startup times to balloon added
Updated by Nathan Cutler about 8 years ago
- Copied to Backport #15360: hammer: Linking to -lrbd causes process startup times to balloon added
Updated by Loïc Dachary over 7 years ago
- Status changed from Pending Backport to Resolved