Friday, July 30, 2010

Hard vs. Soft Partitioned Zones

A customer recently asked me to explain the difference between hard partitioning versus soft partitioning for Solaris zones.  The context of course was around software licensing because almost all Oracle software is sold and licensed according to the CPU count.  I directed the customer to the following two resources that define Oracle's stance software licensing as it applies to virtual contexts.


http://www.sun.com/third-party/global/oracle/consolidation/Containers_Oracle_041305.pdf


The bottom line is that if you use soft partitioning, you will have to pay for all CPU resources in the physical server regardless of the subset that you use for your software.  However, if you use hard partitioning, you only have to pay for the quantity of CPU resources actually used.

Solaris zones supports both partitioning methods.  Before getting into the difference between the two partitioning types, please see my blog post on CPU counting techniques for various UNIX operating systems.

Now back to the topic at hand.  What is the difference between hard partitioning versus soft partitioning as it relates to Solaris zones.  In general terms, a hard partition is a virtual context in which a physical CPU, CPU core or CPU thread is dedicated to a zone.  Once the CPU resource is assigned to the zone, no other zone can use that CPU resource.  Also, when you are logged into the zone, you can only see one CPU resource.

A soft partitioned zone on the other had can have a portion of one or more CPU resources assigned to a zone.  If you were to login to the zone, you would be able to see all available CPU resources.

Let's look at a couple examples using the Zone Manager to create zones and look at the CPU counts from within the zone.

Dedicated CPU Resource Constraint Method
In this example I create a hard partitioned zone by assigning a dedicated CPU ( -p 'dcpu|1) to it.  Then I look at its zone configuration to ensure that it has a single dedicated CPU assigned to it.  Then, I look at the CPU count from within the zone.

# zonemgr -a add -n zt -P password -p 'dcpu|1' -F                                                                            
Zone zt will be placed in the following directory: /zones/zt
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <7503> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1104> packages on the zone.
Initialized <1104> packages on zone.                                 
Zone is initialized.
The file contains a log of the zone installation.
Creating the sysidcfg file for automated zone configuration.
Booting zone for the first time.
Booting zone 'zt'
Waiting for first boot tasks to complete.
Waiting for automatic post-install reboot to complete
Generating ssh host keys.  Details in the (/root/.zonemgr/zone1204-ssh.log) file.
Zone zt is complete and ready to use.

# zonecfg -z zt info dedicated-cpu
dedicated-cpu:
ncpus: 1

# zlogin zt "psrinfo"
0 on-line   since 05/05/2010 01:06:09

Capped CPU Resource Constraint Method
In this example I create a hard partitioned zone by assigning a capped CPU ( -p 'cpu|1) to it.  Then I look at its zone configuration to ensure that it has a single capped CPU assigned to it.  Then, I look at the CPU count from within the zone.

# zonemgr -a add -n zt -P password -p 'cpu|1' -F 
Zone zt will be placed in the following directory: /zones/zt
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <7503> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1104> packages on the zone.
Initialized <1104> packages on zone.                                 
Zone is initialized.
The file contains a log of the zone installation.
Creating the sysidcfg file for automated zone configuration.
Booting zone for the first time.
Booting zone 'zt'
Waiting for first boot tasks to complete.
Waiting for automatic post-install reboot to complete
Generating ssh host keys.  Details in the (/root/.zonemgr/zone7258-ssh.log) file.

# zonecfg -z zt info capped-cpu                                               
capped-cpu:
[ncpus: 1.00]

# zlogin zt "psrinfo"
0 on-line   since 05/05/2010 01:06:09
1 on-line   since 05/05/2010 01:06:20
2 on-line   since 05/05/2010 01:06:20
3 on-line   since 05/05/2010 01:06:22
4 on-line   since 05/05/2010 01:06:24
5 on-line   since 05/05/2010 01:06:26
6 on-line   since 05/05/2010 01:06:28
7 on-line   since 05/05/2010 01:06:30

Now that you understand the fundamental difference between the two partitioning types, perhaps you would like to know how to assign a dedicated CPU count to an existing zone.  That too is very easy with the Zone Manager.  The following example assigns 3 dedicated CPU resources to the zone named "myzone".


# zonemgr -a modify -n myzone -p 'dcpu|3' -F

Note that this assignment isn't adding 3 additional CPU resources to whatever amount that it previously had.  It is designating that total number of CPU resources assigned to the zone is just 3.

To learn more about how to use the Zone Manager, go through the Zone Manager University blog post series.  You can download the Zone Manager by clicking here to try it out for yourself.

That is it for this blog post.

Have a great day!


Brad

No comments: