-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.4.4, 2.6.0-rc1
-
Component/s: Index Maintenance
-
None
-
ALL
-
Ostensibly, a main reason for separate foreground/background builds is that foreground index builds are faster, at the cost of blocking the server [1]. However, we have observed both in production and in synthetic benchmarks, that foreground index builds are often much slower on large collections.
In a synthetic benchmark, building a trivial index on a collection with about 6M records, each about 1k large, I saw the following numbers:
[2014-03-21 00:05:10,042 22310|INFO] Done. items=6250000 fg=145.1 bg=94.7 [2014-03-21 00:09:01,545 22310|INFO] Done. items=6250000 fg=135.7 bg=95.4 [2014-03-21 00:12:43,822 22310|INFO] Done. items=6250000 fg=125.1 bg=96.9 [2014-03-21 00:16:25,450 22310|INFO] Done. items=6250000 fg=125.6 bg=95.8 [2014-03-21 00:20:00,567 22310|INFO] Done. items=6250000 fg=122.5 bg=92.3
The "fg=" number is seconds to build an index in the foreground, and "bg=" is for a background build. The requested indexes are identical, and are dropped each time.
I don't have hard numbers right now, but experience in production suggests that the difference only gets worse as the collection gets even bigger.
[1] http://docs.mongodb.org/manual/tutorial/build-indexes-in-the-background/