Chapter 2. Calculating CodeReady Workspaces resource requirements
Additional resources
This section describes how to calculate resources, such as memory and CPU, required to run Red Hat CodeReady Workspaces.
Both the CodeReady Workspaces central controller and user workspaces consist of a set of containers. Those containers contribute to the resources consumption in terms of CPU and RAM limits and requests.
2.1. Controller requirements
The Workspace Controller consists of a set of five services running in five distinct containers. The following table presents the default resource requirements of each of these services.
Pod | Container name | Default memory limit | Default memory request |
---|---|---|---|
CodeReady Workspaces Server and Dashboard | che | 1 GiB | 512 MiB |
PostgreSQL |
| 1 GiB | 512 MiB |
RH-SSO |
| 2 GiB | 512 MiB |
Devfile registry |
| 256 MiB | 16 MiB |
Plug-in registry |
| 256 MiB | 16 MiB |
These default values are sufficient when the CodeReady Workspaces Workspace Controller manages a small amount of CodeReady Workspaces workspaces. For larger deployments, increase the memory limit. See the https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.15/html-single/installation_guide/index#advanced-configuration-options-for-the-che-server-component.adoc article for instructions on how to override the default requests and limits. For example, the Eclipse Che hosted by Red Hat that runs on https://workspaces.openshift.com uses 1 GB of memory.
Additional resources
2.2. Workspaces requirements
This section describes how to calculate the resources required for a workspace. It is the sum of the resources required for each component of this workspace.
These examples demonstrate the necessity of a proper calculation:
- A workspace with ten active plug-ins requires more resources than the same workspace with fewer plug-ins.
- A standard Java workspace requires more resources than a standard Node.js workspace because running builds, tests, and application debugging requires more resources.
Procedure
-
Identify the workspace components explicitly specified in the
components
section of the https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.15/html-single/end-user_guide/index#authoring-devfiles-version-2.adoc. Identify the implicit workspace components:
-
CodeReady Workspaces implicitly loads the default
cheEditor
:che-theia
, and thechePlugin
that allows commands execution:che-machine-exec-plugin
. To change the default editor, add acheEditor
component section in the devfile. - The JWT Proxy component is responsible for the authentication and authorization of the external communications of the workspace components.
-
CodeReady Workspaces implicitly loads the default
Calculate the requirements for each component:
Default values:
The following table displays the default requirements for all workspace components, and the corresponding CodeReady Workspaces server properties. Use the CodeReady Workspaces server properties to modify the defaults cluster-wide.
Table 2.2. Default requirements of workspace components by type Component types CodeReady Workspaces server property Default memory limit Default memory request chePlugin
che.workspace.sidecar.default_memory_limit_mb
128 MiB
64 MiB
cheEditor
che.workspace.sidecar.default_memory_limit_mb
128 MiB
64 MiB
kubernetes
,openshift
,dockerimage
che.workspace.default_memory_limit_mb
,che.workspace.default_memory_request_mb
1 Gi
200 MiB
JWT Proxy
che.server.secure_exposer.jwtproxy.memory_limit
,che.server.secure_exposer.jwtproxy.memory_request
128 MiB
15 MiB
Custom requirements for
chePlugins
andcheEditors
components:Custom memory limit and request:
Define the
memoryLimit
andmemoryRequest
attributes of thecontainers
section of themeta.yaml
file to configure the memory limit of thechePlugins
orcheEditors
components. CodeReady Workspaces automatically sets the memory request to match the memory limit if it is not specified explicitly.Example 2.1. The
chePlugin
che-incubator/typescript/latest
meta.yaml
spec section:spec: containers: - image: docker.io/eclipse/che-remote-plugin-node:next name: vscode-typescript memoryLimit: 512Mi memoryRequest: 256Mi
This results in a container with the following memory limit and request:
Memory limit
512 MiB
Memory request
256 MiB
NoteFor IBM Power (ppc64le), the memory limit for some plugins has been increased by up to 1.5G to allow pods sufficient RAM to run. For example, on IBM Power (ppc64le), the Theia editor pod requires 2G; the OpenShift connector pod requires 2.5G. For AMD64 and Intel 64 (x86_64) and IBM Z (s390x), memory requirements remain lower at 512M and 1500M respectively. However, some devfiles may still be configured to set the lower limit valid for AMD64 and Intel 64 (x86_64) and IBM Z (s390x), so to work around this, edit devfiles for workspaces that are crashing to increase the default memoryLimit by at least 1 - 1.5 GB.
NoteHow to find the
meta.yaml
file ofchePlugin
Community plug-ins are available in the CodeReady Workspaces plug-ins registry repository in folder
v3/plugins/${organization}/${name}/${version}/
.For non-community or customized plug-ins, the
meta.yaml
files are available on the local OpenShift cluster at${pluginRegistryEndpoint}/v3/plugins/${organization}/${name}/${version}/meta.yaml
.Custom CPU limit and request:
CodeReady Workspaces does not set CPU limits and requests by default. However, it is possible to configure CPU limits for the
chePlugin
andcheEditor
types in themeta.yaml
file or in the devfile in the same way as it done for memory limits.Example 2.2. The
chePlugin
che-incubator/typescript/latest
meta.yaml
spec section:spec: containers: - image: docker.io/eclipse/che-remote-plugin-node:next name: vscode-typescript cpuLimit: 2000m cpuRequest: 500m
It results in a container with the following CPU limit and request:
CPU limit
2 cores
CPU request
0.5 cores
To set CPU limits and requests globally, use the following dedicated environment variables:
|
|
|
|
Note that the LimitRange
object of the OpenShift project may specify defaults for CPU limits and requests set by cluster administrators. To prevent start errors due to resources overrun, limits on application or workspace levels must comply with those settings.
Custom requirements for
dockerimage
componentsDefine the
memoryLimit
andmemoryRequest
attributes of the devfile to configure the memory limit of adockerimage
container. CodeReady Workspaces automatically sets the memory request to match the memory limit if it is not specified explicitly.- alias: maven type: dockerimage image: eclipse/maven-jdk8:latest memoryLimit: 1536M
Custom requirements for
kubernetes
oropenshift
components:The referenced manifest may define the memory requirements and limits.
- Add all previously calculated requirements.
Additional resources
2.3. A workspace example
This section describes a CodeReady Workspaces workspace example.
The following devfile defines the CodeReady Workspaces workspace:
apiVersion: 1.0.0 metadata: generateName: nodejs-configmap- projects: - name: nodejs-configmap source: location: "https://github.com/crw-samples/nodejs-configmap.git" branch: 12.x type: git components: - id: vscode/typescript-language-features/latest type: chePlugin - mountSources: true type: kubernetes entrypoints: - command: - sleep args: - infinity reference: 'https://raw.githubusercontent.com/crw-samples/nodejs-mongodb-sample/master/kubernetes-manifests/guestbook-app.deployment.yaml' alias: guestbook-frontend
This table provides the memory requirements for each workspace component:
Pod | Container name | Default memory limit | Default memory request |
---|---|---|---|
Workspace |
| 512 MiB | 512 MiB |
Workspace |
| 128 MiB | 32 MiB |
Workspace |
| 512 MiB | 512 MiB |
Workspace |
| 1 GiB | 512 MiB |
JWT Proxy | verifier | 128 MiB | 128 MiB |
Total | 2.25 GiB | 1.38 GiB |
-
The
theia-ide
andmachine-exec
components are implicitly added to the workspace, even when not included in the devfile. -
The resources required by
machine-exec
are the default forchePlugin
. -
The resources for
theia-ide
are specifically set in thecheEditor
meta.yaml
to 512 MiB asmemoryLimit
. -
The Typescript Visual Studio Code extension has also overridden the default memory limits. In its
meta.yaml
file, the limits are explicitly specified to 512 MiB. -
CodeReady Workspaces is applying the defaults for the
dockerimage
component type: a memory limit of 1 GiB and a memory request of 512 MiB. - The JWT container requires 128 MiB of memory.
Adding all together results in 1.38 GiB of memory requests with a 2.25 GiB limit.
Additional resources
- Chapter 1, Architecture overview
- https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.15/html-single/installation_guide/index#configuring-the-che-installation.adoc
- https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.15/html-single/installation_guide/index#advanced-configuration-options-for-the-che-server-component.adoc
- https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.15/html-single/end-user_guide/index#authoring-devfiles-version-2.adoc
- Section 12.1, “Authenticating users”
- CodeReady Workspaces plug-ins registry repository