Chapter 9. Adjusting System Resource Usage of the MBaaS and Cloud Apps
9.1. Overview
In the RHMAP 4.x MBaaS based on OpenShift 3, each Cloud App and and each MBaaS component runs in its own container. This architecture allows for granular control of CPU and memory consumption. A fine level of control of system resources helps to ensure efficient use of nodes, and to guarantee uninterrupted operation of critical services.
An application can be prepared for various situations, such as high peak load or sustained load, by making decisions about the resource limits of individual components. For example, you could decide that MongoDB must keep working at all times, and assign it high, guaranteed amount of resources. At the same time, if the availability of a front-end Node.js server is less critical, the server can be assigned less initial resources, with the possibility to use more resources when available.
9.2. Prerequisites
The system resources of MBaaS components and Cloud Apps in the MBaaS can be regulated using the mechanisms available in OpenShift – resource requests, limits, and quota. Before proceeding with the instructions in this guide, we advise you to read the Quotas and Limit Ranges section in the OpenShift documentation.
9.3. Adjusting Resource Usage of the MBaaS
The RHMAP MBaaS is composed of several components, each represented by a single container running in its own pod. Each container has default resource requests and limits assigned in the MBaaS OpenShift template. See the section Overview of Resource Usage of MBaaS Components for a complete reference of the default values.
Depending on the deployment model of the MBaaS, you may have to adjust the resource limits and requests to fit your environment. If the MBaaS components are deployed on the same nodes as the Cloud Apps, there is no adjustment required.
However, when the MBaaS components are deployed on nodes dedicated to running the MBaaS only, it is strongly recommended to adjust the resource limits to take full advantage of the available resources on the dedicated nodes.
9.3.1. Calculating the Appropriate Resource Requests and Limits
This section refers to CPU resources in two different terms – the commonly used term vCPU (virtual CPU), and the term millicores used in OpenShift documentation. The unit of 1 vCPU is equal to 1000 m (millicores), which is equivalent to 100% of the time of one CPU core.
The resource limits must be set accordingly for your environment and depend on the characteristics of load on your Cloud Apps. However, the following rules can be used as a starting point for adjustments of resource limits:
- Allow 2 GiB of RAM and 1 vCPU for the underlying operating system.
- Split the remainder of resources in equal parts amongst the MBaaS Components.
9.3.1.1. Example
Given a virtual machine with 16 GiB of RAM and 4 vCPUs, we allow 2 GiB of RAM and 1 vCPU for the operating system. This leaves 14GB RAM and 3 vCPUs (equal to 3000 m) to distribute amongst the 5 MBaaS components.
14 GiB / 5 = 2.8 GiB of RAM per component
3000 m / 5 = 600 m per component
In this example, the resource limit for each MBaaS component would be 2.8 GiB of RAM and 600 millicores of CPU. Depending on the desired level of quality of service of each component, set the resource request values as described in the section Quality of service tiers in the OpenShift documentation.
9.3.2. Overview of Resource Usage of MBaaS Components
The following table lists the components of the MBaaS, their idle resource usage, default resource request, and default resource limit.
| MBaaS component | Idle RAM usage | RAM request | RAM limit | Idle CPU usage | CPU request | CPU limit |
|---|---|---|---|---|---|---|
| fh-mbaas | 160 MiB | 200 MiB | 800 MiB | <1% | 200 m | 800 m |
| fh-messaging | 160 MiB | 200 MiB | 400 MiB | <1% | 200 m | 400 m |
| fh-metrics | 120 MiB | 200 MiB | 400 MiB | <1% | 200 m | 400 m |
| fh-statsd | 75 MiB | 200 MiB | 400 MiB | <1% | 200 m | 400 m |
| mongodb | 185 MiB | 200 MiB | 1000 MiB | <1% | 200 m | 1000 m |
9.4. Adjusting Resource Usage of Cloud Apps
The resource requests and limits of Cloud Apps can be set the same way as for MBaaS components. There is no particular guideline for doing the adjustment in Cloud Apps.
9.4.1. Overview of Resource Usage of Cloud App Components
| Cloud App component | Idle RAM usage | RAM request | RAM limit | Idle CPU usage | CPU request | CPU limit |
|---|---|---|---|---|---|---|
| nodejs-frontend | 125 MiB | 90 MiB | 250 MiB | <1% | 100 m | 500 m |
| redis | 8 MiB | 100 MiB | 500 MiB | <1% | 100 m | 500 m |
9.5. Setting Resource Requests and Limits
The procedure for setting the resource requests and limits is the same for both MBaaS components and Cloud App components.
Identify the name of the deployment configuration.
- MBaaS components: Names of deployment configurations match the names of components listed in the table in Section 9.3.2, “Overview of Resource Usage of MBaaS Components”.
- Cloud apps: Find the OpenShift project for your RHMAP environment and edit the deployment configuration for your app in there.
Open the editor for the deployment configuration, for example
fh-mbaas:oc edit dc fh-mbaas
Edit the
requestsandlimits.The DeploymentConfig contains two
resourcessections with equivalent values: one in thespec.strategysection, and another in thespec.template.spec.containerssection. Set thecpuandmemoryvalues ofrequestsandlimitsas necessary, making sure the values stay equivalent between the two sections, and save the file.apiVersion: v1 kind: DeploymentConfig metadata: name: fh-mbaas ... spec: ... strategy: resources: limits: cpu: 800m memory: 800Mi requests: cpu: 200m memory: 200Mi ... spec: containers: ... resources: limits: cpu: 800m memory: 800Mi requests: cpu: 200m memory: 200MiNoteChanging the deployment configuration triggers a new deployment. Once the deployment is complete, the resource limits are updated.
For more information on resources, see Deployment Resources in the OpenShift documentation.
9.6. Using Cluster Metrics to Visualize Resource Consumption
It is possible to view the immediate and historical resource usage of pods and containers in the form of donut charts and line charts using the Cluster Metrics deployment in OpenShift. Refer to Enabling Cluster Metrics in the OpenShift documentation for steps to enable cluster metrics.
Once cluster metrics are enabled, in the OpenShift web console, navigate to Browse > Pods and click on the component of interest. Click on the Metrics tab to see the visualizations.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.