Merge lp://staging/~niemeyer/juju-core/even-faster-bootstrap into lp://staging/~juju/juju-core/trunk

Proposed by Gustavo Niemeyer
Status: Merged
Merged at revision: 582
Proposed branch: lp://staging/~niemeyer/juju-core/even-faster-bootstrap
Merge into: lp://staging/~juju/juju-core/trunk
Diff against target: 18 lines (+7/-1)
1 file modified
environs/cloudinit/cloudinit.go (+7/-1)
To merge this branch: bzr merge lp://staging/~niemeyer/juju-core/even-faster-bootstrap
Reviewer Review Type Date Requested Status
The Go Language Gophers Pending
Review via email: mp+126524@code.staging.launchpad.net

Description of the change

environs/cloudinit: prealloc smaller journal files

Prealloc 1M journal files upfront, to prevent mongo from doing
that and allocating 100M+ files which take a while to be created.

Let's keep an eye on the effects this will have in practice in
the form of slow-downs while the database itself has to allocate
the next file.

https://codereview.appspot.com/6569060/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Reviewers: mp+126524_code.launchpad.net,

Message:
Please take a look.

Description:
environs/cloudinit: prealloc smaller journal files

Prealloc 1M journal files upfront, to prevent mongo from doing
that and allocating 100M+ files which take a while to be created.

Let's keep an eye on the effects this will have in practice in
the form of slow-downs while the database itself has to allocate
the next file.

https://code.launchpad.net/~niemeyer/juju-core/even-faster-bootstrap/+merge/126524

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6569060/

Affected files:
   A [revision details]
   M environs/cloudinit/cloudinit.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: environs/cloudinit/cloudinit.go
=== modified file 'environs/cloudinit/cloudinit.go'
--- environs/cloudinit/cloudinit.go 2012-09-24 21:10:48 +0000
+++ environs/cloudinit/cloudinit.go 2012-09-26 18:18:08 +0000
@@ -184,7 +184,13 @@
  }

  func addMongoToBoot(c *cloudinit.Config) error {
- addScripts(c, fmt.Sprintf("mkdir -p /var/lib/juju/db"))
+ addScripts(c,
+ "mkdir -p /var/lib/juju/db/journal",
+ // Otherwise we get three files with 100M+ each, which takes time.
+ "dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc.0",
+ "dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc.1",
+ "dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc.2",
+ )
   svc := upstart.NewService("juju-db")
   conf := &upstart.Conf{
    Service: *svc,

Revision history for this message
William Reade (fwereade) wrote :

I understand the intent, but I have to take on trust the idea that the
magic invocations actually make things faster. Assuming that to be the
case, LGTM.

https://codereview.appspot.com/6569060/

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

*** Submitted:

environs/cloudinit: prealloc smaller journal files

Prealloc 1M journal files upfront, to prevent mongo from doing
that and allocating 100M+ files which take a while to be created.

Let's keep an eye on the effects this will have in practice in
the form of slow-downs while the database itself has to allocate
the next file.

R=fwereade
CC=
https://codereview.appspot.com/6569060

https://codereview.appspot.com/6569060/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches