--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/groups/opt_out.
Due to the design of scons the startup time of a build can be quite slow.
You can speed up your build by only building the targets you need instead of "all", which builds a lot of unit testing targets that you may or may not be utilizing.
Some common targets are:
core (builds mongod, mongos, mongo shell)
tools (builds the mongo support tools)
FWIW, "scons all" takes less than 8 seconds on my machine to tell me that nothing needs to be recompiled, so your milage may vary.
As with many build systems, it's important to choose a proper -j concurrency value as well, to make sure your machine is heavily utilized but not overloaded.
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev.
For more options, visit https://groups.google.com/d/optout.
Hi Dirk -I wanted to let you know that I've been experimenting with some of the ideas you outlined above. All of my experiments were based on building just the 'mongod' target, with 'scons -jN --dbg=on ./mongod' or some close variant, as this is the most frequently built target.
Is this on a publicly accessible branch somewhere? I'd really like to have a second look at your latest changes.
Taking your advice on reducing the CPPPATH did work to some degree. On my linux machine, a no-op rebuild of mongod with 'fat' include paths takes about 36 seconds when using -j24 with 24 cores. When reduced to 'thin' include paths on an as-needed-per-library basis, that drops to about 31 seconds. That is nice, but not a big gain.
[...]
One thing to note is that during all no-op rebuilds, it appears that only one core is ever used. Given that, I think the biggest gain we could get here would be if the -jN value allowed N threads to parallelize the dependency checking work. Most of my machine sits idle during a no-op rebuild.
This isn't easy to change, it's a problem related to the Python GIL. It can't be circumvented unless you cut away basic parts of SCons' dependency checking...and then you can't use it anymore. ;)
So, the approach still has to be "make your -j1 build fast" instead of "shadow that your build isn't properly setup, by using more and more cores". ;)
Sorry if this sounds over-simplified, it's not meant as an offense.
Finally, if you'd like to work on this actively, I'm here and ready to help out. Just create a branch, and point me to it...I'll hack away a little and see if I can come up with a few pull requests. I'd really like to keep you developers (and your users) convinced that SCons was a good choice as build system.
Regards,
Dirk
Hi Andrew,and thanks for the update.
Am Donnerstag, 19. Juni 2014 22:39:18 UTC+2 schrieb acm:Hi Dirk -I wanted to let you know that I've been experimenting with some of the ideas you outlined above. All of my experiments were based on building just the 'mongod' target, with 'scons -jN --dbg=on ./mongod' or some close variant, as this is the most frequently built target.Is this on a publicly accessible branch somewhere? I'd really like to have a second look at your latest changes.Taking your advice on reducing the CPPPATH did work to some degree. On my linux machine, a no-op rebuild of mongod with 'fat' include paths takes about 36 seconds when using -j24 with 24 cores. When reduced to 'thin' include paths on an as-needed-per-library basis, that drops to about 31 seconds. That is nice, but not a big gain.When discussing performance I'd like to clearly distinguish between "clean builds" (from scratch), and "zero builds" (during actual development, when everything is built, and no or only some files have changed). For the first case, that you seem to be referring to, it doesn't make sense to compare absolute runtimes in my opinion. I'd rather look at the ratio of "time spent on actual compiling/building" vs. "total time", and try to get that closer to 100% (80% or up, are very good already...depending a little on the structure of the project). It's not enough to say "this build took 36s with SCons", you actually have to add "and x seconds were overhead, where nothing was built" to make an objective statement.
This is different for "zero builds", where the user is interested in having the build system return as fast as possible. In this case all files are built already, so the actual compile commands don't contribute to the total time. Here it's okay to directly compare the results of "/usr/bin/time"....[...]One thing to note is that during all no-op rebuilds, it appears that only one core is ever used. Given that, I think the biggest gain we could get here would be if the -jN value allowed N threads to parallelize the dependency checking work. Most of my machine sits idle during a no-op rebuild.This isn't easy to change, it's a problem related to the Python GIL. It can't be circumvented unless you cut away basic parts of SCons' dependency checking...and then you can't use it anymore. ;)So, the approach still has to be "make your -j1 build fast" instead of "shadow that your build isn't properly setup, by using more and more cores". ;)Sorry if this sounds over-simplified, it's not meant as an offense.Finally, if you'd like to work on this actively, I'm here and ready to help out. Just create a branch, and point me to it...I'll hack away a little and see if I can come up with a few pull requests. I'd really like to keep you developers (and your users) convinced that SCons was a good choice as build system.Regards,Dirk
On Fri, Jun 20, 2014 at 7:23 AM, <dl9...@darc.de> wrote:Hi Andrew,and thanks for the update.
Am Donnerstag, 19. Juni 2014 22:39:18 UTC+2 schrieb acm:Hi Dirk -I wanted to let you know that I've been experimenting with some of the ideas you outlined above. All of my experiments were based on building just the 'mongod' target, with 'scons -jN --dbg=on ./mongod' or some close variant, as this is the most frequently built target.Is this on a publicly accessible branch somewhere? I'd really like to have a second look at your latest changes.
Taking your advice on reducing the CPPPATH did work to some degree. On my linux machine, a no-op rebuild of mongod with 'fat' include paths takes about 36 seconds when using -j24 with 24 cores. When reduced to 'thin' include paths on an as-needed-per-library basis, that drops to about 31 seconds. That is nice, but not a big gain.When discussing performance I'd like to clearly distinguish between "clean builds" (from scratch), and "zero builds" (during actual development, when everything is built, and no or only some files have changed). For the first case, that you seem to be referring to, it doesn't make sense to compare absolute runtimes in my opinion. I'd rather look at the ratio of "time spent on actual compiling/building" vs. "total time", and try to get that closer to 100% (80% or up, are very good already...depending a little on the structure of the project). It's not enough to say "this build took 36s with SCons", you actually have to add "and x seconds were overhead, where nothing was built" to make an objective statement.I believe Andrew meant "zero build" when he wrote "no-op build". It was a build that ultimately determined that no work needed to be done, which is the case you expressed interest in.
I have noticed that different developers in our organization see somewhat widely varying times for their zero-builds, though I've never investigated the root cause. It's often on similar hardware, but different devs tend to run different Linux distros, and with my luck, probably different versions of SCons and the other tools. I usually see zero builds of the same product take 10-20 seconds, while Andrew and some others regularly see 30+ seconds. Even at 10-20 seconds, we'd certainly be interested in shaving down the zero-build time.
This is different for "zero builds", where the user is interested in having the build system return as fast as possible. In this case all files are built already, so the actual compile commands don't contribute to the total time. Here it's okay to directly compare the results of "/usr/bin/time"....[...]One thing to note is that during all no-op rebuilds, it appears that only one core is ever used. Given that, I think the biggest gain we could get here would be if the -jN value allowed N threads to parallelize the dependency checking work. Most of my machine sits idle during a no-op rebuild.This isn't easy to change, it's a problem related to the Python GIL. It can't be circumvented unless you cut away basic parts of SCons' dependency checking...and then you can't use it anymore. ;)
So, the approach still has to be "make your -j1 build fast" instead of "shadow that your build isn't properly setup, by using more and more cores". ;)Sorry if this sounds over-simplified, it's not meant as an offense.
Finally, if you'd like to work on this actively, I'm here and ready to help out. Just create a branch, and point me to it...I'll hack away a little and see if I can come up with a few pull requests. I'd really like to keep you developers (and your users) convinced that SCons was a good choice as build system.
On Fri, Jun 20, 2014 at 8:22 AM, Andy Schwerin <schw...@mongodb.com> wrote:
On Fri, Jun 20, 2014 at 7:23 AM, <dl9...@darc.de> wrote:Hi Andrew,and thanks for the update.
Am Donnerstag, 19. Juni 2014 22:39:18 UTC+2 schrieb acm:Hi Dirk -I wanted to let you know that I've been experimenting with some of the ideas you outlined above. All of my experiments were based on building just the 'mongod' target, with 'scons -jN --dbg=on ./mongod' or some close variant, as this is the most frequently built target.Is this on a publicly accessible branch somewhere? I'd really like to have a second look at your latest changes.I've just pushed it here: https://github.com/acmorrow/mongo/commits/less-includes
This is different for "zero builds", where the user is interested in having the build system return as fast as possible. In this case all files are built already, so the actual compile commands don't contribute to the total time. Here it's okay to directly compare the results of "/usr/bin/time"....[...]One thing to note is that during all no-op rebuilds, it appears that only one core is ever used. Given that, I think the biggest gain we could get here would be if the -jN value allowed N threads to parallelize the dependency checking work. Most of my machine sits idle during a no-op rebuild.This isn't easy to change, it's a problem related to the Python GIL. It can't be circumvented unless you cut away basic parts of SCons' dependency checking...and then you can't use it anymore. ;)I'd like to understand this better.
Is this on a publicly accessible branch somewhere? I'd really like to have a second look at your latest changes.I've just pushed it here: https://github.com/acmorrow/mongo/commits/less-includesI had a first look at your changes, that got build times for a no-op update of "mongodb" down to 31 seconds (from 36s) for you. When calling "scons --dbg=on --tree=derived ./mongodb", I see that the target depends on 881 *.o files. But your patches insrc/mongo/db/fts/SConscriptsrc/mongo/db/sorter/SConscriptsrc/mongo/util/options_parser/SConscriptsrc/third_party/SConscriptsrc/third_party/s2/SConscriptsrc/third_party/v8-3.25/SConscriptsrc/third_party/v8/SConscriptaffects only 187 of those object files. So, from my angle following this strategy further appears to make sense (simple extrapolation: 36.0s - (881.0/187.0 * 5.0s) = 12.44s).
This isn't easy to change, it's a problem related to the Python GIL. It can't be circumvented unless you cut away basic parts of SCons' dependency checking...and then you can't use it anymore. ;)I'd like to understand this better.This would probably take reading several design documents/mail threads and also inspecting parts of the source code. If you really want to go down that road, please write to the SCons user mailing list. The core developers can then take you on a tour through the Taskmaster. ;)
Is this on a publicly accessible branch somewhere? I'd really like to have a second look at your latest changes.I've just pushed it here: https://github.com/acmorrow/mongo/commits/less-includesI had a first look at your changes, that got build times for a no-op update of "mongodb" down to 31 seconds (from 36s) for you. When calling "scons --dbg=on --tree=derived ./mongodb", I see that the target depends on 881 *.o files. But your patches insrc/mongo/db/fts/SConscriptsrc/mongo/db/sorter/SConscriptsrc/mongo/util/options_parser/SConscriptsrc/third_party/SConscriptsrc/third_party/s2/SConscriptsrc/third_party/v8-3.25/SConscriptsrc/third_party/v8/SConscriptaffects only 187 of those object files. So, from my angle following this strategy further appears to make sense (simple extrapolation: 36.0s - (881.0/187.0 * 5.0s) = 12.44s).I think I disagree with your assessment of how many .o builds were affected. Without my patch, the CPPPATH for every .o contains all of the include paths for all of the third party libraries. My patch reverses this, defaulting to a more or less empty CPPPATH, and adds items back on an as-needed basis.
/usr/bin/time scons --debug=time --dbg=on
...
scons: done building targets.
Total build time: 68.442516 seconds
Total SConscript file execution time: 7.191091 seconds
Total SCons execution time: 61.221189 seconds
Total command execution time: 0.030236 seconds
35.96user 2.91system 1:10.33elapsed 55%CPU (0avgtext+0avgdata 201360maxresident)k
5936416inputs+21048outputs (40major+71637minor)pagefaults 0swaps
Total build time: 65.365845 seconds
Total SConscript file execution time: 7.664901 seconds
Total SCons execution time: 57.687046 seconds
Total command execution time: 0.013898 seconds
31.08user 2.89system 1:07.31elapsed 50%CPU (0avgtext+0avgdata 198140maxresident)k
5993552inputs+27120outputs (47major+76141minor)pagefaults 0swaps
Total build time: 26.096024 seconds
Total SConscript file execution time: 5.535025 seconds
Total SCons execution time: 20.560151 seconds
Total command execution time: 0.000848 seconds
22.40user 0.76system 0:26.79elapsed 86%CPU (0avgtext+0avgdata 198112maxresident)k
53672inputs+27120outputs (11major+78172minor)pagefaults 0swaps
Total build time: 11.067789 seconds
Total SConscript file execution time: 3.529675 seconds
Total SCons execution time: 7.537188 seconds
Total command execution time: 0.000926 seconds
10.87user 0.42system 0:11.31elapsed 99%CPU (0avgtext+0avgdata 116648maxresident)k
0inputs+11648outputs (0major+53041minor)pagefaults 0swaps
Total build time: 7.829032 seconds
Total SConscript file execution time: 3.462231 seconds
Total SCons execution time: 4.365900 seconds
Total command execution time: 0.000901 seconds
7.74user 0.30system 0:08.06elapsed 99%CPU (0avgtext+0avgdata 113588maxresident)k
0inputs+11648outputs (0major+51085minor)pagefaults 0swaps
Based on your patch, I started some further experiments and profilings.
. In a next step, I trimmed this down even further by removing the third-party libraries (especially Boost, with its large number of intertwined headers) from CPPPATH as described in http://stackoverflow.com/questions/2441047/how-do-i-set-scons-system-include-path . New update times were
Total build time: 11.067789 seconds
Total SConscript file execution time: 3.529675 seconds
Total SCons execution time: 7.537188 seconds
Total command execution time: 0.000926 seconds
10.87user 0.42system 0:11.31elapsed 99%CPU (0avgtext+0avgdata 116648maxresident)k
0inputs+11648outputs (0major+53041minor)pagefaults 0swaps
and when adding the options "--max-drift=1 --implicit-deps-unchanged" this yields
Total build time: 7.829032 seconds
Total SConscript file execution time: 3.462231 seconds
Total SCons execution time: 4.365900 seconds
Total command execution time: 0.000901 seconds
7.74user 0.30system 0:08.06elapsed 99%CPU (0avgtext+0avgdata 113588maxresident)k
0inputs+11648outputs (0major+51085minor)pagefaults 0swaps
The remaining 4.3s for the build would be quite acceptable, I think. The 3.4s for reading all the SConscript files are mainly spent on running the Configure steps over and over again. This effort
could get reduced by adding some code that writes an options.py file with the detected values at the first call, and simply reads it back in following runs. Several projects are doing this successfully, see UserGuide ( http://www.scons.org/doc/production/HTML/scons-user.html ), sect. "Reading Build Variables From a File" .
The changes I listed above are the points where you could gain some speed...now it's up to you to decide where you want to lose some security. ;)Find attached the diff for removing the third-party libs from CPPPATH, and adding them to CXXFLAGS directly instead (Linux only).
On Mon, Jun 23, 2014 at 4:38 PM, <dl9...@darc.de> wrote:Based on your patch, I started some further experiments and profilings.Thanks! We do appreciate your help with this.
One major problem with your build is, that you seem to add the "-ggdb" option...even when compiling the release version. This leads to very large object and archive files (*.o/*.a) and means a lot of additional work when checking for changed contents. [...]
Unfortunately, this suggestion doesn't really help us. Quick re-build cycles are most important during the edit, compile, run, debug cycle - exactly when you need the debug info. Our release builds are never incremental so we don't care too much about startup time there.
[...]
I can confirm that this does speed things up. In some quick tests, by about 30%. I do have some reservations about it though, because we do sometimes commit changes to the files in third_party, and it would be unclear as a developer when I needed to handle that case as a result of a 'git pull'. We would definitely need a way to disable this feature for when people are actively working in the third_party directory. So we would need some sort of --third-party-dependency-checking=['loose', 'strict'] flag and then plumb that through to add either to CPPPATH or CXXFLAGS as appropriate.In addition, it introduces a portability nit, in that CPPPATH knows how to inject the correct compiler flag to add something to the search path, where CXXFLAGS doesn't.On the other hand, if this was guarded behind a flag, is that of any advantage over just saying --implicit-cache?
and when adding the options "--max-drift=1 --implicit-deps-unchanged" this yields
[...]
The remaining 4.3s for the build would be quite acceptable, I think. The 3.4s for reading all the SConscript files are mainly spent on running the Configure steps over and over again. This effortFor me at least, the second run prints '(cached)' for almost all configure checks, so I don't think much time is being spent on the configure step on rebuilds.
We've had, for a good while, a build flag --build-fast-and-loose which does the following:if has_option('build-fast-and-loose'):# See http://www.scons.org/wiki/GoFastButton for detailsenv.Decider('MD5-timestamp')env.SetOption('max_drift', 1)env.SourceCode('.', None)This does seem to accelerate things somewhat, but for whatever reason it doesn't seem to get much use in practice. Perhaps we should consider making it the default for non-release builds. I'd be interested in your thoughts on the real-world risks of the above settings for developer builds. We already forbid using it for release builds.
Overall, here is where things are for zero (a.k.a no-op) builds. Using the 'less-includes' branch (as is, using CPPPATH, not CXXFLAGS):
[...]
> scons --debug=time --dbg=on -j24 ./mongod --build-fast-and-loose --implicit-cacheTotal build time: 17.671432 secondsTotal SConscript file execution time: 4.205080 secondsTotal SCons execution time: 13.442400 secondsTotal command execution time: 0.023952 secondsThat is good progress from my initial starting point of around 35 seconds. Any thoughts on how to get insight into what that 13 seconds of SCons execution time is doing? With --build-fast-and-loose and --implicit-cache in play, I'd expect basically no MD5'ing or dependency scanning, so 13 seconds seems pretty high.