Instance caging in Oracle 11g

Consolidation is very popular word today to save costs:
  • buy one huge server with a lot of CPU, memory, huge storage, fast network
  • put as many as possible databases on it
  • utilize it as efficient as possible
But consolidation brings problem how to share resources between databases:
  • CPU (this article is related only to this resource)
  • storage
  • memory
  • network

As default an Oracle database can see/use all CPUs on a host. In 11.2G there is new option called “Instance Caging” which enables to limit number of CPUs which can be seen/used by a database.

Enabling Instance Caging

1. Manually set dynamic parameter cpu_count on instance level. As default this parameter is set to maximum number of cpu available on a hosts.

alter system set cpu_count=2;

2. Enable any resource manager plan that manages CPU. Most easy is to turn on default Oracle plan DEFAULT_PLAN.

alter system set resource_manager_plan=DEFAULT_PLAN;

Monitoring Instance Caging

Checking if Instance Caging is enabled

1.Ccheck if cpu_count is set

select value from v$parameter 
where name = 'cpu_count' 
  and (isdefault ='FALSE' or ismodified != 'FALSE');

2. Check if Resource Manager is on and managing CPU

select name from v$rsrc_plan 
where is_top_plan = 'TRUE' 
  and cpu_managed ='ON';

Provisioning CPU

There are generally 2 ways to distribute your CPU between databases

Partitioning – sum of all CPUs assigned to all your databases equals number of CPUs on a host. Databases don’t interfere with each other.

Over-provisioning – sum of all CPUs assigned to all your databases is higher that number of CPUs on a host. Databases can impact on each other performance.

Partitioning is recommended on production hosts

Over provisioning is recommended on less critical systems like development

Important note – Instance caging hasn’t got any impact on licensing model. You still need to pay for all CPUs on a host which is available for Oracle software.

Alternatives to Instance Caging

Alternative methods to control CPU usage are:

Hard partitioning – partition your hardware on many separate boxes. Install databases on separate boxes. Requires advanced hardware to be used – supported on Solaris, AIX, HP-unix. Disadvantages high costs, dedicated vendor, complex to managed.

O/S Workload Managers – many operating system delivers own software to manage CPU usage and other resources like AIX Workload Manager, the HP-UX Workload Manager, and the Solaris Resource. Disadvantages you need to learn of them, each can work different per O/S, not available on all platforms.

Virtualization – additional layer to partition hardware using software level. Disadvantage too complex versus Instance Caging and lose IO performance for databases.

Have a fun 🙂

Tomasz

2 thoughts on “Instance caging in Oracle 11g

  1. Hi,
    I have a question. Suppose if we have 8 CPUs on server and we assign 2 CPUs to a database. Now, will other processes on server be able to use these 2 CPUs or will these be dedicated to database only? FYI, we are using ODA and we want to use cpu caging in it.

    Thanks!

    • Hi

      It’s not dedicated allocation. In your case maximum 25%(2/8) of all overall power can be used by the database.

      For example your database can allocate power of any CPU in following way:

      50% * CPU1 + 50% * CPU2 + 75% * CPU 7 + 25% *CPU8 = 2 CPU

      or

      50% * CPU1 + 50% * CPU4 + 100% * CPU5 = 2 CPU

      Always maximum 2 CPUs.

      In real scenario Oracle will consume 2 CPU + some extra CPU for background processes. Background processes are usually using very minor CPU. Please check Oracle help for details.

      But still your maximum is not guaranteed. Heavy OS processes can still kill your database.

      Regards
      Tomasz

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.