Project

General

Profile

Bug #15225

Linking to -lrbd causes process startup times to balloon

Added by Jason Dillaman over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/21/2016
Due date:
% Done:

0%

Source:
Community (user)
Tags:
Backport:
hammer,infernalis
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Release:
Needs Doc:
No

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.

perf-report.txt View (31.1 KB) Richard Jones, 03/21/2016 02:11 PM

0001-Do-not-initialize-Cycles-globally.patch View (3.52 KB) Richard Jones, 03/21/2016 02:32 PM


Related issues

Copied to rbd - Backport #15359: infernalis: Linking to -lrbd causes process startup times to balloon Rejected
Copied to rbd - Backport #15360: hammer: Linking to -lrbd causes process startup times to balloon Resolved

History

#2 Updated by Jason Dillaman over 1 year ago

  • Backport set to hammer,infernalis

#3 Updated by Jason Dillaman over 1 year 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?

#4 Updated by Richard Jones over 1 year ago

Attaching perf output from the original bug report. This shows the perf output of the null program linked to librbd.

#5 Updated by Richard Jones over 1 year ago

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.

#6 Updated by Haomai Wang over 1 year ago

LGTM

#7 Updated by Josh Durgin over 1 year ago

  • Status changed from New to Pending Backport

#8 Updated by Josh Durgin over 1 year ago

commit:1c2831a2c1277c69f9649200d74a75c04a4b0296

#9 Updated by Nathan Cutler over 1 year ago

  • Copied to Backport #15359: infernalis: Linking to -lrbd causes process startup times to balloon added

#10 Updated by Nathan Cutler over 1 year ago

  • Copied to Backport #15360: hammer: Linking to -lrbd causes process startup times to balloon added

#11 Updated by Loic Dachary over 1 year ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF