Project

General

Profile

Actions

Bug #15225

closed

Linking to -lrbd causes process startup times to balloon

Added by Jason Dillaman about 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
hammer,infernalis
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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

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

Related issues 2 (0 open2 closed)

Copied to rbd - Backport #15359: infernalis: Linking to -lrbd causes process startup times to balloonRejectedActions
Copied to rbd - Backport #15360: hammer: Linking to -lrbd causes process startup times to balloonResolvedWei-Chung ChengActions
Actions #1

Updated by Jason Dillaman about 8 years ago

Actions #2

Updated by Jason Dillaman about 8 years ago

  • Backport set to hammer,infernalis
Actions #3

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?

Actions #4

Updated by Richard Jones about 8 years ago

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

Actions #5

Updated by Richard Jones about 8 years 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.

Actions #6

Updated by Haomai Wang about 8 years ago

LGTM

Actions #7

Updated by Josh Durgin about 8 years ago

  • Status changed from New to Pending Backport
Actions #8

Updated by Josh Durgin about 8 years ago

commit:1c2831a2c1277c69f9649200d74a75c04a4b0296

Actions #9

Updated by Nathan Cutler about 8 years ago

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

Updated by Nathan Cutler about 8 years ago

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

Updated by Loïc Dachary over 7 years ago

  • Status changed from Pending Backport to Resolved
Actions

Also available in: Atom PDF