Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nova cpu allocation ratio.md #160

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions docs/openstack-cpu-allocation-ratio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Nova CPU allocation Guide

By default openstack helm provide cpu allocation of 3:1. For a production deployment, cpu allocation ratio need to be decided based on multiple factors like:

1. Workload type: Different workloads have different CPU utilization patterens. For example, web servers might have bursty utilization, while database might have more consistent.
2. Peformance Requirments: Consider the performace requirment of the workloads. Some applications may require dedicated CPU resource to meet required performace SLA, whereas other can share resources.
3. Overhead: Account for the overhead introduced by the operating system, hypervidor and virtulization layer. Sometime compute node are used as hyperconserved nodes as well. This can impact the effective allocation ratio.
4. Peak vs Average Usage: Determin whether to set allocation ratios based on peak or average CPU usage. Peak usages ensure there are enough resources available durig period of high demand, but it may result in underutilization during off-peak hours.
5. Growth and Scalability: Consider futur growth and scalability needs when setting CPU allocation ratios. Allocating too liberally may result in wated resources while allocating too conservatively may lead to resource shortage as the deployment scale.
ajay2012 marked this conversation as resolved.
Show resolved Hide resolved

Lets consider below two use case to calculate CPU allocation for our deployment with HPE DL380 Server.

### Case 1: CPU allocation ratio for shared CPU

Workload type: Considering a flavor with 8 vCPU for workload which will meet its peak demand and required performace.

Max VM per host: Considering max of 60 VM of such flavor can be hosted on a single hypervisor as per our scaling/growth forcast.

CPUs on hypervisor: HPE DL380 have 72 PCPU.


Example :
``` shell
Total physical CPU (PCPU) = 72
No. of vCPU per flavor (VCPU) = 8
No. of Instance per hypervisor (VM) = 60
Overhead on CPU (OCPU) = 8
Formula to calculate CPU allocation ratio:

CAR = VM * VCPU / (PCPU - OPCU)
CAR = 60 * 8 / (72 - 8)
= 480/64
= ~8
```
So here we get approx CPU allocation ratio of 8.1.

### Case 2: Shared workload with CPU pining:

There may be requirement to run CPU pinned VM along with floating instances (shared cpus). In such case CPU allocation for compute node will be different from rest of nodes. Lets see how to get cpu allocation for such type of compute nodes:

Example :
``` shell
No. of CPU dedicated for CPU pinning (RCPUP) : 16
CPU allocation ratio:

CAR = VM * VCPU / (PCPU - RCPUP - OCPU)
CAR = 60 * 8 / (72 - 16 - 8)
= 480/48
= 10
```
So, here cpu allocation will be 10.1 on host hosting cpu pinned instances and floating instances.

Please note , above is an example only. For your use case it is required to considering flavor's CPU specifications based on application benchmark requirments, its peak utilization and scaling needs of future.
2 changes: 1 addition & 1 deletion helm-configs/nova/nova-helm-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ conf:
default_ephemeral_format: ext4
ram_allocation_ratio: 1.0
disk_allocation_ratio: 1.0
cpu_allocation_ratio: 3.0
cpu_allocation_ratio: 8.0
state_path: /var/lib/nova
osapi_compute_listen: 0.0.0.0
# NOTE(portdirect): the bind port should not be defined, and is manipulated
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ nav:
- Generating Clouds YAML: openstack-clouds.md
- Keystone Federation to Rackspace: openstack-keystone-federation.md
- Nova Flavor Creation: openstack-flavors.md
- Nova CPU Allocation Ratio: openstack-cpu-allocation-ratio.md
- Creating Networks: openstack-neutron-networks.md
- Glance Images Creation: openstack-glance-images.md
- Building Local Images: build-local-images.md
Expand Down