:_mod-docs-content-type: ASSEMBLY
include::_attributes/common-attributes.adoc[]
[id="configuring-performance-and-scalability"]
= Configuring performance and scalability for core platform monitoring
:context: configuring-performance-and-scalability

toc::[]

You can configure the monitoring stack to optimize the performance and scale of your clusters. The following documentation provides information about how to distribute the monitoring components and control the impact of the monitoring stack on CPU and memory resources.

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/about-ocp-monitoring/key-concepts.adoc#about-performance-and-scalability_key-concepts[About performance and scalability]

[id="controlling-placement-and-distribution-of-monitoing-components_{context}"]
== Controlling the placement and distribution of monitoring components

You can move the monitoring stack components to specific nodes:

* Use the `nodeSelector` constraint with labeled nodes to move any of the monitoring stack components to specific nodes.
* Assign tolerations to enable moving components to tainted nodes.

By doing so, you control the placement and distribution of the monitoring components across a cluster.

By controlling placement and distribution of monitoring components, you can optimize system resource use, improve performance, and separate workloads based on specific requirements or policies.

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/about-ocp-monitoring/key-concepts.adoc#using-node-selectors-to-move-monitoring-components_key-concepts[Using node selectors to move monitoring components]

include::modules/monitoring-moving-monitoring-components-to-different-nodes.adoc[leveloffset=+2,tags=**;CPM;!UWM]

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/configuring-core-platform-monitoring/preparing-to-configure-the-monitoring-stack.adoc#preparing-to-configure-the-monitoring-stack[Preparing to configure core platform monitoring stack]
* xref:../../../nodes/nodes/nodes-nodes-working.adoc#nodes-nodes-working-updating_nodes-nodes-working[Understanding how to update labels on nodes]
* xref:../../../nodes/scheduling/nodes-scheduler-node-selectors.adoc#nodes-scheduler-node-selectors[Placing pods on specific nodes using node selectors]
* link:https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector[`nodeSelector` (Kubernetes documentation)]

include::modules/monitoring-assigning-tolerations-to-monitoring-components.adoc[leveloffset=+2,tags=**;CPM;!UWM]

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/configuring-core-platform-monitoring/preparing-to-configure-the-monitoring-stack.adoc#preparing-to-configure-the-monitoring-stack[Preparing to configure core platform monitoring stack]
ifndef::openshift-rosa-hcp[]
* xref:../../../nodes/scheduling/nodes-scheduler-taints-tolerations.adoc#nodes-scheduler-taints-tolerations[Controlling pod placement using node taints]
endif::openshift-rosa-hcp[]
* link:https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/[Taints and tolerations (Kubernetes documentation)]

// Setting the body size limit for metrics scraping
include::modules/monitoring-setting-the-body-size-limit-for-metrics-scraping.adoc[leveloffset=+1]

[role="_additional-resources"]
.Additional resources

* link:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config[`scrape_config` (Prometheus documentation)]

[id="managing-cpu-and-memory-resources-for-monitoring-components_{context}"]
== Managing CPU and memory resources for monitoring components

You can ensure that the containers that run monitoring components have enough CPU and memory resources by specifying values for resource limits and requests for those components.

You can configure these limits and requests for core platform monitoring components in the `openshift-monitoring` namespace.

include::modules/monitoring-specifying-limits-and-requests-for-monitoring-components.adoc[leveloffset=+2,tags=**;CPM;!UWM]

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/about-ocp-monitoring/key-concepts.adoc#about-specifying-limits-and-requests-for-monitoring-components_key-concepts[About specifying limits and requests]
* link:https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits[Requests and limits (Kubernetes documentation)]

// Choosing a metrics collection profile
include::modules/monitoring-choosing-a-metrics-collection-profile.adoc[leveloffset=+1]

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/about-ocp-monitoring/key-concepts.adoc#configuring-metrics-collection-profiles_key-concepts[About metrics collection profiles]
* xref:../../../observability/monitoring/accessing-metrics/accessing-metrics-as-an-administrator.adoc#viewing-a-list-of-available-metrics_accessing-metrics-as-an-administrator[Viewing a list of available metrics]
ifndef::openshift-rosa-hcp[]
* xref:../../../nodes/clusters/nodes-cluster-enabling-features.adoc#nodes-cluster-enabling[Enabling features using feature gates]
endif::openshift-rosa-hcp[]

//Configuring pod topology spread constraints for core platform monitoring
include::modules/monitoring-configuring-pod-topology-spread-constraints.adoc[leveloffset=+1,tags=**;CPM;!UWM]

[role="_additional-resources"]
.Additional resources

* xref:../../../observability/monitoring/about-ocp-monitoring/key-concepts.adoc#using-pod-topology-spread-constraints-for-monitoring_key-concepts[About pod topology spread constraints for monitoring]
* xref:../../../nodes/scheduling/nodes-scheduler-pod-topology-spread-constraints.adoc#nodes-scheduler-pod-topology-spread-constraints-about[Controlling pod placement by using pod topology spread constraints]
* link:https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/[Pod topology spread constraints (Kubernetes documentation)]
