Faster zone provisioning using zoneadm clone

In a recent thread on zones-discuss@opensolaris.org about creating zones in parallel to reduce the time it takes to provision multiple zones, it was suggested that the new zoneadm clone subcommand could be of help. The zoneadm clone subcommand (available from build 33 onwards) copies an installed and configured zone. Cloning a zone is faster than installing a zone, but how much faster? To find out I did some quick experiments creating and cloning both whole root and sparse root zones on a V480:

Creating a whole root zone:

# zonecfg -z zone1
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create -b
zonecfg:zone1> set zonepath=/zones/zone1
zonecfg:zone1> exit
# time zoneadm -z zone1 install
time zoneadm -z zone1 install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <123834> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <986> packages on the zone.
Initialized <986> packages on zone.
Zone  is initialized.
Installation of these packages generated errors: 
The file  contains a log of the zone installation.

real    13m40.647s
user    2m49.840s
sys     4m43.221s

Cloning a whole root zone:

# zonecfg -z zone1 export|sed -e 's/zone1/zone2/'|zonecfg -z zone2
zone2: No such zone configured
Use 'create' to begin configuring a new zone.
# time zoneadm -z zone2 clone zone1
Cloning zonepath /zones/zone1...

real    8m4.615s
user    0m9.780s
sys     2m18.334s

For the whole root zone cloning is almost twice a fast as a regular install.

Creating a sparse root zone:

# zonecfg -z zone3
zone3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone3> create
zonecfg:zone3> set zonepath=/zones/zone3
zonecfg:zone3> exit
# time zoneadm -z zone3 install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <2535> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <986> packages on the zone.
Initialized <986> packages on zone.
Zone  is initialized.
Installation of these packages generated errors: 
The file  contains a log of the zone installation.

real    6m3.227s
user    1m45.902s
sys     2m47.717s

Cloning a sparse root zone:

# zonecfg -z zone3 export|sed -e 's/zone3/zone4/'|zonecfg -z zone4
zone4: No such zone configured
Use 'create' to begin configuring a new zone.
# time zoneadm -z zone4 clone zone3
Cloning zonepath /zones/zone3...

real    0m11.535s
user    0m0.706s
sys     0m6.440s

For the sparse root zone, cloning is more than thirty times faster then installing!

So if you need to provision multiple zones of a certain configuration, zoneadm clone is clearly the way to go.

Note that the current clone operation does not (yet) take advantage of ZFS. To see what ZFS can do for zone cloning, have a look at Mike Gerdts' blog: Zone created in 0.922 seconds. Goodness indeed.

T:

Comments:

What's even cooler about "zoneadm clone" is that subsequent clones are even faster since the file data is in the buffer cache. So rolling off a bunch of clones at one time is a great deal faster than installing a bunch of similar zones in serial or in parallel.

Posted by David Comay on March 18, 2006 at 03:39 PM CET #

Please take my order:
I'll take two ZFS sparse zones with the "zoneadm clone" option, please. :)
Oh -- can I follow that with a non-sparse ZFS zoneadm clone please?
Thank you very much. :)

Does anyone else remember how long it took to load Interactive Unix on a Compaq 386 machine from approx. 27 floppy disks!.
Boy - what I could have done with those man-hours.....

Posted by Al Hopper on March 18, 2006 at 05:42 PM CET #

What is the time when you create a zone, delete the zone and recreate it right again. It's probably as fast as the clone command (most pages are still in memory on the second install command in both cases )

Posted by Jerome on May 16, 2006 at 09:08 AM CEST #

Jerome,

Creating, deleting and then recreating a zone is not as fast as a 'clone'. Recreating the zone is a normal 'install' (i.e. pkgadd all the packages), while a 'clone' is simply a cpio of an existing zone (slightly simplified, of course). The impact of the pkgadd far outweighs the advantage you get of having the files cached:

# zonecfg -z zone3
zone3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone3> create
zonecfg:zone3> set zonepath=/zones/zone3
zonecfg:zone3> exit
# time zoneadm -z zone3 install
[snip]

real    14m26.032s
user    2m29.789s
sys     6m45.616s
# zoneadm -z zone3 uninstall
# time zoneadm -z zone3 install
[snip]

real    14m1.617s
user    2m27.596s
sys     6m38.849s

# zonecfg -z zone3 export|sed -e 's/zone3/zone4/'|zonecfg -z zone4
zone4: No such zone configured
Use 'create' to begin configuring a new zone.
# time zoneadm -z zone4 clone zone3
Cloning zonepath /zones/zone3...

real    0m55.245s
user    0m1.496s
sys     0m11.002s
The caching of the files saves you about 30 seconds of the 14 minutes on the 'install', the 'clone' only takes 55 seconds in total....

Posted by guest on May 17, 2006 at 04:23 AM CEST #

Post a Comment:
Comments are closed for this entry.
About

menno

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News

No bookmarks in folder

Blogroll

No bookmarks in folder