When you sign up to use CodeReady Toolchain, you get an OpenShift Online account with enough resources to run a basic application. Your OpenShift Online Starter account includes two pods and therefore can accommodate two workspaces in CodeReady Toolchain. This document guides you on how you can optimize your resource usage within CodeReady Toolchain.

Optimizing CodeReady Toolchain resource usage

After creating your first quickstart project, you will now learn to optimize your memory usage in CodeReady Toolchain using the following steps:

  1. Review the resource usage details for your project.

  2. Reduce your quickstart project’s memory usage and commit the changes.

  3. Compare the change in your OpenShift Online memory quota usage.

1. Reviewing detailed resource information in OpenShift Online

The memory allowances for each OpenShift pod is 512 MiB. As a result, each application consumes nearly 1 GiB of memory for the Stage and Run environments.

To check your resource information details in OpenShift:

  1. In a new browser tab, navigate to the OpenShift Online console at console.starter-us-east-2.openshift.com.

  2. From the list of projects at the right side of the page, click username-run to see the resources used for the Run environment or username-stage to see the resources for the Stage environment.

    Select the Run Project

    See Viewing projects in OpenShift Online for details about the listed projects.

  3. Click Applications and then select Pods in the displayed submenu.

    Application Pods
  4. The Pods page lists your Hello World project pod. Click the project name to see the resource information for the project.

    Hello World Project Pod
  5. The Details page lists the Status of the pod and the container resource information:


    Use this page to review the memory usage for your CodeReady Toolchain project. Note this information and leave this tab open to compare the resource information after optimizing your memory usage.

Save the details to compare after following the steps in Reducing project memory usage.

2. Reducing project memory usage

Optimizing memory usage is important when using the Free Tier of OpenShift Online because this tier provides limited memory. Also, each additional project in CodeReady Toolchain requires an additional share of your OpenShift Online resources.

You can optimize your new quickstart to use less memory as follows:

  1. Return to your CodeReady Toolchain workspace tab. If you need to reopen the workspace:

    1. In your CodeReady Toolchain browser tab, click Create and then Codebases.

    2. Ensure that the workspace is selected in the drop-down list and click Open to run your workspace.

      Reopen workspace
  2. In the workspace file explorer panel, double-click your project and navigate to src > main > fabric8.

    Fabric8 folder
  3. Right-click the fabric8 folder and select New  File.

  4. Name the new file deployment.yml and click OK. The new file displays in the editor.

  5. Copy the contents of the following file to your new YAML file: deployment.yaml.

    Spaces are meaningful in YAML files. Ensure that you copy the correct spacing into your YAML file from the link.
  6. Use Ctrl+s (or Cmd+s for macOS) to save your changes.

3. Committing and pushing changes to GitHub

After making the required changes to your code, commit and push the modifications to your project GitHub repository.

Before committing your changes, ensure that your project pipeline build is promoted and at the Rollout to Run stage.
  1. In your Che workspace, click Git from the menu bar options and select Commit from the displayed options.

  2. In the Commit to repository dialog box:

    1. If they are not already, select all the changed and new files to add them to the commit.

    2. Add a commit message describing your changes.

    3. Select the Push committed changes to check box.

    4. Click Commit.

When the commit succeeds, the following message displays:

Pushed to origin

You have now committed your code changes to GitHub.

4. Viewing your detailed OpenShift Online quota usage

After committing your changes, view the resource details for your project again in OpenShift Online. Use the following instructions to see these details:

  1. Click Create and then Pipelines to view the new pipeline build. Committing and pushing your new YAML file triggers a new pipeline build for your CodeReady Toolchain project. Allow several minutes for the pipeline build to roll out to Stage.

  2. After the pipeline build is ready, return to the OpenShift Online console browser tab to review the optimized memory usage for your Hello World project:

    Optimizing Hello World Memory Usage
  3. Promote the application to the Run environment.

    You can now compare these details to the details in Reviewing detailed resource information in OpenShift Online to see the resource usage improvements.

  4. You have now completed the task, Optimize CodeReady Toolchain resource usage, in the Test Iteration. Navigate to the Plan tab and ensure that you change the state of the work item to Closed.