From c8ef006ed79c32c77a5b3c244af74366815e6463 Mon Sep 17 00:00:00 2001 From: ajay2012 <97219541+ajay2012@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:11:39 +0530 Subject: [PATCH 1/5] Create openstack-nova-cpu-allocation-ratio-guide.md --- ...enstack-nova-cpu-allocation-ratio-guide.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 docs/openstack-nova-cpu-allocation-ratio-guide.md diff --git a/docs/openstack-nova-cpu-allocation-ratio-guide.md b/docs/openstack-nova-cpu-allocation-ratio-guide.md new file mode 100644 index 00000000..b1e75eaa --- /dev/null +++ b/docs/openstack-nova-cpu-allocation-ratio-guide.md @@ -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. + +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. From 5a356f6db83483db4681a37cf0dab0c4602d57b0 Mon Sep 17 00:00:00 2001 From: ajay2012 <97219541+ajay2012@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:15:09 +0530 Subject: [PATCH 2/5] Update mkdocs.yml --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index d553449c..7ae2a84e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 From 92403c74d3bcfdd79e60f7b601a40ee87d2f8c18 Mon Sep 17 00:00:00 2001 From: ajay2012 <97219541+ajay2012@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:15:39 +0530 Subject: [PATCH 3/5] Rename openstack-nova-cpu-allocation-ratio-guide.md to openstack-cpu-allocation-ratio.md --- ...llocation-ratio-guide.md => openstack-cpu-allocation-ratio.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{openstack-nova-cpu-allocation-ratio-guide.md => openstack-cpu-allocation-ratio.md} (100%) diff --git a/docs/openstack-nova-cpu-allocation-ratio-guide.md b/docs/openstack-cpu-allocation-ratio.md similarity index 100% rename from docs/openstack-nova-cpu-allocation-ratio-guide.md rename to docs/openstack-cpu-allocation-ratio.md From 27746fcd83a43398f2b48fb36f7495dfaababbc9 Mon Sep 17 00:00:00 2001 From: ajay2012 <97219541+ajay2012@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:17:20 +0530 Subject: [PATCH 4/5] Update nova-helm-overrides.yaml --- helm-configs/nova/nova-helm-overrides.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-configs/nova/nova-helm-overrides.yaml b/helm-configs/nova/nova-helm-overrides.yaml index d6923c6c..450a8a9d 100644 --- a/helm-configs/nova/nova-helm-overrides.yaml +++ b/helm-configs/nova/nova-helm-overrides.yaml @@ -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 From 32b50237580c2de3d6a2c8f10776f8389fa81119 Mon Sep 17 00:00:00 2001 From: ajay2012 <97219541+ajay2012@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:18:27 +0530 Subject: [PATCH 5/5] Update openstack-cpu-allocation-ratio.md --- docs/openstack-cpu-allocation-ratio.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/openstack-cpu-allocation-ratio.md b/docs/openstack-cpu-allocation-ratio.md index b1e75eaa..f6fe43b0 100644 --- a/docs/openstack-cpu-allocation-ratio.md +++ b/docs/openstack-cpu-allocation-ratio.md @@ -6,7 +6,7 @@ By default openstack helm provide cpu allocation of 3:1. For a production deploy 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. +5. Growth and Scalability: Consider future growth and scalability needs when setting CPU allocation ratios. Allocating too liberally may result in wasted resources while allocating too conservatively may lead to resource shortage as the deployment scale. Lets consider below two use case to calculate CPU allocation for our deployment with HPE DL380 Server.