-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Build
As an experiment, I looked at a small library and was surprised to find over 1k symbols defined.
> readelf --dyn-syms -C -W build/install/lib/libcqf_utils.so | wc -l 1122
This turns out to be the case because the default visibility of symbols is public, which means that at load time, the dynamic loader needs to iterate over all these symbols to resolve relocations for them.
I attempted to recompile the same library with -fvisibility-inlines-hidden, which marks inlined class member functions as having private visibility, and saw that it only had ~200 symbols instead.
When I compiled the server with and without this option, I tested start up times. On my machine, mongod startup time dropped from ~12s to ~5s. Given max.hirschhorn@mongodb.com's findings about the about of time CI spends on mongod startup, this could be a nice win for testing times.
It looks like a prior investigation into using this option, SERVER-49322, was abandoned. The main issue appears to be concern about how hidden symbols would affect other tools which depend on the ability to symbolized stack traces, like the heap profiler, invariants, sanitizers etc. Given the potential improvements, I think it warrants further investigation into whether these concerns could be addressed or are still relevant after our move to libunwind.
- is related to
-
SERVER-49322 Evaluate feasibility and impact of enabling -fvisibility-inlines-hidden or -fvisibility=hidden
- Closed
-
SERVER-48272 Reduce startup time for dynamically linked server binaries and shell
- Closed
-
SERVER-70797 Reduce mongod startup time by using lazy symbol resolution
- Closed